Diff for "Debugging"

Not logged in - Log In / Register

Differences between revisions 3 and 4
Revision 3 as of 2009-09-12 04:21:57
Size: 1601
Editor: kfogel
Comment: Formatting fix.
Revision 4 as of 2009-09-12 05:34:07
Size: 1600
Editor: kfogel
Comment: Do a reST-style internal link.
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:
Some kinds of bugs (segfaults, hung processes, out-of-control daemons) are hard to debug from within Python. See [[Debugging/GDB]] for how to debug them. Some kinds of bugs (segfaults, hung processes, out-of-control daemons) are hard to debug from within Python. See `Debugging/GDB`_ for how to debug them.
Rendering of reStructured text is not possible, please install Docutils.

This page collects tips that might make debugging Launchpad a little easier.  They're presented in no particular order -- please add yours!

===========================
Debugging stories/pagetests
===========================

Debugging stories (a.k.a. pagetests) can be kind of a pain because they build up state as they go.  So if a test fails down deep in the doctest, and you want to see what the page really looks like at that point, you'd normally have to manually click through each step in the doctest until you get to the place that's broken.

But there's an easier way!

Just add this at the point where your pagetest is failing::

    >>> stop()

This is just a convenience wrapper around ``pdb.set_trace()`` except that it also redirects stdout back to your console.  When your pagetest hits this line, you'll be dropped into the debugger.  Now, go to a different shell and type::

    % make LPCONFIG=testrunner run

This starts up the appserver, except that it will use the ``testrunner`` configuration.  What's cool about that is that this configuration attaches to the same database as the pagetest you're now stopped inside of.  Meaning, all that state your doctest has built up, is available to your browser.  So just hit the URL of the page that your doctest is failing on, and see it in all it's wondrous, albeit borked, glory.

==================
Debugging With GDB
==================

Some kinds of bugs (segfaults, hung processes, out-of-control daemons) are hard to debug from within Python.  See `Debugging/GDB`_ for how to debug them.

Debugging (last edited 2021-09-14 10:44:48 by ilasc)