📄 debugger-commands.html
字号:
</DD>
<DT><STRONG>enable <big>[</big><var>bpnumber</var> <big>[</big><var>bpnumber ...</var><big>]</big><big>]</big></STRONG></DT>
<DD><P>
Enables the breakpoints specified.
<P>
</DD>
<DT><STRONG>ignore <var>bpnumber</var> <big>[</big><var>count</var><big>]</big></STRONG></DT>
<DD><P>
Sets the ignore count for the given breakpoint number. If
count is omitted, the ignore count is set to 0. A breakpoint
becomes active when the ignore count is zero. When non-zero,
the count is decremented each time the breakpoint is reached
and the breakpoint is not disabled and any associated condition
evaluates to true.
<P>
</DD>
<DT><STRONG>condition <var>bpnumber</var> <big>[</big><var>condition</var><big>]</big></STRONG></DT>
<DD><P>
Condition is an expression which must evaluate to true before
the breakpoint is honored. If condition is absent, any existing
condition is removed; i.e., the breakpoint is made unconditional.
<P>
</DD>
<DT><STRONG>s(tep)</STRONG></DT>
<DD><P>
Execute the current line, stop at the first possible occasion
(either in a function that is called or on the next line in the
current function).
<P>
</DD>
<DT><STRONG>n(ext)</STRONG></DT>
<DD><P>
Continue execution until the next line in the current function
is reached or it returns. (The difference between "<tt class="samp">next</tt>" and
"<tt class="samp">step</tt>" is that "<tt class="samp">step</tt>" stops inside a called function, while
"<tt class="samp">next</tt>" executes called functions at (nearly) full speed, only
stopping at the next line in the current function.)
<P>
</DD>
<DT><STRONG>r(eturn)</STRONG></DT>
<DD><P>
Continue execution until the current function returns.
<P>
</DD>
<DT><STRONG>c(ont(inue))</STRONG></DT>
<DD><P>
Continue execution, only stop when a breakpoint is encountered.
<P>
</DD>
<DT><STRONG>l(ist) <big>[</big><var>first<big>[</big>, last<big>]</big></var><big>]</big></STRONG></DT>
<DD><P>
List source code for the current file. Without arguments, list 11
lines around the current line or continue the previous listing. With
one argument, list 11 lines around at that line. With two arguments,
list the given range; if the second argument is less than the first,
it is interpreted as a count.
<P>
</DD>
<DT><STRONG>a(rgs)</STRONG></DT>
<DD><P>
Print the argument list of the current function.
<P>
</DD>
<DT><STRONG>p <var>expression</var></STRONG></DT>
<DD><P>
Evaluate the <var>expression</var> in the current context and print its
value. (Note: "<tt class="samp">print</tt>" can also be used, but is not a debugger
command -- this executes the Python <tt class="keyword">print</tt> statement.)
<P>
</DD>
<DT><STRONG>alias <big>[</big><var>name</var> <big>[</big>command<big>]</big><big>]</big></STRONG></DT>
<DD><P>
Creates an alias called <var>name</var> that executes <var>command</var>. The
command must <i>not</i> be enclosed in quotes. Replaceable parameters
can be indicated by "<tt class="samp">%1</tt>", "<tt class="samp">%2</tt>", and so on, while "<tt class="samp">%*</tt>" is
replaced by all the parameters. If no command is given, the current
alias for <var>name</var> is shown. If no arguments are given, all
aliases are listed.
<P>
Aliases may be nested and can contain anything that can be
legally typed at the pdb prompt. Note that internal pdb commands
<i>can</i> be overridden by aliases. Such a command is
then hidden until the alias is removed. Aliasing is recursively
applied to the first word of the command line; all other words
in the line are left alone.
<P>
As an example, here are two useful aliases (especially when placed
in the <span class="file">.pdbrc</span> file):
<P>
<dl><dd><pre class="verbatim">
#Print instance variables (usage "pi classInst")
alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]
#Print instance variables in self
alias ps pi self
</pre></dl>
<P>
</DD>
<DT><STRONG>unalias <var>name</var></STRONG></DT>
<DD><P>
Deletes the specified alias.
<P>
</DD>
<DT><STRONG><big>[</big>!<big>]</big><var>statement</var></STRONG></DT>
<DD><P>
Execute the (one-line) <var>statement</var> in the context of
the current stack frame.
The exclamation point can be omitted unless the first word
of the statement resembles a debugger command.
To set a global variable, you can prefix the assignment
command with a "<tt class="samp">global</tt>" command on the same line, e.g.:
<P>
<dl><dd><pre class="verbatim">
(Pdb) global list_options; list_options = ['-l']
(Pdb)
</pre></dl>
<P>
</DD>
<DT><STRONG>q(uit)</STRONG></DT>
<DD><P>
Quit from the debugger.
The program being executed is aborted.
<P>
</DD>
</DL>
<P>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-pdb.html" tppabs="http://www.python.org/doc/current/lib/module-pdb.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-pdb.html" tppabs="http://www.python.org/doc/current/lib/module-pdb.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node222.html" tppabs="http://www.python.org/doc/current/lib/node222.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-pdb.html" tppabs="http://www.python.org/doc/current/lib/module-pdb.html">9. The Python Debugger</A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-pdb.html" tppabs="http://www.python.org/doc/current/lib/module-pdb.html">9. The Python Debugger</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node222.html" tppabs="http://www.python.org/doc/current/lib/node222.html">9.2 How It Works</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -