📄 c-debugger3.html
字号:
<dd><p class="Body"><a name="91183"> </a>Specify the argument list after the routine name, with the arguments separated by spaces. The argument list must contain integers or addresses only; it may not contain floating-point or double-precision values, function calls, or user-defined C++ operations. (See <i class="title">Debugging with GDB</i> for other commands which allow arbitrary arguments to be passed.)</p><dd><p class="Body"><a name="89306"> </a><a href="c-debugger3.html#89293">Figure 8-5</a> shows the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Run Task</font></b> dialog box with a routine name (required) and an argument list (optional). The default for required arguments that you do not supply is zero. To set a temporary breakpoint where the routine begins execution, check the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Break at Entrypoint </font></b>box.</p><dd><p class="Body"><a name="89307"> </a>Once a task stops under debugger control (most often, at a breakpoint), you can single-step through the code, jump over subroutine calls, or resume execution. <a href="c-debugger3.html#87217">Figure 8-10</a> shows the debugger stopped at the entry point of the routine <b class="routine"><i class="routine">BigBang</i></b><b>( )</b>. The context pointer <img alt="(1)" src="icons/z1.gif"> indicates what statement will execute if you allow the program to resume.<div class="frame"><h4 class="EntityTitle"><a name="89315"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-6: The Context Pointer</font></a></h4><dl class="margin"><div class="Anchor"><a name="89323"> </a><img class="figure" border="0" src="images/c-debugger15.gif"></div></dl></div></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="90479">8.3.5 Interrupting a Program</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="90484"> </a>You can interrupt execution with <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Interrupt Debugger</font></b> in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu, by pressing the <img class="figure" border="0" src="images/c-debugger9.gif"> button, or by using the keyboard shortcut <kbd>ALT</kbd>+<kbd>SHIFT</kbd>+<kbd>F5</kbd>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84428">8.3.6 Setting Breakpoints</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="94015"> </a><p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeadingC" align="center"><a name="84393"> </a><b><font face="Helvetica, sans-serif" size="-1" class="sans">Button</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84395"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Shortcut</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84397"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Debug Menu Command</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="91530"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Pop-up Menu Command </font></b></div></th><td width="10"> </td></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="91415"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91417"> </a>n/a </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91419"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91538"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84408"> </a><img class="figure" border="0" src="images/c-debugger30.gif"></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84410"> </a><kbd>F9</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84412"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Breakpoint</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91540"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Breakpoint</font></b></div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84417"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84419"> </a><kbd>F8</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84421"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Temp. Breakpoint</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91542"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Temp. Breakpoint</font></b></div></td><td width="10"> </td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></div></dl><dl class="margin"><dd><p class="Body"><a name="84430"> </a>To set multiple breakpoints, select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> in either the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> or the pop-up menu (right-click in the editor window). The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> dialog box appears. (See <a href="c-debugger3.html#91441">Figure 8-7</a>.) Enter a file name and line number in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Location</font></b> box, select a scope (local task or all tasks), and click Add. The new breakpoint appears in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> list. If <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Externally managed </font></b>is checked, it indicates that the breakpoint was set by means other than the debugger (by the Tornado shell, for example). <div class="frame"><h4 class="EntityTitle"><a name="91441"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-7: The Breakpoints Dialog Box</font></a></h4><dl class="margin"><div class="Anchor"><a name="91446"> </a><img class="figure" border="0" src="images/c-debugger12.gif"></div></dl></div> </p><dd><p class="Body"><a name="91434"> </a>The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Advanced</font></b> button opens the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Advanced Breakpoint</font></b> dialog box (<a href="c-debugger3.html#93680">Figure 8-8</a>).<div class="frame"><h4 class="EntityTitle"><a name="93680"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-8: The Advanced Breakpoint Dialog Box</font></a></h4><dl class="margin"><div class="Anchor"><a name="93685"> </a><img class="figure" border="0" src="images/c-debuggera36.gif"></div></dl></div> This dialog lets you attach conditions to the break point as well as deleting or disabling it instead of keeping it when it is hit. Enter a file name and line number in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Location</font></b> box. A conditional expression of type <b class="symbol_lc">int</b> can be used, which will be evaluated as true or false (all non-zero values being true), or to check if a value in memory has changed. The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">On Break</font></b> options have the following meanings with regard to handling a breakpoint:</p></dl><dl class="margin"><dd><div class="Item"><a name="93669"> </a>Keep</div><dl class="margin"><dd><div class="Indent"><a name="93670"> </a>Defines the breakpoint as permanent.</div><br></dl><dd><div class="Item"><a name="93671"> </a>Delete</div><dl class="margin"><dd><div class="Indent"><a name="93672"> </a>Defines the breakpoint as temporary. The breakpoint is deleted after it is hit.</div><br></dl><dd><div class="Item"><a name="93673"> </a>Disable</div><dl class="margin"><dd><div class="Indent"><a name="93692"> </a>Defines the breakpoint as temporary. The breakpoint is disabled after it is hit (not deleted), and can be manually enabled.</div><br></dl></dl><dl class="margin"><dd><p class="Body"><a name="91420"> </a>To set a breakpoint on an individual line of code, place the text cursor in the line where you want the program to stop. Then click the <img class="figure" border="0" src="images/c-debugger16.gif"> button, select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Breakpoint</font></b> from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu, or right-click on the line of code and select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Breakpoint</font></b> from the pop-up menu. The <img class="figure" border="0" src="images/c-debugger17.gif"> symbol appears in the left margin of the editor window to indicate the breakpoint location, when the attribute pane is turned on for the editor (<a href="c-customize2.html#87202"><i class="title">9.2.2 Editor Preferences</i></a>). Otherwise, the entire line is highlighted to indicate the breakpoint location. </p><dd><p class="Body"><a name="84434"> </a>If you click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Breakpoint</font></b> on a line that produces no object code (such as a comment line or a declaration), the breakpoint appears on the next line that does produce object code.</p><dd><p class="Body"><a name="91498"> </a>You can also set temporary breakpoints by using <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Toggle Temp. Breakpoint</font></b> from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu. A temporary breakpoint stops the program only once. The debugger deletes it automatically as soon as the program stops there. A hollow breakpoint symbol (<img class="figure" border="0" src="images/c-debugger19.gif">) marks temporary breakpoints in the editor's left margin, so that you can readily distinguish the two kinds of breakpoints there. </p><dd><p class="Body"><a name="84437"> </a>To remove either kind of breakpoint, click either of these commands with a line selected that already has a breakpoint or use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> dialog box.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="91926"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION: </font></b></a>If your application was compiled without debugging information, the debugger displays an error when you try to set a breakpoint using these commands. If you are forced to work on an object module without debugging information, you can still break at the start of any subroutine in either of the following ways: (1) Check the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Break at Entrypoint</font></b> check box in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Run Task</font></b> dialog box when you start the task (<a href="c-debugger3.html#84529"><i class="title">8.3.7 Continuing Through a Program</i></a>). (2) Use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Breakpoints</font></b> dialog box (see <a href="c-debugger3.html#84428"><i class="title">8.3.6 Setting Breakpoints</i></a>). In either case, when the debugger stops, it displays a <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Disassembly</font></b> window, as it does whenever no debugging information is available for the program context.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><dl class="margin"><dd><p class="Body"><a name="84448"> </a><a href="c-debugger3.html#84463">Figure 8-9</a> shows the editor window with two breakpoints set: a temporary breakpoint <img alt="(1)" src="icons/z1.gif"> (hollow) and a persistent breakpoint <img alt="(2)" src="icons/z2.gif"> (filled in).<div class="frame"><h4 class="EntityTitle"><a name="84463"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-9: Breakpoint Marks in Editor Window</font></a></h4><dl class="margin"><div class="Anchor"><a name="84460"> </a><img class="figure" border="0" src="images/c-debugger31.gif"></div></dl></div> </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84529">8.3.7 Continuing Through a Program</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="94016"> </a><p class="table"><table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><th rowspan="1" colspan="1"><div class="CellHeadingC" align="center"><a name="84467"> </a><b><font face="Helvetica, sans-serif" size="-1" class="sans">Button</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84469"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Shortcut</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84471"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Debug Menu Command</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="91572"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Pop-up Menu Command</font></b></div></th><td width="10"> </td></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="91285"> </a><img class="figure" border="0" src="images/c-debugger36.gif"></div></td><td width="10"> </td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -