Adding information on the scriptable keywords ${target|process|thread|frame.script:function} to the LLDB documentation

llvm-svn: 186201
This commit is contained in:
Enrico Granata 2013-07-12 20:46:02 +00:00
parent c61cab8b02
commit 9ca7f75bc1
1 changed files with 22 additions and 1 deletions

View File

@ -19,7 +19,7 @@
<div class="post"> <div class="post">
<h1 class ="postheader">Stack Frame and Thread Format</h1> <h1 class ="postheader">Stack Frame and Thread Format</h1>
<div class="postcontent"> <div class="postcontent">
<p>LLDB was recently modified to allow users to define the <p>LLDB has a facility to allow users to define the
format of the information that generates the descriptions format of the information that generates the descriptions
for threads and stack frames. Typically when your program stops for threads and stack frames. Typically when your program stops
at a breakpoint you will get a line that describes why at a breakpoint you will get a line that describes why
@ -100,6 +100,10 @@
<tr valign=top><td><b>thread.stop-reason</b></td><td>A textual reason each thread stopped</td></tr> <tr valign=top><td><b>thread.stop-reason</b></td><td>A textual reason each thread stopped</td></tr>
<tr valign=top><td><b>thread.return-value</b></td><td>The return value of the latest step operation (currently only for step-out.)</td></tr> <tr valign=top><td><b>thread.return-value</b></td><td>The return value of the latest step operation (currently only for step-out.)</td></tr>
<tr valign=top><td><b>target.arch</b></td><td>The architecture of the current target</td></tr> <tr valign=top><td><b>target.arch</b></td><td>The architecture of the current target</td></tr>
<tr valign=top><td><b>target.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
<tr valign=top><td><b>process.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
<tr valign=top><td><b>thread.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
<tr valign=top><td><b>frame.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
</table> </table>
</div> </div>
@ -247,6 +251,23 @@
that when the thread information is displayed in a context where that when the thread information is displayed in a context where
we only want to show thread information, we can do so. we only want to show thread information, we can do so.
<p>For both thread and frame formats, you can use ${target.script:<i>python_func</i>}, ${process.script:<i>python_func</i>} and ${thread.script:<i>python_func</i>}
(and of course ${frame.script:<i>python_func</i>} for frame formats)<br/>
In all cases, the signature of <i>python_func</i> is expected to be:<br/>
<p><code>
def <i>python_func</i>(<i>object</i>,unused):<br/>
&nbsp;&nbsp;&nbsp;&nbsp;...<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return <i>string</i><br/></code>
<p>Where <i>object</i> is an instance of the SB class associated to the keyword you are using.
<p>e.g. Assuming your function looks like<br/><code><p>
def thread_printer_func (thread,unused):<br/>
&nbsp;&nbsp;return "Thread %s has %d frames\n" % (thread.name, thread.num_frames)<br/></code><p>
And you set it up with <code><br/><b>(lldb)</b> settings set thread-format "${thread.script:thread_printer_func}"<br/></code>
you would see output like:
</p>
<code>* Thread main has 21 frames</code>
</div> </div>
<div class="postfooter"></div> <div class="postfooter"></div>
</div> </div>