📄 c-debugger3.html
字号:
<td colspan=1 rowspan=1><div class="CellBody"><a name="91287"> </a><kbd>F5</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91289"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Continue</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91574"> </a>n/a </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84491"> </a><img class="figure" border="0" src="images/c-debugger34.gif"></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84493"> </a><kbd>F10</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84495"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91576"> </a>n/a </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84500"> </a><img class="figure" border="0" src="images/c-debugger35.gif"></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84502"> </a><kbd>CTRL+F5</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84504"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91578"> </a>n/a </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="84518"> </a><img class="figure" border="0" src="images/c-debugger37.gif"></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84520"> </a><kbd>SHIFT+F5</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84522"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Out</font></b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91580"> </a>n/a </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="91606"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91608"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91610"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91612"> </a>Run to Cursor </div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBodyC" align="center"><a name="91598"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91600"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="91602"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="92865"> </a>Start a new task from current function</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="87209"> </a>Once a task has been stopped 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">graphInit</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="87217"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-10: The Context Pointer</font></a></h4><dl class="margin"><div class="Anchor"><a name="87225"> </a><img class="figure" border="0" src="images/c-debugger33.gif"></div></dl></div></p><dd><p class="Body"><a name="87227"> </a>When the program is stopped, you can resume operation with the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Continue</font></b> command from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu. If there are no remaining breakpoints, interrupts, or signals, the task runs to completion. A common example of using <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Continue</font></b> is to set a breakpoint at the end of a loop, then use <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Continue</font></b> repeatedly to stop once in each iteration through the loop, while monitoring a variable used within that loop.</p><dd><p class="Body"><a name="88365"> </a>To step through the code one line at a time, click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b>. If you have auxiliary debugger windows open (<a href="c-debugger3.html#84731"><i class="title">8.3.10 Examining Data, Memory, and the Stack</i></a>), they are updated with current values as you step through the code. If there is a subroutine call in the current line, <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into </font></b>takes you to the first line of that subroutine, not to the next line currently displayed on your screen. The only exception is for calls to system subroutines and application subroutines that are compiled without debugging information; <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into </font></b>cannot step into these. </p><dd><p class="Body"><a name="84569"> </a>The effect of <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into </font></b>is somewhat different if the current view in the editor shows assembly instructions (when either <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Disassembly</font></b> or <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Mixed</font></b> is selected from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">View</font></b> menu, or the current routine has no debugging symbols). In this case, <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into </font></b>advances execution to the next instruction rather than to the next line of source.</p><dd><p class="Body"><a name="84571"> </a>To single-step without going into other subroutines, click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>instead of <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b>. The <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>command is almost the same as <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b>, but instead of stepping to the very next statement executed (which, in the case of a subroutine call, is typically not the next statement displayed), <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>steps to the next line on the screen. If there is no intervening subroutine call, this is the same thing as <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b>. But if there is an intervening subroutine call, <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>executes that subroutine in its entirety, then stops at the line after the subroutine call.</p><dd><p class="Body"><a name="84572"> </a>The display style has the same effect on <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>as on <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Into</font></b>. <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Over </font></b>steps to either the next machine instruction or the next source statement, and if necessary completes a subroutine call first.</p><dd><p class="Body"><a name="84573"> </a>While stepping through a program, you may conclude that the problem you are interested in lies in the current subroutine's caller, rather than at the stack level where your task is suspended. Use the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Step Out</font></b> command from the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu in that situation: execution continues until the current subroutine completes, then the debugger regains control in the calling statement.</p><dd><p class="Body"><a name="91637"> </a>To continue a stopped task to a specific point without setting a breakpoint, place the cursor on the desired line of code, right-click to open the pop-up menu, and select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Run to Cursor</font></b>.</p><dd><p class="Body"><a name="91639"> </a>To start execution from a specific point, place the cursor on the desired line of code, right-click to open the pop-up menu, and select <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Start a new task from current function</font></b>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84608">8.3.8 Attaching to a Running Task</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="94017"> </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="84579"> </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="84581"> </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="84583"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Debug 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="84597"> </a>n/a</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84599"> </a><kbd>ALT+F6</kbd></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84601"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Attach</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="84610"> </a>Click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Attach</font></b> to attach the debugging session to a task that is already running. If you were already debugging another task, the previous task is released from debugger control, remaining in its current state (running or stopped). <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Attach</font></b> displays a scrolling list of the tasks running on the target (<a href="c-debugger3.html#84622">Figure 8-11</a>). You can either select a task in the list, or type the name (or task ID) of a task in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Attach to:</font></b> box. The debugger stops the task immediately after attaching.<div class="frame"><h4 class="EntityTitle"><a name="84622"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 8-11: Attach Dialog Box</font></a></h4><dl class="margin"><div class="Anchor"><a name="84619"> </a><img class="figure" border="0" src="images/c-debugger40.gif"></div></dl></div></p><dd><p class="Body"><a name="84623"> </a>Usually, a newly-attached task stops in a system routine; thus, the debugger displays an assembly listing in the editor window. Open the backtrace window using the <img class="figure" border="0" src="images/c-debugger32.gif"> button. Change the frame by double-clicking on the frame you want to jump to. </p><dd><p class="Body"><a name="84630"> </a>The first entry in the <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Attach</font></b> dialog box is always <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">System</font></b>. Select this entry to enter system mode, as described in <a href="c-debugger6.html#85341"><i class="title">8.6 System-Mode Debugging</i></a>. An error display appears if your BSP is not configured to support system mode.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="90512">8.3.9 Detaching from a Running Task</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84635"> </a>Click <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Detach and Resume </font></b>to release the current task from debugger control (and allow it to continue running). This allows you to exit the debugger, or switch to system mode, without killing the task you were debugging.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84731">8.3.10 Examining Data, Memory, and the Stack</a></i></h4></font><dl class="margin"><dl class="margin"><dd><div class="Item"><a name="94018"> </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="84684"> </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="84686"> </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="84688"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Debug Windows Menu Command</font></b></div></th><td width="10"> </td></tr><tr><td colspan="20"><hr class="tablerule2"></td></tr><tr valign="top">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -