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

SourceForge.net noreply at sourceforge.net
Thu Oct 7 03:49:11 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: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=896011&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ilya Sandler (isandler)
Assigned to: Johannes Gijsbers (jlgijsbers)
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..)



Enhancements:

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-10-06 18:49

Message:
Logged In: YES 
user_id=971153

Yes, here is an example of B3 type of bug

The program:

bagira:~/python/dist/src/Lib> cat pdb_t
x=1
y=2
x=3

and the bug:
bagira:~/python/dist/src/Lib> ../python pdb.py pdb_t

> <string>(1)?()
(Pdb) b pdb_t:2   <-- fails
***  'pdb_t' not found from sys.path  
(Pdb) s
--Call--
> /home/ilya/python/dist/src/Lib/pdb_t(1)?()
-> x=1
(Pdb) b pdb_t:2  <---again fails
***  'pdb_t' not found from sys.path 
(Pdb) b 2             <--but succeeds w/o file name
Breakpoint 1 at /home/ilya/python/dist/src/Lib/pdb_t:2 


----------------------------------------------------------------------

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-06 14:38

Message:
Logged In: YES 
user_id=469548

I just looked at the bug-fixing parts for now. B1 and B2 are
clear-cut and I'll check in the fix once I've fully
processed the patch.

B3: Could you give an example of a script where this bug
appears (copy/paste console session would be nice)? I'm not
sure I get the bug.

----------------------------------------------------------------------

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

Message:
Logged In: YES 
user_id=971153

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

Message:
Logged In: YES 
user_id=971153

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
reachable)....


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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=896011&group_id=5470


More information about the Patches mailing list