📄 c-debugger8.html
字号:
</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="CellBody"><a name="85671"> </a><b class="tclProc">menuItemAppend</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85673"> </a>Add a command or a separator to the end of an existing menu.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="85675"> </a><b class="tclProc">menuItemInsert</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="85677"> </a>Add a command within the list of existing commands in a menu.</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></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85683">Tcl: An Add-Symbols Command for the File Menu</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85688"> </a><b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans"></font></b>As explained in <a href="c-debugger5.html#85178"><i class="title">8.5.2 Selecting Modules to Debug</i></a>, you sometimes need to tell the debugger explicitly to load symbols for modules that were downloaded to the target using other programs (such as the shell). </p><dd><p class="Body"><a name="85692"> </a><a href="c-debugger8.html#85695">Example 8-1</a> illustrates a <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu command <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Add Symbols</font></b> to handle this through the graphical user interface, instead of typing the <b class="command">add-symbol-file</b> command. </p></dl></dl><h4 class="EntityTitle"><a name="85695"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 8-1: Add-Symbols Command</font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="85697"> # MENU COMMAND: "Add Symbols", additional entry under "Debug" menuItemInsert -after {"&Debug" "Do&wnload...\tShift+F6"} \ {"Add Symbols..."} {windAddSyms} ############################################################################## # # windAddSyms - called from Debug menu to add symbols from chosen object file # # This routine implements the "Add Symbols" command in the Debug menu. # It prompts the user for a filename; if the user selects one, it tells # GDB to load symbols from that file. # # SYNOPSIS: # xwindAddSyms # # RETURNS: N/A # # ERRORS: N/A #proc windAddSyms {} { set result [fileDialogCreate -title "Symbols from file" -filemustexist \ -filefilters "Object Files (*.o;*.out)|*.o;*.out| All Files (*.*)|*.*||" \ -okbuttontitle "&Add"] if {$result != ""} { # we violate good taste here by not capturing or testing the result # of catch, because an error notification appears in the command panel. catch {downtcl gdb add-symbol-file [lindex $result 0]} } }<b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans"> </font></b></a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="85719">Tcl: "this" Menu Command for C++</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85721"> </a>In C++ programs, one particular named value has special interest: <b class="symbol_lc">this</b>, which is a pointer to the object where the currently executing routine is a member. </p><dd><p class="Body"><a name="85725"> </a><a href="c-debugger8.html#85728">Example 8-2</a> defines a <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Debug</font></b> menu command to launch an inspection window for the value where <b class="symbol_lc">this</b> points. The Tcl primitive <b class="tclProc">catch</b> is used in the definition in order to avoid propagating error conditions (for instance, if the buttons are pressed with no code loaded) from GDB back to the controlling Tornado debugger session. </p></dl></dl><h4 class="EntityTitle"><a name="85728"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 8-2: Command to Display C++ <b class="symbol_lc">this</b> Value</font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="85729"># Insert a separator line after default menu commands menuItemAppend -separator {&Debug} # Debug Menu Command: *this - Inspect window on current C++ class (*this) menuItemAppend {"&Debug"} {"*this"} { catch {downtcl gdb display/W *this} }</a></b><dd> <b><a name="85732"> </a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="83403"> </a></p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-debugger.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-debugger7.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-customize.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -