📄 c-shell2.html
字号:
<td colspan=1 rowspan=1><div class="CellBody"><a name="90631"> </a><b class="routine"><i class="routine">lkup</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90633"> </a>List symbols from symbol table.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90637"> </a><b class="routine"><i class="routine">lkAddr</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90639"> </a>List symbols whose values are near a specified value.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90643"> </a><b class="routine"><i class="routine">d</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90645"> </a>Display target memory. You can specify a starting address, size of memory units, and number of units to display.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90649"> </a><b class="routine"><i class="routine">l</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90651"> </a>Disassemble and display a specified number of instructions.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90655"> </a><b class="routine"><i class="routine">printErrno</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90657"> </a>Describe the most recent error status value.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90661"> </a><b class="routine"><i class="routine">version</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90663"> </a>Print VxWorks version information.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90667"> </a><b class="routine"><i class="routine">cd</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90669"> </a>Change the host working directory (no effect on target).</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90673"> </a><b class="routine"><i class="routine">ls</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90675"> </a>List files in host working directory.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90679"> </a><b class="routine"><i class="routine">pwd</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90681"> </a>Display the current host working directory.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90685"> </a><b class="routine"><i class="routine">help</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90687"> </a>Display a summary of selected shell commands.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90691"> </a><b class="routine"><i class="routine">h</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90693"> </a>Display up to 20 lines of command history.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90697"> </a><b class="routine"><i class="routine">shellHistory</i></b><b>(</b> <b>)</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90699"> </a>Set or display shell history.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90703"> </a><b class="routine"><i class="routine">shellPromptSet</i></b><b>(</b> <b>)</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90705"> </a>Change the C-interpreter shell prompt.</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="90709"> </a><b class="routine"><i class="routine">printLogo</i></b><b>( )</b></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="90711"> </a>Display the Tornado shell logo.</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><dd><p class="Body"><a name="90714"> </a>The <b class="routine"><i class="routine">lkup</i></b><b>( )</b> command takes a regular expression as its argument, and looks up all symbols containing strings that match. In the simplest case, you can specify a substring to see any symbols containing that string. For example, to display a list containing routines and declared variables with names containing the string <i class="i">dsm</i>, do the following:</p><dl class="margin"><dd><pre class="Code2"><b><a name="92274"></b><tt class="output">-> </tt><b>lkup "dsm" </b><tt class="output">_dsmData 0x00049d08 text (vxWorks) _dsmNbytes 0x00049d76 text (vxWorks) _dsmInst 0x00049d28 text (vxWorks) mydsm 0x003c6510 bss (vxWorks)</tt><b></a></b></pre></dl><dd><p class="Body"><a name="90718"> </a>Case is significant, but position is not (<b class="symbol_lc">mydsm</b> is shown, but <b class="symbol_lc">myDsm</b> would not be). To explicitly write a search that would match either <b class="symbol_lc">mydsm</b> or <b class="symbol_lc">myDsm</b>, you could write the following:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90719"></b><tt class="output">-> </tt><b>lkup "[dD]sm"</a></b></pre></dl><dd><p class="Body"><a name="90720"> </a>Regular-expression searches of the symbol table can be as simple or elaborate as required. For example, the following simple regular expression displays the names of three internal VxWorks semaphore functions:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90721"></b><tt class="output">-> </tt><b>lkup "sem.Take" </b><tt class="output">_semBTake 0x0002aeec text (vxWorks) _semCTake 0x0002b268 text (vxWorks) _semMTake 0x0002bc48 text (vxWorks) value = 0 = 0x0</tt><b></a></b></pre></dl><dd><p class="Body"><a name="90724"> </a>Another information command is a symbolic disassembler, <b class="routine"><i class="routine">l</i></b><b>( )</b>. The command syntax is:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90725">l [<i class="textVariable">adr</i>[, <i class="textVariable">n</i>]]</a></b></pre></dl><dd><p class="Body"><a name="90727"> </a>This command lists <i class="textVariable">n</i> disassembled instructions, starting at <i class="textVariable">adr</i>. If <i class="textVariable">n</i> is 0 or not given, the <i class="textVariable">n</i> from a previous <b class="routine"><i class="routine">l</i></b><b>(</b> <b>)</b> or the default value (10) is used. If <i class="textVariable">adr</i> is 0, <b class="routine"><i class="routine">l</i></b><b>(</b> <b>)</b> starts from where the previous <b class="routine"><i class="routine">l</i></b><b>(</b> <b>)</b> stopped, or from where an exception occurred (if there was an exception trap or a breakpoint since the last <b class="routine"><i class="routine">l</i></b><b>(</b> <b>)</b> command).</p><dd><p class="Body"><a name="90732"> </a>The disassembler uses any symbols that are in the symbol table. If an instruction whose address corresponds to a symbol is disassembled (the beginning of a routine, for instance), the symbol is shown as a label in the address field. Symbols are also used in the operand field. The following is an example of disassembled code for an MC680<i class="textVariable">x</i>0 target:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90733"></b><tt class="output">-></tt><b> l printf </b><tt class="output">_printf</tt><b></a></b><dd> <b><a name="94765"></b><tt class="output"> 00033bce 4856 PEA (A6) 00033bd0 2c4f MOVEA .L A7,A6 00033bd2 4878 0001 PEA 0x1 00033bd6 4879 0003 460e PEA _fioFormatV + 0x780 00033bdc 486e 000c PEA (0xc,A6) 00033be0 2f2e 0008 MOVE .L (0x8,A6),-(A7) 00033be4 6100 02a8 BSR _fioFormatV 00033be8 4e5e UNLK A6 00033bea 4e75 RTS</tt><b></a></b></pre></dl><dd><p class="Body"><a name="90735"> </a>This example shows the <b class="routine"><i class="routine">printf</i></b><b>(</b> <b>)</b> routine. The routine does a <b class="symbol_lc">LINK</b>, then pushes the value of <b class="symbol_lc">std_out</b> onto the stack and calls the routine <b class="routine"><i class="routine">fioFormatV</i></b><b>(</b> <b>)</b>. Notice that symbols defined in C (routine and variable names) are prefixed with an underbar ( <b>_</b> ) by the compiler.</p><dd><p class="Body"><a name="90739"> </a>Perhaps the most frequently used system information command is <b class="routine"><i class="routine">d</i></b><b>( )</b>, which displays a block of memory starting at the address which is passed to it as a parameter. As with any other routine that requires an address, the starting address can be a number, the name of a variable or routine, or the result of an expression.</p><dd><p class="Body"><a name="90741"> </a>Several examples of variations on <b class="routine"><i class="routine">d</i></b><b>( )</b> appear below.</p><dd><p class="Body"><a name="90742"> </a>Display starting at address 1000 decimal:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90743"></b><tt class="output">-></tt><b> d (1000)</a></b></pre></dl><dd><p class="Body"><a name="90744"> </a>Display starting at 1000 hex:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90745"></b><tt class="output">-></tt><b> d 0x1000</a></b></pre></dl><dd><p class="Body"><a name="90746"> </a>Display starting at the address contained in the variable <b class="symbol_lc">dog</b>:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90747"></b><tt class="output">-></tt><b> d dog</a></b></pre></dl><dd><p class="Body"><a name="90748"> </a>The above is different from a display starting at the address of <b class="symbol_lc">dog</b>. For example, if <b class="symbol_lc">dog</b> is a variable at location 0x1234, and that memory location contains the value 10000, <b class="routine"><i class="routine">d</i></b><b>(</b> <b>)</b> displays starting at 10000 in the previous example and at 0x1234 in the following:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90750"></b><tt class="output">-></tt><b> d &dog</a></b></pre></dl><dd><p class="Body"><a name="90751"> </a>Display starting at an offset from the value of <b class="symbol_lc">dog</b>:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90752"></b><tt class="output">-></tt><b> d dog + 100</a></b></pre></dl><dd><p class="Body"><a name="90753"> </a>Display starting at the result of a function call:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90754"></b><tt class="output">-></tt><b> d func (dog)</a></b></pre></dl><dd><p class="Body"><a name="90755"> </a>Display the code of <b class="routine"><i class="routine">func</i></b><b>( )</b> as a simple hex memory dump:</p><dl class="margin"><dd><pre class="Code2"><b><a name="90757"></b><tt class="output">-></tt><b> d func </a></b></pre></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H4"><i><a name="90759">System Modification and Debugging</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="90761"> </a>Developers often need to change the state of the target, whether to run a new version of some software module, to patch memory, or simply to single-step a program. <a href="c-shell2.html#90768">Table 6-5</a> summarizes the WindSh commands of this type.<p class="table"><h4 class="EntityTitle"><a name="90768"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 6-5: WindSh Commands for System Modification and Debugging</font></a></h4>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -