Compile a binary with debugging information (minimally,
🐚 $ 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:
s: next line (will step into any function call)
n: next line in current thread (step over function call)
finish: exit this scope
Set break point. Watch.