pdb post-mortem debuggingPosted 13 January 2012 in pdb, programming, and python
I misread a recent feedparser bug report and thought that the author had mistyped a bbcode- or wiki-formatted link. Consequently, I wasted time debugging the code.
Turns out, I wasted a lot of time, because I spent more than zero time debugging the code.
Yes, zero time. I was using a conditional breakpoint when I should have been using pdb's
pm() for short). I had no idea what post-mortem debugging was until I
ran across Doug Hellmann's article on pdb.
I barely finished reading the following two sentences before I alt-tabbed back and found the problem:
Debugging a failure after a program terminates is called post-mortem debugging. pdb supports post-mortem debugging through the pm() and post_mortem() functions.
So my debugging session should have looked like:
import feedparser import pdb feedparser.parse('offending-url') # huge traceback pdb.pm()
u a few times took me up the call stack, and then
p uri printed out the
offending...wait, that's what the bug reporter already told me.
The important thing here is that I discovered a time-saving tool.
(And found a performance problem with feedparser: it calls
hundreds of times for no discernible reason. Reducing that call volume
may improve performance.) Learning is fun!