23.1 · LLDB and breakpoints
The debugger is the fastest way to ask a running program a question. Most of its power is not stepping line by line, but stopping only at the one moment that matters and then looking around.
Mental model. Do not stop everywhere. Stop where and when it matters (a condition, a count, a changed value, an error being thrown), then inspect and log instead of stepping.
Stopping at the right moment
Breakpoint kinds, conditions, actions, symbolic and exception breakpoints, and watchpoints.
- What kinds of breakpoints are there in Xcode and LLDB, and how do conditions, actions, symbolic and exception breakpoints and watchpoints help?
A line breakpoint stops when execution reaches a line; the useful part is what you add to it. A condition (n == 3) stops only when an expression is true, an…
Asking questions
Expressions, printing, scripting and customising LLDB.
- How do expressions and printing work in LLDB (p, po, v), and how do you customise it with summaries, aliases and Python?
LLDB has several ways to look at a value, and they differ in what they run. frame variable (v) reads variables straight from memory without executing code, so…
More in Debugging & Instruments
- 23.2 · The view debugger, network inspection and memory bugs
- 23.3 · Sanitizers, and bugs that only appear in Release
- 23.4 · Unified logging: Logger, levels, privacy and reading logs back
- 23.5 · Crash reports, symbolication and a production diagnostics pipeline
- 23.6 · Console, sysdiagnose and reproducing a bug
- 23.7 · Schemes, test plans, simulators and derived data
- 23.8 · Reading sanitizer output, exit codes and runtime traps
- 23.9 · Diagnosing a hang, malloc debugging and leaks from the command line
- 23.10 · Demangling, atos and empty dSYMs, and log formatting