Ad

How To Show The Output Of 'l' In Python Pdb After Every Command Entered

- 1 answer

I would like to have the output of the python pdb 'l' command printed to the screen after every command I enter in an interactive debugging session.

Is there a way to setup python pdb to do this?

Ad

Answer

One way to do this is to alias your favourite commands to run the command and then l.

e.g.

(Pdb) alias s step ;; l
(Pdb) s
> /usr/lib/python2.5/distutils/core.py(14)<module>()
-> from types import *
 9      # This module should be kept compatible with Python 2.1.
10      
11      __revision__ = "$Id: core.py 38672 2005-03-20 22:19:47Z fdrake $"
12      
13      import sys, os
14  ->  from types import *
15      
16      from distutils.debug import DEBUG
17      from distutils.errors import *
18      from distutils.util import grok_environment_error
19      

In your ~/.pdbrc you can add the aliases so you have them every time:

alias s step ;; l
Ad
source: stackoverflow.com
Ad