LLDB (Debugger) Reference
Kip Landergren
(Updated: )
My cheat sheet for LLDB covering terminology, commands, and resources.
Contents
Commands
get help:
(lldb) help
get help with a specific command:
(lldb) help <command-name>
inspect the thread state:
(lldb) thread list
backtrace the current thread:
(lldb) thread backtrace
inspect frame arguments:
(lldb) frame variable
list available languages:
(lldb) help language
execute an expression, specifying language of objc
(Objective-C):
(lldb) expression --language objc -- printf("foo\n")
LLDB Terminology
- frame
- a data structure containing information about the called method or procedure and its variables
Resources
- Official LLDB Documentation
- Official GDB to LLDB command map
- Official tutorial
- Dancing in the Debugger — A Waltz with LLDB
- facebook/chisel LLDB commands
- LLDB Quick Start Guide - Apple Documentation Archive
- Debugging with Xcode - Apple Documentation Archive
FAQ
Why does LLDB error out with “too many arguments to method call, expected 1, have 2”?
... when using -[NSString stringWithFormat:]
?
Two stack overflow posts of note:
A workaround is to use:
(lldb) po [[NSString alloc] initWithFormat:@"%@", "foo"]
How can I limit a breakpoint to a specific shared library, like Foundation?
Use the -s
option:
(lldb) breakpoint set -s YourLib -r YourRegex