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.

  1. What kinds of breakpoints are there in Xcode and LLDB, and how do conditions, actions, symbolic and exception breakpoints and watchpoints help? 23.1.1 · L2
    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.

  1. How do expressions and printing work in LLDB (p, po, v), and how do you customise it with summaries, aliases and Python? 23.1.2 · L5
    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