<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
<title>LLDB Goals</title> | |
</head> | |
<body> | |
<div class="www_title"> | |
The <strong>LLDB</strong> Debugger | |
</div> | |
<div id="container"> | |
<div id="content"> | |
<!--#include virtual="sidebar.incl"--> | |
<div id="middle"> | |
<div class="post"> | |
<h1 class ="postheader">LLDB to GDB Command Map</h1> | |
<div class="post"> | |
<p>Below is a table of LLDB commands with the GDB counterparts. | |
The built in GDB compatability aliases in GDB are also | |
listed.</p> | |
</div> | |
<div class="postfooter"></div> | |
<h1 class ="postheader">Execution Commands</h1> | |
<div class="post"> | |
<p> | |
<table class="stats" width="620" cellspacing="0"> | |
<tr> | |
<td class="hed" width="50%">LLDB</td> | |
<td class="hed" width="50%">GDB</td> | |
</tr> | |
<tr><td class="header" colspan="2">Launch a process no arguments.</td></tr> | |
<td class="content"> | |
<b>(lldb)</b> process launch<br> | |
<b>(lldb)</b> run<br> | |
<b>(lldb)</b> r | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> run<br> | |
<b>(gdb)</b> r | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Launch a process with arguments <code><args></code>.</td></tr> | |
<td class="content"> | |
<b>(lldb)</b> process launch -- <args><br> | |
<b>(lldb)</b> run -- <args><br> | |
<b>(lldb)</b> r <args> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> run <args><br> | |
<b>(gdb)</b> r <args> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Launch a process with arguments in new terminal window (Mac OS X only).</td></tr> | |
<td class="content"> | |
<b>(lldb)</b> process launch --tty -- <args><br> | |
<b>(lldb)</b> process launch -t -- <args><br> | |
</td> | |
<td class="content"> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Launch a process with arguments in existing terminal <cope>/dev/ttys006</code> (Mac OS X only).</td></tr> | |
<td class="content"> | |
<b>(lldb)</b> process launch --tty=/dev/ttys006 -- <args><br> | |
<b>(lldb)</b> process launch -t/dev/ttys006 -- <args><br> | |
</td> | |
<td class="content"> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Attach to a process with process ID 123.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> process attach --pid 123<br> | |
<b>(lldb)</b> attach -p 123 | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> attach 123 | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Attach to a process named "a.out".</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> process attach --name a.out<br> | |
<b>(lldb)</b> process attach -n a.out | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> attach a.out | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Wait for a process named "a.out" to launch and attach.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> process attach --name a.out --waitfor<br> | |
<b>(lldb)</b> process attach -n a.out -w | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> attach -waitfor a.out | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Do a source level single step in the currently selected thread.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread step-in<br> | |
<b>(lldb)</b> step<br> | |
<b>(lldb)</b> s | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> step<br> | |
<b>(gdb)</b> s | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Do a source level single step over in the currently selected thread.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread step-over<br> | |
<b>(lldb)</b> next<br> | |
<b>(lldb)</b> n<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> next<br> | |
<b>(gdb)</b> n | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Do an instruction level single step in the currently selected thread.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread step-inst<br> | |
<b>(lldb)</b> si<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> stepi<br> | |
<b>(gdb)</b> si | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Do an instruction level single step over in the currently selected thread.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread step-inst-over<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> nexti<br> | |
<b>(gdb)</b> ni | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Step out of the currently selected frame.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread step-out<br> | |
<b>(lldb)</b> finish<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> finish<br> | |
</td> | |
</tr> | |
</table> | |
<p> | |
</div> | |
<div class="postfooter"></div> | |
<h1 class ="postheader">Breakpoint Commands</h1> | |
<div class="post"> | |
<p> | |
<table class="stats" width="620" cellspacing="0"> | |
<tr> | |
<td class="hed" width="50%">LLDB</td> | |
<td class="hed" width="50%">GDB</td> | |
</tr> | |
<tr><td class="header" colspan="2">Set a breakpoint at all functions named <b>main</b>.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> breakpoint set --name main<br> | |
<b>(lldb)</b> breakpoint set -n main<br> | |
<b>(lldb)</b> b main | |
</td> | |
<td class="content"> | |
<b>(lldb)</b> break main | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Set a breakpoint in file <b>test.c</b> at line <b>12</b>.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> breakpoint set --file test.c --line 12<br> | |
<b>(lldb)</b> breakpoint set -f test.c -l 12<br> | |
<b>(lldb)</b> b test.c:12 | |
</td> | |
<td class="content"> | |
<b>(lldb)</b> break test.c:12 | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Set a breakpoint at all C++ methods whose basename is <b>main</b>.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> breakpoint set --method main<br> | |
<b>(lldb)</b> breakpoint set -M main<br> | |
</td> | |
<td class="content"> | |
<b>(lldb)</b> break main<br> | |
<i>(Hope that there are no C funtions named <b>main</b>)</i>. | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Set a breakpoint at all Objective C methods whose selector is <b>count</b>.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> breakpoint set --selector count<br> | |
<b>(lldb)</b> breakpoint set -S count<br> | |
</td> | |
<td class="content"> | |
<b>(lldb)</b> break count<br> | |
<i>(Hope that there are no C or C++ funtions named <b>count</b>)</i>. | |
</td> | |
</tr> | |
</table> | |
<p> | |
</div> | |
<div class="postfooter"></div> | |
<h1 class ="postheader">Examining Thread State</h1> | |
<div class="post"> | |
<p> | |
<table class="stats" width="620" cellspacing="0"> | |
<tr> | |
<td class="hed" width="50%">LLDB</td> | |
<td class="hed" width="50%">GDB</td> | |
</tr> | |
<tr><td class="header" colspan="2">Show the arguments and local variables for the current frame.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> frame variable<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> info args<br> | |
and<br> | |
<b>(gdb)</b> info locals<br> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Show the stack backtrace for the current thread.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread backtrace<br> | |
<b>(lldb)</b> bt<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> bt<br> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Show the stack backtraces for all threads.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> thread backtrace all<br> | |
<b>(lldb)</b> bt all | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> thread apply all bt | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Show all thread registers.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> register read | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> info all-registers | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Show the values for the thread registers name "rax", "rsp" and "rbp".</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> register read rax rsp rbp | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> info all-registers rax rsp rbp | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Read memory from address 0xbffff3c0 and show 4 hex uint32_t values.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> memory read --size 4 --format x --count 4 0xbffff3c0<br> | |
<b>(lldb)</b> x --size 4 --format x --count 4 0xbffff3c0 | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> x/4xw 0xbffff3c0 | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Disassemble the current function for the current frame.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --frame<br> | |
<b>(lldb)</b> disassemble -f | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> disassemble | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Disassemble any functions named <b>main</b>.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --name main<br> | |
<b>(lldb)</b> disassemble -n main | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> disassemble main | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Disassemble an address range.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --start-address 0x00001eb8 --end-address 0x00001ec3<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> disassemble 0x00001eb8 0x00001ec3 | |
</td> | |
</tr> | |
\ <tr><td class="header" colspan="2">Show mixed source and disassembly for the current function for the current frame.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --frame --mixed<br> | |
<b>(lldb)</b> disassemble -f -m | |
</td> | |
<td class="content"> | |
n/a | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Disassemble the current function for the current frame and show the opcode bytes.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --frame --bytes<br> | |
<b>(lldb)</b> disassemble -f -b | |
</td> | |
<td class="content"> | |
n/a | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Disassemble the current source line for the current frame.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> disassemble --line<br> | |
<b>(lldb)</b> disassemble -l | |
</td> | |
<td class="content"> | |
n/a | |
</td> | |
</tr> | |
</table> | |
<p> | |
</div> | |
<div class="postfooter"></div> | |
<h1 class ="postheader">Executable and Shared Library Query Commands</h1> | |
<div class="post"> | |
<p> | |
<table class="stats" width="620" cellspacing="0"> | |
<tr> | |
<td class="hed" width="50%">LLDB</td> | |
<td class="hed" width="50%">GDB</td> | |
</tr> | |
<tr><td class="header" colspan="2">List the main executable and all dependent shared libraries.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> image list<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> info shared<br> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Lookup information for a raw address in the executable or any shared libraries.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> image lookup --address 0x1ec4<br> | |
<b>(lldb)</b> image lookup -a 0x1ec4<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> info symbol 0x1ec4<br> | |
</td> | |
</tr> | |
<tr><td class="header" colspan="2">Dump all sections from the main executable and any shared libraries.</td></tr> | |
<tr> | |
<td class="content"> | |
<b>(lldb)</b> image dump sections<br> | |
</td> | |
<td class="content"> | |
<b>(gdb)</b> maintenance info sections<br> | |
</td> | |
</tr> | |
</table> | |
<p> | |
</div> | |
<div class="postfooter"></div> | |
<p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |