<li> You can try crazy new ideas :D </li>
</ul>
</section>
-
<section>
- <h2>Extension points</h2>
- <ul>
- <li class="fragment">Pretty printers</li>
- <li class="fragment">Custom commands</li>
- <li class="fragment">Code auto-loading</li>
- <li class="fragment">Event handlers (<code>stop, cont, exited, new_objfile</code>)</li>
- <li class="fragment">"Convenience functions"</li>
- <li class="fragment">Custom parameters (like "<code>set parameter value</code>", then retrieve values from commands, etc)</li>
- </ul>
- </section>
-
- <!--
- <section>
- <h2>Fun with breakpoints!</h2>
- <h3>Conditional breakpoints</h3>
- <p> <code> break myfile.cpp:99 if x > 0 </code> </p>
- <p class="fragment">Not so interesting</p>
- </section>
- -->
-
- <section>
- <h2> <a href="http://slackito.com/2011/12/09/poor-mans-tracepoints-with-gdb/">Poor man's tracepoints</a> </h2>
+ <section>
+ <h2><b>OLD</b> extension points</h2>
+ <ul>
+ <li>Breakpoint actions</li>
+ <li>Canned sequences as commands</li>
+ <li>Hook pre and post execution of gdb commands</li>
+ <li>.gdbinit for autoloading</li>
+ </ul>
+ <div class="fragment">
+ <p style="margin-top:40px">Nothing impressive here</p>
+ <img src="mckayla.jpg">
+ </div>
+ </section>
+ <section>
+ <h2> Breakpoint actions </h2>
+ <p><a href="http://slackito.com/2011/12/09/poor-mans-tracepoints-with-gdb/">Poor man's tracepoints</a> </p>
<pre>
break myfile.cpp:99
Breakpoint 1 at 0x401193: file myfile.c, line 99.
>cont
>end
</pre>
- <p class="fragment">
- That <code>cont</code> screws single-stepping (solvable with Python, see <a href="http://tromey.com/blog/?p=698">this blog post</a>)
- </p>
- </section>
+ <p class="fragment">
+ That <code>cont</code> screws single-stepping (solvable with Python, see <a href="http://tromey.com/blog/?p=698">this blog post</a>)
+ </p>
+ </section>
- <section>
- <h2> Custom commands (1/3) </h2>
+ <section>
+ <h2> Canned sequences (1/2) </h2>
<pre>
(gdb) define plist
Type commands for definition of "plist".
>end
>end
</pre>
- </section>
+ </section>
- <section>
- <h2> Custom commands (2/3) </h2>
- <p>A more complex example, from PpluX's <a href="http://code.google.com/p/slb/source/browse/extra/lua_utils.gdb?name=default">SLB repo</a></p>
+ <section>
+ <h2> Canned sequences (2/2) </h2>
+ <p>A more complex example, from PpluX's <a href="http://code.google.com/p/slb/source/browse/extra/lua_utils.gdb?name=default">SLB repo</a></p>
<pre><code>define luastack
set $top = lua_gettop($arg0)
set $i = $i + 1
end
</code></pre>
+ </section>
- </section>
+ <section>
+ <h2> Command hooks </h2>
+ <p> You can also create hooks which run just before or after any gdb command: </p>
+ <ul style="text-align:left;">
+ <li> <code>define hook-command</code> to run things <b>before</b> <code>command</code> </li>
+ <li> <code>define hookpost-command</code> to run things <b>after</b> <code>command</code> </li>
- <section>
- <h2> Custom commands (3/3) </h2>
- <p> You can also create hooks which run just before or after any gdb command: </p>
- <ul style="text-align:left;">
- <li> <code>define hook-command</code> to run things <b>before</b> <code>command</code> </li>
- <li> <code>define hookpost-command</code> to run things <b>after</b> <code>command</code> </li>
+ </section>
</section>
<section>
<h2>Enter Python</h2>
<ul>
- <li> GDB 7.x has (optionally) an embedded Python interpreter and a Python API </li>
- <li> Still being refined, but quite usable </li>
+ <li> GDB 7.x has (optionally) an embedded Python interpreter... </li>
+ <li class="fragment"> ...and a Python API <br>
+ <img src="reactionguys.jpg">
+ </li>
+ <small class="fragment">(there are still some quirks here and there, but it's quite usable :D)</small>
</ul>
</section>
+ <section>
+ <h2><b>NEW</b> Extension points</h2>
+ <ul>
+ <li class="fragment">Pretty printers <br>
+ <small>custom representation of data structures</small>
+ </li>
+ <li class="fragment">Custom commands <br>
+ <small>can even define custom parameters to be set via gdb's <code>set parameter value</code> mechanism</small>
+ </li>
+ <li class="fragment">Code auto-loading <br>
+ <small>e.g. load pretty printers when a library is loaded, register things at init</small>
+ </li>
+
+ <li class="fragment">Event handlers <br>
+ <small><code>stop, cont, exited, new_objfile</code></small>
+ </li>
+ <li class="fragment">"Convenience functions"
+ <small>
+ hook expression evaluation, e.g. define <code>$caller_is(string)</code> and then <code>break file:line if $caller_is("main")</code>,
+ see this <a href="http://tromey.com/blog/?p=515">article with a implementation of $caller_is()</a>
+ </small>
+
+ </li>
+ </ul>
+ </section>
<section>
<h2>Python in GDB</h2>
<p> Hello World </p>
</section>
<section>
+ <h2>The Python API</h2>
+ <p> Pretty much every gdb concept is exposed to Python scripts via the API. </p>
+ <p> <a href="http://sourceware.org/gdb/onlinedocs/gdb/Python-API.html#Python-API">GDB Docs - Python API</a></p>
+ </section>
+
+ <section>
+ <h1>Demo</h1>
</section>
<section>
</ul>
</section>
+ <section>
+ <h1>Thanks!</h1>
+ <h2>Questions?</h2>
+ <small>(Don't forget to check out the links in next slide if you are viewing this at home)</small>
+ </section>
+
<section>
<h2>Resources</h2>
<ul>
<li> <a href="http://en.wikibooks.org/wiki/Linux_Applications_Debugging_Techniques">http://en.wikibooks.org/wiki/Linux_Applications_Debugging_Techniques</a></li>
</section>
- <section>
- <h1>Thanks!</h1>
- <h2>Questions?</h2>
- </section>
-
<!-- End slides. -->
</div>