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

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