lldb

debugging C, Objective-C and C++

from help
commands: 
  apropos    - Find a list of debugger commands related to a particular word/subject.
  breakpoint - operating on breakpoints. Also see _regexp-break.
  command    - managing or customizing the debugger commands.
  disassemble - Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.
  expression - Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined variables and variables currently in scope.
  frame      - operating on the current thread's frames.
  language   -  managing language-specific functionality.'.
  log        -  operating on logs.
  memory     -  operating on memory.
  watchpoint -  operating on watchpoints.
  process    -  operating on a process.
  plugin     -  managing or customizing plugin commands.
  register   -  commands to access thread registers.
  source     -  accessing source file information
  target     -  operating on debugger targets.
  thread     -  operating on one or more threads within a running process.
  type       -  operating on the type system
  script     - Pass an expression to the script interpreter for evaluation and return the results. 
                Drop into the interactive interpreter if no expression is given.
  settings   -  manipulating internal settable debugger variables.
  platform   -  manage and create platforms.
  gdb-remote - Connect to a remote GDB server.  If no hostname is provided, localhost is assumed.
  kdp-remote - Connect to a remote KDP server.  udp port 41139 is the default port number.
  bugreport  - creating domain specific bugreports.
  gui        - Switch into the curses based GUI mode.
  help       - Show a list of all debugger commands, or give details about specific commands.
  version    - Show version of LLDB debugger.
  quit       - Quit out of the LLDB debugger.

Current command abbreviations 'help command alias' 

  add-dsym  -- ('target symbols add')  Add a debug symbol file to one of the target's current modules by specifying a path to a debug symbols file, or using
               the options to specify a module to download symbols for.
  bt        -- ('_regexp-bt')  Show a backtrace.  An optional argument is accepted; if that argument is a number, it specifies the number of frames to
               display.  If that argument is 'all', full backtraces of all threads are displayed.
  c         -- ('process continue')  Continue execution of all threads in the current process.
  di        -- ('disassemble')  Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.
  dis
  display   -- ('_regexp-display')  Add an expression evaluation stop-hook.
  env       -- ('_regexp-env')  Implements a shortcut to viewing and setting environment variables.
  f         -- ('frame select')  Select a frame by index from within the current thread and make it the current frame.
  file      -- ('target create')  Create a target using the argument as the main executable.
  finish    -- ('thread step-out')  Finish executing the function of the currently selected frame and return to its call site in specified thread (current
               thread, if none specified).
  image     -- ('target modules')  commands for accessing information for one or more target modules.
  j         -- ('_regexp-jump')  Sets the program counter to a new address.
  jump    

  l         -- ('_regexp-list')  Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the appropriate 'source list'
               commands.
  list   
  n         -- ('thread step-over')  Source level single step in specified thread (current thread, if none specified), stepping over calls.
  next      
  s         -- ('thread step-in')  Source level single step in specified thread (current thread, if none specified).
  step     
  ni        -- ('thread step-inst-over')  Single step one instruction in specified thread (current thread, if none specified), stepping over calls.
  nexti      
  si        -- ('thread step-inst')  Single step one instruction in specified thread (current thread, if none specified).
  stepi     -- 

  call      -- ('expression --')  Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined variables and variables
               currently in scope.
  p 
  print
  po        -- ('expression -O  -- ')  Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined variables and variables
               currently in scope.

  r         -- ('process launch -X true --')  Launch the executable in the debugger.
  run
  b         -- ('_regexp-break')  Set a breakpoint using a regular expression to specify the location, where linenum is in decimal and address is in hex.
  rbreak    -- ('breakpoint set -r %1')  Sets a breakpoint or set of breakpoints in the executable.
  repl      -- ('expression -r  -- ')  Evaluate an expression (ObjC++ or Swift) in the current program context, using user defined variables and variables
               currently in scope.
  t         -- ('thread select')  Select a thread as the currently active thread.
  tbreak    -- ('_regexp-tbreak')  Set a one shot breakpoint using a regular expression to specify the location, where linenum is in decimal and address>
               is in hex.
  undisplay -- ('_regexp-undisplay')  Remove an expression evaluation stop-hook.
  up        -- ('_regexp-up')  Go up "n" frames in the stack (1 frame by default).
  down      -- ('_regexp-down')  Go down "n" frames in the stack (1 frame by default).
  x         -- ('memory read')  Read from the memory of the process being debugged.

  attach    -- ('_regexp-attach')  Attach to a process id if in decimal, otherwise treat the argument as a process name to attach to.
  detach    -- ('process detach')  Detach from the current process being debugged.
  kill      -- ('process kill')  Terminate the current process being debugged.
  continue  -- ('process continue')  Continue execution of all threads in the current process.
  q         -- ('quit')  Quit out of the LLDB debugger.
  exit
For more information on any command, type help command-name.

lldb -- The debugger

lldb [-hvdexw] [-a arch] [-c core-file] [-l script-language] [-s lldb-commands] [-n process-name] [-p pid] [[--] ...]

lldb is the command line interface for the LLDB debugger library. lldb can debug C, C++, Objective-C, Objective-C++ and Swift programs.

-h
--help
usage information. --help is more up-to-date and authoritative than this.
-v
--version
Prints out the version number of the lldb debugger.
-a
--arch arch
which architecture to use when launching the specified program (if the executable is built for multiple architectures.)
-f
--file filename
executable file to be launched / attach to.
-n
--attach-name process-name
a currently-running process to attach to. (or the name of a process to wait for if -w is used.)
-w
--wait-for
with -n wait for a new process of that name to be started -- and attach to it as early in the process-launch as possible.
-p
--attach-pid pid
a currently running process to attach to.
-c
--core core-file
the core file to examine.
-l
--script-language language
use the specified scripting language for user-defined scripts, rather than the default. Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl. Currently only the Python extensions have been implemented.
-s
--source filename
read in and execute the file "filename", which should contain lldb commands.
-e
--editor
Instructs lldb to open source files using the host's "external editor" mechanism.
-d
--debug
print out extra information for debugging itself.
-x
--no-lldbinit
Do not automatically parse any '.lldbinit' files.

(If you do not provide -f then the first argument will be the file to be debugged so 'lldb -- [ []]' also works. Remember to end the options with "--" if any of your arguments have a "-" in them.)

a help command which can be used to find descriptions and examples of all lldb commands. For help on "breakpoint set" type "help breakpoint set".

There is also an apropos command which will search the help text of all commands for a given term - this is useful for locating a com- mand by topic. For instance, "apropos breakpoint" will list any command that has the word "breakpoint" in its help text.

FILES

lldb will read settings/aliases/commands at startup,
  1. ~/.lldbinit-debugger . If you are using the lldb command line interface, this is ~/.lldbinit-lldb. If you are using lldb inside a GUI debugger like Xcode this will be ~/.lldbinit-Xcode. This is a useful place to put settings that you want to apply only when a given lldb command interpreter is used.
  2. ~/.lldbinit
  3. .lldbinit in the current working directory (where lldb is started) will be read.

SEE ALSO

The LLDB project page http://lldb.llvm.org/ has many different resources for lldb users - the gdb/lldb command equivalence page http://lldb.llvm.org/lldb-gdb.html can be especially helpful for users coming from gdb. To report bugs, please visit http://llvm.org/bugs/

Maintained by the LLDB Team, http://lldb.llvm.org/