Difference between revisions of "LLDB Commands"
Jeff-strong (talk | contribs) m (Editorial review and minor corrections) |
|||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Execution == | == Execution == | ||
{| class='wikitable' | {| class='wikitable' | ||
! Key Sequence | ! style="width: 50%"|Key Sequence | ||
! Purpose | ! style="width: 50%"|Purpose | ||
|- | |- | ||
| {{Command|process}} {{Command|launch}} {{Command|--stop-at-entry}} | | {{Command|process}} {{Command|launch}} {{Command|--stop-at-entry}} | ||
| Launch the | | Launch the executable in the debugger and then immediately halt. | ||
|- | |- | ||
| {{Command|process}} {{Command|launch}} {{Command|--}} {{CommandPlaceholder|arguments}} | | {{Command|process}} {{Command|launch}} {{Command|--}} {{CommandPlaceholder|arguments}} | ||
| Launch the | | Launch the executable in the debugger with the specified arguments. | ||
|- | |||
| {{Command|thread}} {{Command|step-in}} <br/> | |||
Alternative: {{Command|step}} <br/> | |||
Alternative: {{Command|s}} | |||
| Source level single step, stepping into calls. | |||
|- | |||
| {{Command|thread}} {{Command|step-over}} <br/> | |||
Alternative: {{Command|next}} <br/> | |||
Alternative: {{Command|n}} | |||
| Source level single step, stepping over calls. | |||
|- | |||
| {{Command|thread}} {{Command|step-out}} <br/> | |||
Alternative: {{Command|finish}} | |||
| Finish executing the current stack frame and stop after returning. | |||
|- | |||
| {{Command|thread}} {{Command|until}} {{CommandPlaceholder|line_number}} | |||
| Continue until a line number or address is reached by the current or specified thread. | |||
|} | |} | ||
== Breakpoint == | == Breakpoint == | ||
{| class='wikitable' | {| class='wikitable' | ||
! Key Sequence | ! style="width: 50%"|Key Sequence | ||
! Purpose | ! style="width: 50%"|Purpose | ||
|- | |- | ||
| {{Command|breakpoint}} {{Command|set}} {{Command|--name}} {{CommandPlaceholder|function_name}} | | {{Command|breakpoint}} {{Command|list}} | ||
| Set a breakpoint on the function named ''function_name'' | | List some or all breakpoints at configurable levels of detail. | ||
|- | |||
| {{Command|breakpoint}} {{Command|set}} {{Command|--name}} {{CommandPlaceholder|function_name}} <br/> | |||
Alternative: {{Command|b}} {{Command|s}} {{Command|-n}} {{CommandPlaceholder|function_name}} <br/> | |||
Alternative: {{Command|b}} {{CommandPlaceholder|function_name}} | |||
| Set a breakpoint on the function named ''function_name''. | |||
|- | |- | ||
| {{Command|breakpoint}} {{Command|set}} {{Command|--file}} {{CommandPlaceholder|file_name}} {{Command|--line}} {{CommandPlaceholder|line_number}} | | {{Command|breakpoint}} {{Command|set}} {{Command|--file}} {{CommandPlaceholder|file_name}} {{Command|--line}} {{CommandPlaceholder|line_number}} | ||
| Set a breakpoint in the file named ''file_name'' at line number ''line_number'' | | Set a breakpoint in the file named ''file_name'' at line number ''line_number''. | ||
|- | |||
| {{Command|breakpoint}} {{Command|disable}} {{CommandPlaceholder|breakpoint_id(s)}} | |||
| Disable the specified breakpoint(s) without deleting them. If none are specified, disable all breakpoints. | |||
|} | |||
== List == | |||
{| class='wikitable' | |||
! style="width: 50%"|Key Sequence | |||
! style="width: 50%"|Purpose | |||
|- | |||
| {{Command|list}} | |||
| List relevant source code using one of several shorthand formats. | |||
|} | |} | ||
Line 41: | Line 75: | ||
stepi | stepi | ||
</code> | </code> | ||
== Debugging Programs that Depend on Merlin Libraries == | |||
1. Create a soft link to the executable in the project's root: | |||
{{ConsoleLine|john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$|ln -s .build/debug/ScenesShell ScenesAlphaTransformsExample.bin}} | |||
2. Create a loader file by executing '''dylibLoader''': | |||
{{ConsoleLine|john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$|dylibLoader}} | |||
3. Edit the load file to execute '''lldb''': | |||
{{ConsoleLine|john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$|emacs ScenesAlphaTransformsExample.loader}} | |||
<syntaxhighlight lang="bash" highlight="3"> | |||
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 "$@" </syntaxhighlight> | |||
4. If this is an Igis project, add the resource path: | |||
<syntaxhighlight lang="bash" highlight="3"> | |||
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 "$@" </syntaxhighlight> | |||
5. Exit emacs. For convenience, rename the file to '''debug''': | |||
{{ConsoleLine|john-williams@codermerlin~/Experiences/ScenesAlphaTransformsExample$|mv ScenesAlphaTransformsExample.loader debug}} | |||
== References == | == References == | ||
* https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html | * https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html |
Latest revision as of 16:41, 2 May 2023
Execution[edit]
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 |
Source level single step, stepping into calls. |
thread step-over Alternative: next |
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. |
Breakpoint[edit]
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 |
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. |
List[edit]
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]
stepi
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