debug-with-emacs.html   [plain text]


<?xml version="1.0"?><!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" lang="en"><head><title>Twisted Documentation: Debugging Python(Twisted) with Emacs</title><link href="../howto/stylesheet.css" type="text/css" rel="stylesheet" /></head><body bgcolor="white"><h1 class="title">Debugging Python(Twisted) with Emacs</h1><div class="toc"><ol></ol></div><div class="content"><span></span><img src="http://yellow5.com/pokey/archive/pokey411_3.gif" /><a href="#footnote-1" title="POKEY THE PENGUIN IS COPYRIGHT &amp;copy; 1998-2002 THE AUTHORS"><super>1</super></a><ul><li>Open up your project files. sometimes emacs can't find them if you
   don't have them open before-hand.</li><li><code>M-x pdb</code>, Run pdb as: <code>twistd -b -f my.tap</code></li><li>while pdb waits for your input, go to a place in your code and hit
   <code>C-x SPC</code> to insert a break-point. pdb should say something happy.
   Do this in as many points as you wish.</li><li>Go to your pdb buffer and hit <code>c</code>; this runs as normal until a
   break-point is found.</li><li>once you get to a breakpoint, use <code>s</code> to step, <code>n</code> to run the
   current line without stepping through the functions it calls, <code>w</code>
   to print out the current stack, <code>u</code> and <code>d</code> to go up and down a
   level in the stack, <code>p foo</code> to print result of expression <code>foo</code>.</li><li>recommendations for effective debugging:
   <ul><li>use <code>p self</code> a lot; just knowing the class where the current code
     is isn't enough most of the time.</li><li>use <code>w</code> to get your bearings, it'll re-display the current-line/arrow</li><li>after you use <code>w</code>, use <code>u</code> and <code>d</code> and lots more <code>p self</code> on the
     different stack-levels.</li><li>If you've got a big code-path that you need to grok, keep another
      buffer open and list the code-path there (e.g., I had a
      nasty-evil Deferred recursion, and this helped me tons)</li></ul></li></ul><h2>Footnotes</h2><ol><li><a name="footnote-1"><span xmlns="http://www.w3.org/1999/xhtml" class="footnote">POKEY THE PENGUIN IS COPYRIGHT &copy; 1998-2002
THE AUTHORS</span></a></li></ol></div><p><a href="../howto/index.html">Index</a></p><span class="version">Version: 1.3.0</span></body></html>