A series of demos when learning and working with LLDB.
For the demos which includes a python script to print debug info requets from LLDB, type the following commands to set up the script.
defaults delete com.apple.DebugSymbols
defaults write com.apple.DebugSymbols DBGShellCommands <full-path-to-script.py>
A simple example of how to compile a hello world program and how to use LLDB to debug it.
Set breakpoints by class and method names.
LLDB request dsyms for dylibs at target creation time.
A shell script can be used to resolve UUIDs into dsym files when LLDB requests such dsym files.
Ref: https://lldb.llvm.org/use/symbols.html
LLDB does NOT request dsyms when a breakpoint is set, nor when a breakpoint is triggered.
- Inline functions are compiled into each binary's
.debug_lines
table. settings set target.inline-breakpoint-strategy <always|headers|never>
to control whether or not to resolve inline functions for source and header files.
Logic to resolve file/line breakpoints:
- Iterate through all CU
- Find matching CUs by looking at both:
- The settings
target.inline-breakpoint-strategy
- The file list in the line table prologue
- The settings
- If a CU matches, load/look at its line table content to find the address
- Load/look at its symbol table to find the function that contains the address
- Find matching CUs by looking at both:
When the setting is off:
+--------+-----------------+--------------------+
| Module | Add Symbol File | Parse Symbol Table |
+--------+-----------------+--------------------+
| user | at attach | at br set |
+--------+-----------------+--------------------+
| shared | at attach | at attach |
+--------+-----------------+--------------------+
Command line aliases
cccc='xcrun clang++ -g -O0 -std=gnu++11 -stdlib=libc++'
dddd=dwarfdump
ddddan='dwarfdump --apple-names'
dddddl='dwarfdump --debug-line'
hhhh='objdump --section-headers'
oooo='otool -lv'
ssss='dsymutil -s'