Python (pdb) - Queueing up commands to execute
Posted
by kpatelPro
on Stack Overflow
See other posts from Stack Overflow
or by kpatelPro
Published on 2010-04-08T00:10:29Z
Indexed on
2010/04/08
0:13 UTC
Read the original article
Hit count: 629
I am implementing a "breakpoint" system for use in my Python development that will allow me to call a function that, in essence, calls pdb.set_trace();
Some of the functionality that I would like to implement requires me to control pdb from code while I am within a set_trace context.
Example:
disableList = []
def breakpoint(name=None):
def d():
disableList.append(name)
#****
#issue 'run' command to pdb so user
#does not have to type 'c'
#****
if name in disableList:
return
print "Use d() to disable breakpoint, 'c' to continue"
pdb.set_trace();
In the above example, how do I implement the comments demarked by the #****
?
In other parts of this system, I would like to issue an 'up' command, or two sequential 'up' commands without leaving the pdb session (so the user ends up at a pdb prompt but up two levels on the call stack.
Thanks!
© Stack Overflow or respective owner