GDB | LLDB |
Launch a process no arguments. | |
(gdb) run (gdb) r |
(lldb) process launch (lldb) run (lldb) r |
Launch a process with arguments <args> . |
|
(gdb) run <args> (gdb) r <args> |
(lldb) process launch -- <args> (lldb) r <args> |
Launch a process for with arguments a.out 1 2 3 without having to supply the args every time. |
|
% gdb --args a.out 1 2 3 (gdb) run ... (gdb) run ... |
% lldb -- a.out 1 2 3 (lldb) run ... (lldb) run ... |
Or: | |
(gdb) set args 1 2 3 (gdb) run ... (gdb) run ... |
(lldb) settings set target.run-args 1 2 3 (lldb) run ... (lldb) run ... |
Launch a process with arguments in new terminal window (Mac OS X only). | |
|
(lldb) process launch --tty -- <args> (lldb) pro la -t -- <args> |
Launch a process with arguments in existing terminal /dev/ttys006 (Mac OS X only). | |
|
(lldb) process launch --tty=/dev/ttys006 -- <args> (lldb) pro la -t/dev/ttys006 -- <args> |
Set environment variables for process before launching. | |
(gdb) set env DEBUG 1 |
(lldb) settings set target.env-vars DEBUG=1 (lldb) set se target.env-vars DEBUG=1 (lldb) env DEBUG=1 |
Unset environment variables for process before launching. | |
(gdb) unset env DEBUG |
(lldb) settings remove target.env-vars DEBUG (lldb) set rem target.env-vars DEBUG |
Show the arguments that will be or were passed to the program when run. | |
(gdb) show args Argument list to give program being debugged when it is started is "1 2 3". |
(lldb) settings show target.run-args target.run-args (array of strings) = [0]: "1" [1]: "2" [2]: "3" |
Set environment variables for process and launch process in one command. | |
|
(lldb) process launch -v DEBUG=1 |
Attach to a process with process ID 123. | |
(gdb) attach 123 |
(lldb) process attach --pid 123 (lldb) attach -p 123 |
Attach to a process named "a.out". | |
(gdb) attach a.out |
(lldb) process attach --name a.out (lldb) pro at -n a.out |
Wait for a process named "a.out" to launch and attach. | |
(gdb) attach -waitfor a.out |
(lldb) process attach --name a.out --waitfor (lldb) pro at -n a.out -w |
Attach to a remote gdb protocol server running on system "eorgadd", port 8000. | |
(gdb) target remote eorgadd:8000 | (lldb) gdb-remote eorgadd:8000 |
Attach to a remote gdb protocol server running on the local system, port 8000. | |
(gdb) target remote localhost:8000 | (lldb) gdb-remote 8000 |
Attach to a Darwin kernel in kdp mode on system "eorgadd". | |
(gdb) kdp-reattach eorgadd | (lldb) kdp-remote eorgadd |
Do a source level single step in the currently selected thread. | |
(gdb) step (gdb) s |
(lldb) thread step-in (lldb) step (lldb) s |
Do a source level single step over in the currently selected thread. | |
(gdb) next (gdb) n |
(lldb) thread step-over (lldb) next (lldb) n |
Do an instruction level single step in the currently selected thread. | |
(gdb) stepi (gdb) si |
(lldb) thread step-inst (lldb) si |
Do an instruction level single step over in the currently selected thread. | |
(gdb) nexti (gdb) ni |
(lldb) thread step-inst-over (lldb) ni |
Step out of the currently selected frame. | |
(gdb) finish |
(lldb) thread step-out (lldb) finish |
Return immediately from the currently selected frame, with an optional return value. | |
(gdb) return <RETURN EXPRESSION> |
(lldb) thread return <RETURN EXPRESSION> |
Backtrace and disassemble every time you stop. | |
|
(lldb) target stop-hook add Enter your stop hook command(s). Type ‘DONE‘ to end. > bt > disassemble --pc > DONE Stop hook #1 added. |