LLDB Commands

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder


Key Sequence Purpose
 process   launch   --stop-at-entry  Launch the executable in the debugger and then immediately halt.
 process   launch   --   arguments  Launch the executable in the debugger with the specified arguments.
 thread   step-in 

Alternative:  step 
Alternative:  s 

Source level single step, stepping into calls.
 thread   step-over 

Alternative:  next 
Alternative:  n 

Source level single step, stepping over calls.
 thread   step-out 

Alternative:  finish 

Finish executing the current stack frame and stop after returning.
 thread   until   line_number  Continue until a line number or address is reached by the current or specified thread.


Key Sequence Purpose
 breakpoint   list  List some or all breakpoints at configurable levels of detail.
 breakpoint   set   --name   function_name 

Alternative:  b   s   -n   function_name 
Alternative:  b   function_name 

Set a breakpoint on the function named function_name.
 breakpoint   set   --file   file_name   --line   line_number  Set a breakpoint in the file named file_name at line number line_number.
 breakpoint   disable   breakpoint_id(s)  Disable the specified breakpoint(s) without deleting them. If none are specified, disable all breakpoints.


Key Sequence Purpose
 list  List relevant source code using one of several shorthand formats.

Disassemble Frame[edit]

disassemble --frame –mixed

Memory Read[edit]

memory read --size 4 --format x --count 4 0x00007fffffffdb64

Register Read[edit]

register read

Single-Step Assembly[edit]


Debugging Programs that Depend on Merlin Libraries[edit]

1. Create a soft link to the executable in the project's root:

john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$ ln -s .build/debug/ScenesShell ScenesAlphaTransformsExample.bin

2. Create a loader file by executing dylibLoader:

john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$ dylibLoader

3. Edit the load file to execute lldb:

john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$ emacs ScenesAlphaTransformsExample.loader

set -eu                                                                                                                           
export LD_LIBRARY_PATH=/usr/local/lib/merlin/Igis-1.4.0/Igis/.build/debug:/usr/local/lib/merlin/Scenes-1.1.6/Scenes/.build/debug: 
lldb ScenesAlphaTransformsExample.bin "$@"

4. If this is an Igis project, add the resource path:

set -eu                                                                                                                           
export LD_LIBRARY_PATH=/usr/local/lib/merlin/Igis-1.4.0/Igis/.build/debug:/usr/local/lib/merlin/Scenes-1.1.6/Scenes/.build/debug: 
export IGIS_RESOURCE_PATH=/usr/local/lib/merlin/Igis-1.4.0/Igis/Sources/Igis/Resources
lldb ScenesAlphaTransformsExample.bin "$@"

5. Exit emacs. For convenience, rename the file to debug:

john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$ mv ScenesAlphaTransformsExample.loader debug