1pydb(1) General Commands Manual pydb(1)
2
3
4
6 pydb — enhanced Python debugger
7
9 pydb [debugger-options] python-script [script-options...]
10
12 This manual page documents briefly the pydb command.
13
14 pydb is an extended Python debugger. It extends the Python standard
15 debugger pdb and is suited for use with the graphical debugger DDD.
16 The purpose of a debugger such as this one is to allow you to see what
17 is going on ``inside'' another program while it executes—or what
18 another program was doing at the moment it crashed.
19
20
21 We follow gdb's command set unless there's good reason not to.
22
23
24 pydb can do four main kinds of things (plus other things in support of
25 these) to help you catch bugs in the act:
26
27
28 · Start or restart your Python script, specifying arguments that
29 might affect its behavior.
30
31
32 · Make your program stop at various points possibly determined by
33 specified conditions.
34
35
36 · Examine what has happened when your program has stopped.
37
38
39 · Change things in your program, so you can experiment with correct‐
40 ing the effects of one bug and go on to learn about another.
41
42 Here are some of the most frequently-needed commands:
43
44
45 break [file:line|function]
46 Set a breakpoint at function or at the specified file and line.
47
48 clear [file:line|function]
49 Clear a breakpoint at function or at the specified file and
50 line. If line number is specified, all breakpoints in that line
51 are cleared. If a function is specified, breakpoints at begin‐
52 ning of function are cleared. With no argument, clears all
53 breakpoints in the line that the selected frame is executing in.
54 See also the delete command which clears breakpoints by number.
55
56 continue [line]
57 Continue running your program until the next breakpoint or
58 until the end of the program. If a line number is given set a
59 one-time breakpoint at that line.
60
61 delete [breakpoint-numbers]
62 Delete breakpoints by number. To delete all breakpoints, give
63 no breakpoint number. See also the clear command which clears
64 breakpoints by line/file number.
65
66 disassemble [location]
67 Disassemble Python instructions at the point you are currently
68 stopped at. If location is a line number, do not show instruc‐
69 tions before line. Location can also be a class, method, func‐
70 tion, code or string argument.
71
72 examine expr
73 Give type/object and value information about expression.
74
75
76 finish
77 Run until the completion of the current function or method.
78
79 frame frame-number
80 Set the stack frame to frame-number for purposes of examinine
81 local variables. For positioning relative to the current frame,
82 use up or down.
83
84 help [name]
85 Show information about pydb command name, or general information
86 about using pydb.
87
88 info [name]
89 Get the various information usually about the debugged program.
90
91 list [file:line|function]
92 type the text of the program in the vicinity of where it is
93 presently stopped or at the specified function or file and line.
94
95 next [count]
96 Execute next program line(s) (after stopping); step over any
97 function calls in the line.
98
99 pp expr
100 Pretty print the value of an expression.
101
102 print expr
103 Display the value of an expression.
104
105 source filename
106 Read and execute the lines in file filename as a series of
107 debugger commands. An error in any command terminates execution
108 of the command file and control is returned to the console.
109
110 quit Exit from the debugger.
111
112 run [arglist]
113 (Re)start your program (with arglist, if specified). If you want
114 the debugger to get reloaded, use restart instead.
115
116 set Modify parts of the debugger environment.
117
118 shell command
119 Run a shell command.
120
121 show See the debugger environment settings
122
123 step [count]
124 Execute next program line(s) (after stopping); step into any
125 function calls in the line.
126
127 where [count]
128 Display all or count items of the program stack.
129
130 For full details on pydb, see http://bashdb.source‐
131 forge.net/pydb/pydb/index.html
132
134 --version show the version number and exit
135
136 -h | --help
137 show invocation help and exit
138
139 -X | --trace
140 Show lines before executing them. This option also sets
141 --batch.
142
143 -X | --fntrace
144 Show functions before executing them. This option also sets
145 --batch
146
147 --batch Don't run interactive commands on debugger entry
148
149 --basename
150 Report file locations as only the base filename, and omit the
151 directory name. This is useful in running regression tests.
152
153 -x | --command=FILE
154 Execute commands from FILE.
155
156 --cd=DIR Change current directory to DIR.
157
158 --error=FILE
159 Write debugger's error output (stderr) to FILE
160
161
162 -e | --exec
163 Run debugger commands command-list. Commands should be
164 separated by ";;"-the same as you would do inside the
165 debugger. You may need to quote this option to prevent
166 command shell interpretation, e.g. --exec "break 20;;
167 continue"
168
169 -n | --nx Don't execute commands found in any initialization
170 files
171
172 -o FILE | --output=FILE
173 Write debugger's output (stdout) to FILE
174
175 --sigcheck
176 Set to watch for signal handler changes.
177
178 -T, --threading
179 Start off with threading debug support.
180
181 -A LEVEL | --annotate=LEVEL
182 Set gdb-like annotation_level. The annotation level is
183 used by front-ends to get posted about program infor‐
184 mation when things change without having to poll for
185 the information.
186
188 http://bashdb.sourceforge.net/pydb/
189
190 http://bashdb.sourceforge.net/pydb/lib/index.html
191
193 pydb was written by Richard Wolff <rwolff@noao.edu> (now
194 retired) based on the standard Python debugger pdb.py. Over the
195 many years, pdb.py and pydb.py have diverged. It was subse‐
196 quently revised and expanded to be more like gdb by Rocky Bern‐
197 stein <rocky@gnu.org>
198
199 The first version of this manual page was written by Gregor Hof‐
200 fleit <flight@debian.org> for the Debian project (but may be
201 used by others).
202
203
204
205 pydb(1)