Skip to main content

Essential LLDB Commands

Table of Contents

Below I list a set of essential lldb commands I regularly use. A more complete cheat sheet can be found here (direct link).

Compilation #

Compile in Debug mode with the following additional flags:

-g -ggdb

Usage #

Running

$ lldb Executable
(lldb) target create "Executable"
Current executable set to 'Executable' (x86_64).
(lldb) run [args]

Navigating a stack

  • Breakpoints
    b main
    breakpoint set --name main
  • Backtraces
    bt
    thread backtrace
    thread backtrace all
    • Frame information
      frame info
    • Navigate down
      down
      frame s -r-1
      frame select --relative=-1
    • Navigate up
      up
      frame s -r1
      frame select --relative=1
    • Select a frame
      f 3
      fr s 3
      frame select 3
  • Continue
    c
    thread continue
  • Step in
    s
    step
    thread step-in
  • Step over
    n
    next
    thread step-over
  • Step out
    finish
    thread step-out

Evaluating variables

  • Local variables
    frame variable
    fr v
  • Print the contents of a variable
    p var
    fr v var
    frame variable var