Each line in the backtrace shows the frame number and the function name, if it exists and the place in a file where the statement is located.
Here is an example of a backtrace from a sample Towers of Hanoi program that is used in regression testing:
## 0 hanoi() called from file '/tmp/pydb/test/hanoi.py' at line 5 -> 1 hanoi() called from file '/tmp/pydb/test/hanoi.py' at line 6 ## 2 in file '/tmp/pydb/test/hanoi.py' at line 29 ## 3 in file '<string>' at line 1 ## 4 run() called from file '/usr/lib/python2.4/bdb.py' at line 366
The -> arrow indicates the focus. In the example, I issued an "up" command which is why the focus is on 1 rather than 0 as it would normally be after a stop.
There are two ``hanoi'' frames listed because this is a hanoi called itself recursively. In frame 2 and 3 we don't have a function name listed. That's because there is none. Furthermore in frame 3 there is a funny ``in file '<string>' at line 1.'' That's because there isn't even a file associated with the command. The command issued:
exec cmd in globals, locals
This statement can be seen in frame 4. This is a bug which I hope to fix with a more informative message.
Finally, note that frames 2 and 3 really are not part of the program to be debugged but are part of the internal workings of the debugger. It's possible to hide this, but in the open spirit of Python for now it hasn't been hidden.
Show the method or function parameters and their values.
Here is an example of the output for the backtrace of the hanoi program shown at the beginning of this section:
(Pydb) info args n= 3 a= a b= b c= c (Pydb)
Show all local variables for the given stack frame. This will include the variables that would be shown by "info args".
|
T|
bt [count]Print a backtrace, with the most recent frame at the top. An arrow indicates the current frame, which determines the context of most commands.
With a positive number count, print at most many entries.
An example of a backtrace is given at the beginning of this section.
Move the current frame one level down in the stack trace (to a newer frame). With a count, which can be positive or negative, move that many positions.
Note this is the opposite of how pdb
's down
command works.
Move the current frame one level up in the stack trace (to an older frame). With a count, which can be positive or negative, move that many positions.
Note this is the opposite of how pdb
's up
command works.
frame -1
moves to
the newest frame, and frame 0
moves to the oldest frame.
If threading is enabled, you can also specify a thread name. See 1.2.14.
See About this document... for information on suggesting changes.