LLDB | GDB |
Launch a process no arguments. | |
(lldb) (lldb) (lldb) | (gdb) (gdb) |
Launch a process with arguments | |
(lldb) (lldb) | (gdb) (gdb) |
Launch a process for with arguments a.out 1 2 3 | |
% (lldb) ... (lldb) ... | % (gdb) ... (gdb) ... |
Launch a process with arguments in new terminal window (Mac OS X only). | |
(lldb) (lldb) | |
Launch a process with arguments in existing terminal | |
(lldb) (lldb) | |
Attach to a process with process ID 123. | |
(lldb) (lldb) | (gdb) |
Attach to a process named "a.out". | |
(lldb) (lldb) | (gdb) |
Wait for a process named "a.out" to launch and attach. | |
(lldb) (lldb) | (gdb) |
Do a source level single step in the currently selected thread. | |
(lldb) (lldb) (lldb) | (gdb) (gdb) |
Do a source level single step over in the currently selected thread. | |
(lldb) (lldb) (lldb) | (gdb) (gdb) |
Do an instruction level single step in the currently selected thread. | |
(lldb) (lldb) | (gdb) (gdb) |
Do an instruction level single step over in the currently selected thread. | |
(lldb) (lldb) | (gdb) (gdb) |
Step out of the currently selected frame. | |
(lldb) (lldb) | (gdb) |
Backtrace and disassemble every time you stop. | |
(lldb) Enter your stop hook command(s). Type 'DONE' to end. > bt > disassemble --pc > DONE Stop hook #1 added. |
BREAKPOINT COMMANDS
LLDB | GDB |
Set a breakpoint at all functions named | |
(lldb) (lldb) (lldb) | (gdb) |
Set a breakpoint in file | |
(lldb) (lldb) (lldb) | (gdb) |
Set a breakpoint at all C++ methods whose basename is | |
(lldb) (lldb) | (gdb) (Hope that there are no C funtions named |
Set a breakpoint at and object C function: | |
(lldb) (lldb) | (gdb) |
Set a breakpoint at all Objective C methods whose selector is | |
(lldb) (lldb) | (gdb) (Hope that there are no C or C++ funtions namedcount). |
List all breakpoints. | |
(lldb) (lldb) | (gdb) |
Delete a breakpoint. | |
(lldb) (lldb) | (gdb) |
WATCHPOINT COMMANDS
LLDB | GDB |
Set a watchpoint on a variable when it is written to. | |
(lldb) (lldb) | (gdb) |
Set a watchpoint on a memory location when it is written into. The size of the region to watch for defaults to the pointer size if no '-x byte_size' is specified. This command takes raw input, evaluated as an expression returning an unsigned integer pointing to the start of the region, after the '--' option terminator. | |
(lldb) (lldb) | (gdb) |
Set a condition on a watchpoint. | |
(lldb) (lldb) (lldb) ... (lldb) * thread #1: tid = 0x1c03, 0x0000000100000ef5 a.out`modify + 21 at main.cpp:16, stop reason = watchpoint 1 frame #0: 0x0000000100000ef5 a.out`modify + 21 at main.cpp:16 frame #1: 0x0000000100000eac a.out`main + 108 at main.cpp:25 frame #2: 0x00007fff8ac9c7e1 libdyld.dylib`start + 1 (lldb) (int32_t) global = 5 | |
List all watchpoints. | |
(lldb) (lldb) | (gdb) |
Delete a watchpoint. | |
(lldb) (lldb) | (gdb) |
EXAMINING VARIABLES
LLDB | GDB |
Show the arguments and local variables for the current frame. | |
(lldb) | (gdb) and (gdb) |
Show the local variables for the current frame. | |
(lldb) (lldb) | (gdb) |
Show the contents of local variable "bar". | |
(lldb) (lldb) (lldb) | (gdb) |
Show the contents of local variable "bar" formatted as hex. | |
(lldb) (lldb) | (gdb) |
Show the contents of global variable "baz". | |
(lldb) (lldb) | (gdb) |
Show the global/static variables defined in the current source file. | |
(lldb) (lldb) | n/a |
Display a the variable "argc" and "argv" every time you stop. | |
(lldb) (lldb) (lldb) (lldb) | (gdb) (gdb) |
Display a the variable "argc" and "argv" only when you stop in the function named | |
(lldb) (lldb) | |
Display the variable "*this" only when you stop in c class named | |
(lldb) (lldb) |
EVALUATING EXPRESSIONS
LLDB | GDB |
Evaluating a generalized expression in the current frame. | |
(lldb) or using the print alias: (lldb) | (gdb) or if you don't want to see void returns: (gdb) |
Printing the ObjC "description" of an object. | |
(lldb) or using the po alias: (lldb) | (gdb) |
Print the dynamic type of the result of an expression. | |
(lldb) (lldb) or set dynamic type printing to be the default:(lldb) | (gdb) (gdb) only works for C++ objects. |
EXAMINING THREAD STATE
LLDB | GDB |
Show the stack backtrace for the current thread. | |
(lldb) (lldb) | (gdb) |
Show the stack backtraces for all threads. | |
(lldb) (lldb) | (gdb) |
Select a different stack frame by index for the current thread. | |
(lldb) | (gdb) |
List information about the currently selected frame in the current thread. | |
(lldb) | |
Select the stack frame that called the current stack frame. | |
(lldb) (lldb) | (gdb) |
Select the stack frame that is called by the current stack frame. | |
(lldb) (lldb) (lldb) | (gdb) |
Select a different stack frame using a relative offset. | |
(lldb) (lldb) (lldb) (lldb) | (gdb) (gdb) |
Show the general purpose registers for the current thread. | |
(lldb) | (gdb) |
Show the general purpose registers for the current thread formatted as | |
(lldb) (lldb) LLDB now supports the GDB shorthand format syntax but there can't be space after the command: (lldb) | |
Show all registers in all register sets for the current thread. | |
(lldb) (lldb) | (gdb) |
Show the values for the registers named "rax", "rsp" and "rbp" in the current thread. | |
(lldb) | (gdb) |
Show the values for the register named "rax" in the current thread formatted as | |
(lldb) (lldb) LLDB now supports the GDB shorthand format syntax but there can't be space after the command: (lldb) (lldb) | (gdb) |
Read memory from address 0xbffff3c0 and show 4 hex uint32_t values. | |
(lldb) (lldb) (lldb) LLDB now supports the GDB shorthand format syntax but there can't be space after the command: (lldb) (lldb) (lldb) | (gdb) |
Read memory starting at the expression "argv[0]". | |
(lldb) NOTE: (lldb) | (gdb) |
Read 512 bytes of memory from address 0xbffff3c0 and save results to a local file as | |
(lldb) (lldb) (lldb) | (gdb) (gdb) (gdb) (gdb) |
Save binary memory data starting at 0x1000 and ending at 0x2000 to a file. | |
(lldb) (lldb) | |
(gdb) | |
Disassemble the current function for the current frame. | |
(lldb) (lldb) | (gdb) |
Disassemble any functions named | |
(lldb) (lldb) | (gdb) |
Disassemble an address range. | |
(lldb) (lldb) | (gdb) |
Disassemble 20 instructions from a given address. | |
(lldb) (lldb) | (gdb) |
Show mixed source and disassembly for the current function for the current frame. | |
(lldb) (lldb) | n/a |
Disassemble the current function for the current frame and show the opcode bytes. | |
(lldb) (lldb) | n/a |
Disassemble the current source line for the current frame. | |
(lldb) (lldb) | n/a |
EXECUTABLE AND SHARED LIBRARY QUERY COMMANDS
LLDB | GDB |
List the main executable and all dependent shared libraries. | |
(lldb) | (gdb) |
Lookup information for a raw address in the executable or any shared libraries. | |
(lldb) (lldb) | (gdb) |
Lookup information for an address in | |
(lldb) (lldb) | |
Lookup information for for a type Point | |
(lldb) (lldb) | (lldb) |
Dump all sections from the main executable and any shared libraries. | |
(lldb) | (gdb) |
Dump all sections in the | |
(lldb) | |
Dump all symbols from the main executable and any shared libraries. | |
(lldb) | |
Dump all symbols in | |
(lldb) |
MISCELLANEOUS
LLDB | GDB |
Echo text to the screen. | |
(lldb) | (gdb) |