Add examples of shortest-possible lldb commands where appropriate.

Add new "Examining Variables" section.
Updated a few command entries to match current lldb behavior.

llvm-svn: 142898
This commit is contained in:
Jason Molenda 2011-10-25 01:28:31 +00:00
parent 4495393fed
commit b278f1e191
1 changed files with 213 additions and 140 deletions

View File

@ -10,27 +10,28 @@
<div class="www_title">
The <strong>LLDB</strong> Debugger
</div>
<div id="container">
<div id="content">
<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">
<div id="middle">
<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>
<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>
<div class="postfooter"></div>
<h1 class ="postheader">Execution Commands</h1>
<div class="post">
<h1 class ="postheader">Execution Commands</h1>
<div class="post">
<p>
<table class="stats" width="620" cellspacing="0">
<table class="stats" width="620" cellspacing="0">
<tr>
<td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
@ -48,11 +49,10 @@
</td>
</tr>
<tr><td class="header" colspan="2">Launch a process with arguments <code>&lt;args&gt;</code>.</td></tr>
<td class="content">
<b>(lldb)</b> process launch -- &lt;args&gt;<br>
<b>(lldb)</b> run -- &lt;args&gt;<br>
<b>(lldb)</b> r &lt;args&gt;
</td>
<td class="content">
@ -81,7 +81,7 @@
<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 -- &lt;args&gt;<br>
<b>(lldb)</b> process launch -t -- &lt;args&gt;<br>
<b>(lldb)</b> pro la -t -- &lt;args&gt;<br>
</td>
<td class="content">
</td>
@ -90,7 +90,7 @@
<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 -- &lt;args&gt;<br>
<b>(lldb)</b> process launch -t/dev/ttys006 -- &lt;args&gt;<br>
<b>(lldb)</b> pro la -t/dev/ttys006 -- &lt;args&gt;<br>
</td>
<td class="content">
</td>
@ -111,7 +111,7 @@
<tr>
<td class="content">
<b>(lldb)</b> process attach --name a.out<br>
<b>(lldb)</b> process attach -n a.out
<b>(lldb)</b> pro at -n a.out
</td>
<td class="content">
<b>(gdb)</b> attach a.out
@ -122,7 +122,7 @@
<tr>
<td class="content">
<b>(lldb)</b> process attach --name a.out --waitfor<br>
<b>(lldb)</b> process attach -n a.out -w
<b>(lldb)</b> pro at -n a.out -w
</td>
<td class="content">
<b>(gdb)</b> attach -waitfor a.out
@ -191,11 +191,172 @@
</td>
</tr>
<tr><td class="header" colspan="2">Backtrace and disassemble every time you stop.</td></tr>
<tr>
<td class="content" colspan="2">
<b>(lldb)</b> target stop-hook add<br>
Enter your stop hook command(s). Type 'DONE' to end.<br>
&gt; bt<br>
&gt; disassemble --pc<br>
&gt; DONE<br>
Stop hook #1 added.<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> br s -n main<br>
<b>(lldb)</b> b main
</td>
<td class="content">
<b>(gdb)</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> br s -f test.c -l 12<br>
<b>(lldb)</b> b test.c:12
</td>
<td class="content">
<b>(gdb)</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> br s -M main<br>
</td>
<td class="content">
<b>(gdb)</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> br s -S count<br>
</td>
<td class="content">
<b>(gdb)</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 Variables</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 local variables for the current frame.</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> frame variable --no-args<br>
<b>(lldb)</b> fr v -a<br>
</td>
<td class="content">
<b>(gdb)</b> info locals<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the contents of local variable "bar".</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> frame variable bar <br>
<b>(lldb)</b> fr v bar <br>
<b>(lldb)</b> p bar <br>
</td>
<td class="content">
<b>(gdb)</b> p bar<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the contents of local variable "bar" formatted as hex.</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> frame variable --format x bar <br>
<b>(lldb)</b> fr v -f x bar <br>
</td>
<td class="content">
<b>(gdb)</b> p/x bar<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the contents of global variable "baz".</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> target variable baz <br>
<b>(lldb)</b> ta v baz <br>
</td>
<td class="content">
<b>(gdb)</b> p baz<br>
</td>
</tr>
<tr><td class="header" colspan="2">Show the global/static variables defined in the current source file.</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> target variable <br>
<b>(lldb)</b> ta v <br>
</td>
<td class="content">
n/a<br>
</td>
</tr>
<tr><td class="header" colspan="2">Display a the variable "argc" and "argv" everytime you stop.</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> target stop-hook add --one-liner "frame variable argc argv"<br>
<b>(lldb)</b> ta st a -o "fr v argc argv"<br>
<b>(lldb)</b> display argc<br>
<b>(lldb)</b> display argv<br>
</td>
<td class="content">
<b>(gdb)</b> display argc<br>
@ -215,111 +376,23 @@
<tr>
<td class="content" colspan="2">
<b>(lldb)</b> target stop-hook add --classname MyClass --one-liner "frame variable *this"<br>
</td>
</tr>
<tr><td class="header" colspan="2">Backtrace and disassemble every time you stop.</td></tr>
<tr>
<td class="content" colspan="2">
<b>(lldb)</b> target stop-hook add<br>
Enter your stop hook command(s). Type 'DONE' to end.<br>
&gt; bt<br>
&gt; disassemble --pc<br>
&gt; DONE<br>
Stop hook #1 added.<br>
<b>(lldb)</b> ta st a -c MyClass -o "fr v *this"<br>
</td>
</tr>
</table>
<p>
</div>
<div class="postfooter"></div>
<h1 class ="postheader">Breakpoint Commands</h1>
<div class="post">
<h1 class ="postheader">Examining Thread State</h1>
<div class="post">
<p>
<table class="stats" width="620" cellspacing="0">
<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> br s -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>
@ -369,7 +442,7 @@
<td class="content">
<b>(lldb)</b> down<br>
<b>(lldb)</b> frame select --relative=-1<br>
<b>(lldb)</b> frame select -r-1<br>
<b>(lldb)</b> fr s -r-1<br>
</td>
<td class="content">
<b>(gdb)</b> down
@ -380,10 +453,10 @@
<tr>
<td class="content">
<b>(lldb)</b> frame select --relative 2<br>
<b>(lldb)</b> frame select -r2<br>
<b>(lldb)</b> fr s -r2<br>
<br>
<b>(lldb)</b> frame select --relative -3<br>
<b>(lldb)</b> frame select -r-3<br>
<b>(lldb)</b> fr s -r-3<br>
</td>
<td class="content">
<b>(gdb)</b> up 2<br>
@ -401,12 +474,12 @@
</td>
</tr>
<tr><td class="header" colspan="2">Show the general purpose registers for the current thread formatted as <b>unsigned decimal</b>. LLDB tries to use
the same format characters as <b>printf</b> when possible.</td></tr>
<tr><td class="header" colspan="2">Show the general purpose registers for the current thread formatted as <b>signed decimal</b>. LLDB tries to use
the same format characters as <b>printf(3)</b> when possible. Type "help format" to see the full list of format specifiers.</td></tr>
<tr>
<td class="content">
<b>(lldb)</b> register read --format i<br>
<b>(lldb)</b> register read -f i<br>
<b>(lldb)</b> re r -f i<br>
</td>
<td class="content">
</td>
@ -416,7 +489,7 @@
<tr>
<td class="content">
<b>(lldb)</b> register read --all<br>
<b>(lldb)</b> register read -a<br>
<b>(lldb)</b> re r -a<br>
</td>
<td class="content">
<b>(gdb)</b> info all-registers<br>
@ -437,7 +510,7 @@
<tr>
<td class="content">
<b>(lldb)</b> register read --format binary rax<br>
<b>(lldb)</b> register read -f b rax<br>
<b>(lldb)</b> re r -f b rax<br>
</td>
<td class="content">
<b>(gdb)</b> p/t $rax<br>
@ -448,7 +521,7 @@
<tr>
<td class="content">
<b>(lldb)</b> memory read --size 4 --format x --count 4 0xbffff3c0<br>
<b>(lldb)</b> memory read -s4 -fx -c4 0xbffff3c0<br>
<b>(lldb)</b> me r -s4 -fx -c4 0xbffff3c0<br>
<b>(lldb)</b> x -s4 -fx -c4 0xbffff3c0<br>
</td>
<td class="content">
@ -460,7 +533,7 @@
<tr>
<td class="content">
<b>(lldb)</b> memory read --outfile /tmp/mem.txt --count 512 0xbffff3c0<br>
<b>(lldb)</b> memory read -o/tmp/mem.txt -c512 0xbffff3c0<br>
<b>(lldb)</b> me r -o/tmp/mem.txt -c512 0xbffff3c0<br>
</td>
<td class="content">
<b>(gdb)</b> set logging on<br>
@ -474,7 +547,7 @@
<tr>
<td class="content"colspan=2>
<b>(lldb)</b> memory read --outfile /tmp/mem.bin --binary 0x1000 0x1200<br>
<b>(lldb)</b> memory read -o /tmp/mem.bin -b 0x1000 0x1200<br>
<b>(lldb)</b> me r -o /tmp/mem.bin -b 0x1000 0x1200<br>
</td>
</tr>
@ -482,7 +555,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --frame<br>
<b>(lldb)</b> disassemble -f
<b>(lldb)</b> di -f
</td>
<td class="content">
<b>(gdb)</b> disassemble
@ -493,7 +566,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --name main<br>
<b>(lldb)</b> disassemble -n main
<b>(lldb)</b> di -n main
</td>
<td class="content">
<b>(gdb)</b> disassemble main
@ -504,7 +577,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --start-address 0x1eb8 --end-address 0x1ec3<br>
<b>(lldb)</b> disassemble -s 0x1eb8 -e 0x1ec3<br>
<b>(lldb)</b> di -s 0x1eb8 -e 0x1ec3<br>
</td>
<td class="content">
<b>(gdb)</b> disassemble 0x1eb8 0x1ec3
@ -515,7 +588,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --start-address 0x1eb8 --count 20<br>
<b>(lldb)</b> disassemble -s 0x1eb8 -c 20<br>
<b>(lldb)</b> di -s 0x1eb8 -c 20<br>
</td>
<td class="content">
<b>(gdb)</b> x/20i 0x1eb8
@ -526,7 +599,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --frame --mixed<br>
<b>(lldb)</b> disassemble -f -m
<b>(lldb)</b> di -f -m
</td>
<td class="content">
n/a
@ -537,7 +610,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --frame --bytes<br>
<b>(lldb)</b> disassemble -f -b
<b>(lldb)</b> di -f -b
</td>
<td class="content">
n/a
@ -548,7 +621,7 @@
<tr>
<td class="content">
<b>(lldb)</b> disassemble --line<br>
<b>(lldb)</b> disassemble -l
<b>(lldb)</b> di -l
</td>
<td class="content">
n/a
@ -558,14 +631,14 @@
</table>
<p>
</div>
<div class="postfooter"></div>
<div class="postfooter"></div>
<h1 class ="postheader">Executable and Shared Library Query Commands</h1>
<div class="post">
<h1 class ="postheader">Executable and Shared Library Query Commands</h1>
<div class="post">
<p>
<table class="stats" width="620" cellspacing="0">
<table class="stats" width="620" cellspacing="0">
<tr>
<td class="hed" width="50%">LLDB</td>
<td class="hed" width="50%">GDB</td>
@ -586,7 +659,7 @@
<tr>
<td class="content">
<b>(lldb)</b> image lookup --address 0x1ec4<br>
<b>(lldb)</b> image lookup -a 0x1ec4<br>
<b>(lldb)</b> im loo -a 0x1ec4<br>
</td>
<td class="content">
<b>(gdb)</b> info symbol 0x1ec4<br>
@ -597,7 +670,7 @@
<tr>
<td class="content">
<b>(lldb)</b> image lookup --address 0x1ec4 a.out<br>
<b>(lldb)</b> image lookup -a 0x1ec4 a.out<br>
<b>(lldb)</b> im loo -a 0x1ec4 a.out<br>
</td>
<td class="content">
</td>
@ -607,7 +680,7 @@
<tr>
<td class="content">
<b>(lldb)</b> image lookup --type Point<br>
<b>(lldb)</b> image lookup -t Point<br>
<b>(lldb)</b> im loo -t Point<br>
</td>
<td class="content">
<b>(lldb)</b> ptype Point<br>
@ -654,14 +727,14 @@
</table>
<p>
</div>
<div class="postfooter"></div>
<div class="postfooter"></div>
<p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>