[Patches] [ python-Patches-896011 ] pdb enhancements and bug fixes

SourceForge.net noreply at sourceforge.net
Thu Sep 23 05:45:07 CEST 2004

Patches item #896011, was opened at 2004-02-12 12:07
Message generated for change (Comment added) made by isandler
You can respond by visiting: 

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ilya Sandler (isandler)
Assigned to: Nobody/Anonymous (nobody)
Summary: pdb enhancements and bug fixes

Initial Comment:

Bug fixes

B1) Execute script in its own namespace

(script was executed in pdb.py name space. E.g one
could do 
print line_prefix 
in your script and one would get pdb's line_prefix variable
(and I guess if was  possible to accidentally stomp on
pdb internals from the script))

B2)  Remove pdb.py's path from sys.path.

(pdb.py path was not removed from sys.path.. While
normally this is not a  problem, it CAN cause hard to
diagnose problems.  e.g. if your script needs to
override some of std modules and you put them in some
location and set PYTHONPATH accordingly, then
everything works without
pdb, but when you run under pdb (which is normally
located with the rest of python std libs) your
overriding suddenly breaks)

This addresses CVS Bug report #751124, part 2

B3)  Fix handling of breakpoints "file_name:line_no"

(pdb was failing to set the breakpoint specified as 
"b file_name:100"
when file_name did not end with ".py", and was not an
absolute path.This is quite bad as many scripts
commonly do not have ".py" suffix...
In at least some cases, (e.g when running under emacs
gud)  user can't workaround this problem, as the
"break" command is issued by another program..)


E1) Now pdb gets directly to the 1st line of script 

(the CVS version of pdb required doing "step" twice
before you get to the first line of your code: both
ugly and annoying)

E2) Restart the program (and preserve debugger state,
such as breakpoints) if program being debugged exits 

(CVS version was exitting on program's exitNow debugger
does not die on script's exit, taking all the settings
with it)

E3) Enter post-mortem debugging if the program throws an
uncaught exception

(CVS version was simply dying in this case
This addresses CVS bug report #751124, part 1)

All changes apply to the command line interface of pdb.py
Ie. only when pdb.py invoked as
"pdb.py script"

The only exception is B3 which fixes a bug in do_break()


>Comment By: Ilya Sandler (isandler)
Date: 2004-09-22 20:45

Logged In: YES 

Another iteration of the patch
1. Allow to set bkpts while in post-mortem  debuggin (which
now  happens in the same instance of pdb)

2. Against latest pdb.py (1.69)


Comment By: Ilya Sandler (isandler)
Date: 2004-03-05 11:28

Logged In: YES 

I am attaching a new version of the patch.

Changes include:
    1) the new patch is against the latest pdb.py v 1.67
    2) it allows to debug code protected by
if __name__== '__main__' conditional (the first version of
the patch did not set __name__, so this code was not

Also, is there anything I can do to help with consideration
of this patch? 


You can respond by visiting: 

More information about the Patches mailing list