home blog portfolio Ian Fisher

LLDB cheatsheet

https://lldb.llvm.org/use/tutorial.html

// set a breakpoint at function `foo`
$ breakpoint set --name foo
$ br s -n foo

// set a breakpoint at line 12 of file `foo.c`
$ breakpoint set --file foo.c --line 12
$ br s -f foo.c -l 12

// run program
$ run
$ r

// continue after breakpoint
$ thread continue
$ c

// show current code
$ f

// stepping
$ thread step-in
$ step
$ thread step-over
$ next
$ thread step-out
$ finish

// examine thread and processor state
$ thread list
$ thread backtrace
$ register read
$ reg r
$ reg r x0
// print registers as signed base-10
// see `help format` for all supported formats
$ register read -f d
$ memory read --size 4 --format x --count 4 0xbffff3c0
$ x -s4 -fx -c4 0xbffff3c0

// alias a command
$ command alias bfl breakpoint set -f %1 -l %2
$ bfl foo.c 12

See also