The lldb Debugger


Compile a binary with debugging information (minimally, -g):

🐚 $ clang -O0 -gfull -Wall -Wextra -pedantic hello.c -o hello

Run the binary in the lldb debugger:

🐚 $ lldb ./hello

lldb commands tend to follow this syntax:

<noun> <verb> [-options [option-value]] [argument [argument...]]

lldb has extensive help available.

(lldb) help
Debugger commands:
  apropos           -- List debugger commands related to a word or subject.
  breakpoint        -- Commands for operating on breakpoints (see 'help b' for shorthand.)
  bugreport         -- Commands for creating domain-specific bug reports.
  command           -- Commands for managing custom LLDB commands.

Use either lldb noun-verb commands or aliases to the equivalent gdb commands:

Set break point. Watch.