📄 ch06_02.htm
字号:
Prints only to depth <em class="emphasis">n</em>("" for all).</p></dd><dt><b><tt class="literal">compactDump</tt>, <tt class="literal">veryCompact</tt></b></dt><dd>Changes style of array and hash dumps.</p></dd><dt><b><tt class="literal">DumpDBFiles</tt></b></dt><dd>Dumps arrays holding debugged files.</p></dd><dt><b><tt class="literal">DumpPackages</tt></b></dt><dd>Dumps symbol tables of packages.</p></dd><dt><b><tt class="literal">globPrint</tt></b></dt><dd>Specifies whether to print contents of globs.</p></dd><dt><b><tt class="literal">quote</tt>, <tt class="literal">HighBit</tt>, <tt class="literal">undefPrint</tt></b></dt><dd>Changes style of string dump.</p></dd><dt><b><tt class="literal">signalLevel</tt>, <tt class="literal">warnLevel</tt>, <tt class="literal">dieLevel</tt></b></dt><dd>Specifies level of verbosity.</p></dd><dt><b><tt class="literal">tkRunning</tt></b></dt><dd>Runs Tk while prompting (with ReadLine).</p></dd></dl><p>During startup, debugger options are initialized from<tt class="literal">$ENV{PERLDB_OPTS}</tt>. You can set the additionalinitialization options <tt class="literal">TTY</tt>,<tt class="literal">noTTY</tt>, <tt class="literal">ReadLine</tt>, and<tt class="literal">NonStop</tt> there. See <a href="ch06_04.htm#perlnut2-CHP-6-SECT-4">Section 6.4, "Customizing the Debugger"</a> later in this chapter formore information.</p></div><a name="INDEX-1157" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>p</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>p <em class="emphasis">expr</em></pre><p><a name="INDEX-1157" />Same as <tt class="literal">printDB::OUT</tt> <em class="replaceable"><tt>expr</tt></em> in the currentpackage. In particular, does not dump nested data structures andobjects, unlike the <tt class="literal">x</tt> command. The DB::OUT handleis opened to <em class="emphasis">/dev/tty</em> (or perhaps an editorwindow) no matter where standard output may have been redirected to.</p></div><a name="INDEX-1158" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>q</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>q <em class="emphasis">or</em> ^D</pre><p><a name="INDEX-1158" />Quits the debugger.</p></div><a name="INDEX-1159" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>R</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>R</pre><p><a name="INDEX-1159" />Restarts the debugger. As much of yourhistory is maintained across the sessions as possible, but someinternal settings and command-line options may be lost.</p></div><a name="INDEX-1160" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>r</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>r</pre><p><a name="INDEX-1160" />Returns from current subroutine.</p></div><a name="INDEX-1161" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>S</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>S [[!]<em class="emphasis">pattern</em>]</pre><p><a name="INDEX-1161" />Lists subroutine names matching (or,if <tt class="literal">!</tt> is specified, not matching)<em class="replaceable"><tt>pattern</tt></em>. If<em class="replaceable"><tt>pattern</tt></em> is omitted, lists all subroutines.</p></div><a name="INDEX-1162" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>s</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>s [<em class="emphasis">expr</em>]</pre><p><a name="INDEX-1162" />Single steps. Executes until itreaches the beginning of another statement, descending intosubroutine calls. If an expression is supplied that includes afunction call, the function is also single-stepped.</p></div><a name="INDEX-1163" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>T</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>T</pre><p><a name="INDEX-1163" />Produces a stack backtrace. Forexample:</p><blockquote><pre class="code">DB<2> T$ = main::infested called from file 'Ambulation.pm' line 10@ = Ambulation::legs(1, 2, 3, 4) called from file 'camel_flea' line 7$ = main::pests('bactrian', 4) called from file 'camel_flea' line 4</pre></blockquote><p>The lefthand character (<tt class="literal">$</tt> or <tt class="literal">@</tt>)tells whether the function was called in a scalar or list context.The example shows three lines because it was three functions deepwhen the stack backtrace ran.</p></div><a name="INDEX-1164" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>t</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>t</pre><p><a name="INDEX-1164" />Toggles trace mode.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>t</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>t <em class="emphasis">expr</em></pre><p>Traces through execution of <em class="replaceable">expr</em>.</p></div><a name="INDEX-1165" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>v</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>v</pre><p><a name="INDEX-1165" />Shows versions of loaded modules.</p></div><a name="INDEX-1166" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>V</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>V [<em class="replaceable">pkg</em> [<em class="emphasis">vars</em>]]</pre><p><a name="INDEX-1166" />Displays all (or some) variables inpackage <em class="replaceable"><tt>pkg</tt></em> using a data pretty-printer(which displays keys and their values for hashes, makes controlcharacters printable, prints nested data structures in a legiblefashion, and so on). <em class="replaceable"><tt>pkg</tt></em> defaults to the<tt class="literal">main</tt> package. Make sure you enter the identifierswithout a type specifier such as <tt class="literal">$</tt> or<tt class="literal">@</tt>, like this:</p><blockquote><pre class="code">V DB filename line</pre></blockquote><p>In place of a variable name, you can use<tt class="literal">~</tt><em class="emphasis">pattern</em> or<tt class="literal">!</tt><em class="emphasis">pattern</em> to print existingvariables with names that either match or don'tmatch the specified regular expression.</p></div><a name="INDEX-1167" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>w</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>w [<em class="emphasis">line</em>]</pre><p><a name="INDEX-1167" />Lists a window of a few lines aroundthe given <em class="replaceable"><tt>line</tt></em>, or lists the current lineif <em class="replaceable"><tt>line</tt></em> is omitted.</p></div><a name="INDEX-1168" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>X</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>X [<em class="emphasis">vars</em>]</pre><p><a name="INDEX-1168" />Same as <tt class="literal">V</tt><em class="replaceable"><tt>currentpackage</em>[<em class="replaceable">vars</tt></em>].</p></div><a name="INDEX-1169" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>x</b</font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>x <em class="emphasis">expr</em></pre><p><a name="INDEX-1169" /><tt class="literal">eval</tt>s theexpression in a list context and dumps out the result in apretty-printed fashion. Unlike the <tt class="literal">print</tt> commandabove, prints nested data structures recursively.</p></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch06_01.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch06_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">6. Debugging</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">6.3. Using the Debugger</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -