(2020)
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:
thread step-in
or step
or s
: next line (will step into any function call)thread step-over
or next
or n
: next line in current thread (step over function call)thread step-out
or finish
: exit this scopeSet break point. Watch.