GDB |
LLDB |
(gdb) bt |
(lldb) thread backtrace (lldb) bt |
(gdb) thread apply all bt |
(lldb) thread backtrace all (lldb) bt all |
(gdb) bt 5 |
(lldb) thread backtrace -c 5 (lldb) bt 5 (lldb-169 and later) (lldb) bt -c 5 (lldb-168 and earlier) |
(gdb) frame 12 |
(lldb) frame select 12 (lldb) fr s 12 (lldb) f 12 |
|
(lldb) frame info |
(gdb) up |
(lldb) up (lldb) frame select --relative=1 |
(gdb) down |
(lldb) down (lldb) frame select --relative=-1 (lldb) fr s -r-1 |
(gdb) up 2 (gdb) down 3 |
(lldb) frame select --relative 2 (lldb) fr s -r2
(lldb) frame select --relative -3 (lldb) fr s -r-3 |
(gdb) info registers |
(lldb) register read |
(gdb) p $rax = 123 |
(lldb) register write rax 123 |
(gdb) jump *$pc+8 |
(lldb) register write pc `$pc+8` |
|
(lldb) register read --format i (lldb) re r -f i
LLDB now supports the GDB shorthand format syntax but there can‘t be space after the command: (lldb) register read/d |
(gdb) info all-registers |
(lldb) register read --all (lldb) re r -a |
(gdb) info all-registers rax rsp rbp |
(lldb) register read rax rsp rbp |
(gdb) p/t $rax |
(lldb) register read --format binary rax (lldb) re r -f b rax
LLDB now supports the GDB shorthand format syntax but there can‘t be space after the command: (lldb) register read/t rax (lldb) p/t $rax |
(gdb) x/4xw 0xbffff3c0 |
(lldb) memory read --size 4 --format x --count 4 0xbffff3c0 (lldb) me r -s4 -fx -c4 0xbffff3c0 (lldb) x -s4 -fx -c4 0xbffff3c0
LLDB now supports the GDB shorthand format syntax but there can‘t be space after the command: (lldb) memory read/4xw 0xbffff3c0 (lldb) x/4xw 0xbffff3c0 (lldb) memory read --gdb-format 4xw 0xbffff3c0 |
(gdb) x argv[0] |
(lldb) memory read `argv[0]` NOTE: any command can inline a scalar expression result (as long as the target is stopped) using backticks around any expression: (lldb) memory read --size `sizeof(int)` `argv[0]` |
(gdb) set logging on (gdb) set logging file /tmp/mem.txt (gdb) x/512bx 0xbffff3c0 (gdb) set logging off |
(lldb) memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0 (lldb) me r -o/tmp/mem.txt -c512 0xbffff3c0 (lldb) x/512bx -o/tmp/mem.txt 0xbffff3c0 |
(gdb) dump memory /tmp/mem.bin 0x1000 0x2000 |
(lldb) memory read --outfile /tmp/mem.bin --binary 0x1000 0x2000 (lldb) me r -o /tmp/mem.bin -b 0x1000 0x2000 |
(gdb) info malloc 0x10010d680 |
(lldb) command script import lldb.macosx.heap (lldb) process launch --environment MallocStackLogging=1 -- [ARGS] (lldb) malloc_info --stack-history 0x10010d680 |
|
(lldb) command script import lldb.macosx.heap (lldb) malloc_info --type 0x10010d680 |
|
(lldb) command script import lldb.macosx.heap (lldb) ptr_refs EXPR |
|
(lldb) command script import lldb.macosx.heap (lldb) cstr_refs CSTRING |
(gdb) disassemble |
(lldb) disassemble --frame (lldb) di -f |
(gdb) disassemble main |
(lldb) disassemble --name main (lldb) di -n main |
(gdb) disassemble 0x1eb8 0x1ec3 |
(lldb) disassemble --start-address 0x1eb8 --end-address 0x1ec3 (lldb) di -s 0x1eb8 -e 0x1ec3 |
(gdb) x/20i 0x1eb8 |
(lldb) disassemble --start-address 0x1eb8 --count 20 (lldb) di -s 0x1eb8 -c 20 |
n/a |
(lldb) disassemble --frame --mixed (lldb) di -f -m |
n/a |
(lldb) disassemble --frame --bytes (lldb) di -f -b |
n/a |
(lldb) disassemble --line (lldb) di -l |