Commands for a breakpoint in .pdbrc

Pablo Torres N. tn.pablo at gmail.com
Tue Jan 5 22:28:01 CET 2010


Hi all,

I'd like to save the commands for a breakpoint in a .pdbrc, something
like:

b 81
commands 1
pp foo.attr1
pp foo.attr2
end
b 108
commands 2
pp bar.attr1
pp bar.attr2
end

This would automate setting the environment for the debugging session.
However, this does not work with 'python -m pdb script.py', because at
the line 'commands 1', the pdb prompt starts and asks me for the
commands for the first breakpoint, ignoring what I wrote in .pdbrc;
further, it raises a NameError after I type 'end' at the pdb prompt,
because of 'foo.attr1', 'foo.attr2' and even 'end'. The same happens
for the rest of the breakpoints, so I end up with them set but not
their commands.

What would be the correct way to do this? Is it even possible?


Thanks a lot,
Pablo Torres N.



More information about the Python-list mailing list