📄 c-wtx3.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> The WTX Protocol </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-wtx.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-wtx.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-wtx2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-wtx4.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84583">4.3 WTX Facilities</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84584"> </a>The WTX protocol provides requests that serve the following functions:</p></dl><dl class="margin"><ul class="BulletSingle" type="disc"><li><a name="84585"> </a>managing sessions and logging level </li></ul><ul class="BulletSingle" type="disc"><li><a name="84586"> </a>supporting symbolic debugging in system or task mode </li></ul><ul class="BulletSingle" type="disc"><li><a name="84587"> </a>attaching to a target server </li></ul><ul class="BulletSingle" type="disc"><li><a name="84588"> </a>accessing target memory </li></ul><ul class="BulletSingle" type="disc"><li><a name="89347"> </a>supporting disassembly requests </li></ul><ul class="BulletSingle" type="disc"><li><a name="84589"> </a>managing object modules </li></ul><ul class="BulletSingle" type="disc"><li><a name="84590"> </a>managing symbols </li></ul><ul class="BulletSingle" type="disc"><li><a name="84591"> </a>managing contexts </li></ul><ul class="BulletSingle" type="disc"><li><a name="89352"> </a>supporting virtual I/O </li></ul><ul class="BulletSingle" type="disc"><li><a name="89353"> </a>managing events </li></ul><ul class="BulletSingle" type="disc"><li><a name="89354"> </a>supporting Gopher </li></ul></dl><dl class="margin"><dd><p class="Body"><a name="84596"> </a>This section summarizes each of these functions.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84597">4.3.1 Session Management</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84599"> </a>WTX provides a set of requests to attach tools to or detach tools from the target server. These requests start and terminate communication with the target server. Requests are also available to lock and unlock other users' access to the target server. WTX and WDB messages can also be logged to files on user demand.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84600">4.3.2 Symbolic Debugging Support</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84602"> </a>The protocol provides a standard set of symbolic debugging facilities. WTX supports the following primitives:</p></dl><dl class="margin"><ul class="BulletSingle" type="disc"><li><a name="84603"> </a>continue </li></ul><ul class="BulletSingle" type="disc"><li><a name="84604"> </a>suspend </li></ul><ul class="BulletSingle" type="disc"><li><a name="84605"> </a>single step </li></ul><ul class="BulletSingle" type="disc"><li><a name="90154"> </a>set breakpoint </li></ul><ul class="BulletSingle" type="disc"><li><a name="90650"> </a>set hardware breakpoint (if architecture supports) </li></ul><ul class="BulletSingle" type="disc"><li><a name="90155"> </a>delete breakpoint </li></ul><ul class="BulletSingle" type="disc"><li><a name="84608"> </a>get list of breakpoints </li></ul></dl><dl class="margin"><dd><p class="Body"><a name="84609"> </a>These primitives form the basis of more complicated debugging facilities such as "continue to return," or "step over." Such commands are provided by CrossWind, the Tornado debugger (see the <i class="title">Tornado User's Guide</i>).</p><dd><p class="Body"><a name="84610"> </a>Those commands can be used in task mode (debugging a task) or in system mode (the kernel itself is suspended).</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84611">4.3.3 Attaching to a Target Server</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84613"> </a>Binding to a target server is mediated by the Tornado registry, also known as the WTX registry (<b class="keyword">wtxregd</b>), which provides and maintains a database of all executing target servers and their remote procedure call (RPC) IDs. WTX service calls exist to look up target server information kept in this database.</p><dd><p class="Body"><a name="84615"> </a>There is also a WTX request to attach a tool to a target server. The act of attaching allows the tool to provide information about itself. In addition, attached tools can query the target server for a list of other attached tools.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84616">4.3.4 Target Memory Access</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84618"> </a>WTX-based tools can read, write, move, and otherwise manipulate target memory. <b class="symbol_UC">WTX_MEM_ALLOC</b> and <b class="symbol_UC">WTX_MEM_FREE </b>operate on the portion of target memory managed by the target server. All other WTX memory requests operate on any valid memory location on the target.</p><dd><p class="Body"><a name="84622"> </a><b class="symbol_UC">WTX_MEM_READ</b> can be used to transfer data from the target to the host. There are no restrictions on the size of a transfer, but be aware that the time required to fulfill a large request depends on the speed of the host-target link. When transferring complex data structures, use <b class="symbol_UC">WTX_GOPHER_EVAL</b>, which is discussed in <a href="c-wtx3.html#84997"><i class="title">4.3.11 Gopher Support</i></a>.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84627">4.3.5 Target Memory Disassembly</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84629"> </a>WTX-based tools can request the disassembly of a target memory area with <b class="symbol_UC">WTX_MEM_DISASSEMBLE</b>, which can operate on any valid memory location on the target. The output is a string representing the assembly instructions stored in the given area. The disassembly is done by the target server using the CPU vendor's instruction mnemonics. The output of this facility matches the CPU vendor's documentation, which the disassembly produced by GDB may not.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84631">4.3.6 Object-Module Management</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84633"> </a>The object-module loader allows the target server to load and unload relocatable or fully linked object modules to the target. Modules may be loaded from any tool. The object-module formats (OMFs) supported depend on what OMF readers are available to the target server. See <i class="textVariable">installDir</i>/<b class="file">host/resource/target/architecturedb</b> for a list of the OMF readers available on your host.</p><dd><p class="Body"><a name="84634"> </a>The load operation can be synchronous (the tool waits for completion) or asynchronous (the tool checks for load completion, but can continue with other operations, including cancelling the submitted load request).</p><dd><p class="Body"><a name="84635"> </a>The loader adds all symbols defined by an object module to a symbol table managed by the target server. There is only one symbol table that is shared by all tools; thus a module loaded from one tool is visible from another.</p><dd><p class="Body"><a name="84636"> </a>The loader fully supports C++ modules and the symbol table records all symbols in their mangled form. The loader also supports text section protection if the optional product VxVMI is included on the target.</p><dd><p class="Body"><a name="84639"> </a>If some symbols are undefined during the link stage, the object module is not rejected. A partial link is performed, and the code can be utilized as long as all undefined references are avoided. <b class="symbol_UC">WTX_OBJ_MODULE_LOAD</b> returns a list of undefined symbols to inform the tool of all missing references.</p><dd><p class="Body"><a name="84641"> </a>The target server retains module information and WTX has service calls to get information on segment addresses, size, and so on.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84642">4.3.7 Symbol Management</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84644"> </a>The target server provides symbol-table management for the target. The symbol table holds all the target symbols, and service calls exist for adding, deleting, and looking up symbols. The symbol table is hashed for higher performance. There is only one symbol table; thus every tool sees all symbols.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84645">4.3.8 Context Management</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84647"> </a>The protocol provides services to create and destroy tasks on the target system. It also provides services to set and get the register values for a given task.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84648">4.3.9 Virtual I/O</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84650"> </a>Because I/O requirements during development may exceed the facilities available to the target, WTX provides virtual input and output (VIO) for the target. On the host, channels can be associated with a variety of devices (displays, files, streams, and so on). These act as input and output devices associated with the target.</p><dd><p class="Body"><a name="84651"> </a>Virtual I/O requires that the target configuration include the WDB agent and a virtual I/O device driver. Once installed, the virtual I/O driver provides standard I/O system access to the virtual I/O facility.</p><dd><p class="Body"><a name="84655"> </a>In <a href="c-wtx3.html#84659">Figure 4-4</a>, a task on the target writes a buffer containing "Hello world" to a previously opened virtual I/O device. The buffer is transferred to the target server by the virtual I/O device driver and displayed in a host window.<div class="frame"><h4 class="EntityTitle"><a name="84659"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 4-4: Virtual I/O example</font></a></h4><dl class="margin"><div class="CellBody"><a name="84695"> </a><img class="figure" border="0" src="images/c-wtxa3.gif"></div></dl></div></p><dd><p class="Body"><a name="84696"> </a>A target task creates a virtual I/O channel by calling <b class="routine"><i class="routine">open</i></b><b>( )</b> on a virtual I/O device. A bi-directional virtual I/O channel referenced by a unique number is attached to the file descriptor returned by <b class="routine"><i class="routine">open</i></b><b>( )</b>. This unique VIO channel number is then used during all <b class="routine"><i class="routine">read</i></b><b>( )</b> and <b class="routine"><i class="routine">write</i></b><b>( )</b> transactions mediated by the target server. The target server manages redirection of the VIO data to the appropriate device or tool.</p><dd><p class="Body"><a name="84697"> </a>The Target Server File System (TSFS) is based on Virtual IO. For more information on TSFS, see the <i class="title">VxWorks Programmer's Guide: Local File Systems.</i></p><dd><p class="Body"><a name="90651"> </a></p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84699">4.3.10 Event Management</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84701"> </a>Host tools must be notified of events occurring on the target and must know about certain actions performed by other tools. WTX meets this requirement by providing a register of events. Tools register to receive notification of particular events or event types. When an event occurs, it generates an event string which is sent to the target server. The target server forwards the string to the tools that have registered to receive notification of that event or event type.</p><dd><p class="Body"><a name="84703"> </a>Event strings have the following syntax: </p><dl class="margin"><dd><div class="Indent"><a name="84704"> </a><i class="i">evtName</i> [<i class="textVariable">param1</i>] [<i class="textVariable">param2</i>] [<i class="textVariable">param3</i>] ... [<i class="textVariable">paramN</i>]</div><br></dl><dd><p class="Body"><a name="84705"> </a>The parameters are optional and can be either a hexadecimal value (h) or a string (s). The maximum size of an event string is <b class="symbol_UC">MAX_TOOL_EVENT_SIZE</b> (300 characters). <a href="c-wtx3.html#84717">Table 4-1</a> lists all event parameters. <p class="table"><h4 class="EntityTitle"><a name="84717"><font face="Helvetica, sans-serif" size="-1" class="sans">Table 4-1: Event Parameters </font></a></h4><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="CellHeading"><b><a name="84727"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Event</font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84729"> </a><font face="Helvetica, sans-serif" size="-1" class="sans">Parameters<sup><b class="FootnoteMarker">1</b></sup></font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84731"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"></font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84733"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"></font></b></div></th><td width="10"> </td><th rowspan="1" colspan="1"><div class="CellHeading"><b><a name="84735"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"></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="CellBody"><a name="84738"> </a><b class="symbol_UC">CTX_START</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84740"> </a> contextType(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84742"> </a> contextId(h)</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84744"> </a></div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84746"> </a></div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84749"> </a><b class="symbol_UC">CTX_EXIT</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84751"> </a> contextType(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84753"> </a> contextId(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84755"> </a> returnVal(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84757"> </a> errnoVal(h)</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84760"> </a><b class="symbol_UC">TEXT_ACCESS</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84762"> </a> contextId(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84764"> </a> contextType(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84766"> </a> pc(h) fp(h)</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84768"> </a> sp(h)</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84771"> </a><b class="symbol_UC">DATA_ACCESS</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84773"> </a> contextId(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84775"> </a> contextType(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84777"> </a> pc(h) fp(h)</div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84779"> </a> sp(h) addr(h)</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84782"> </a><b class="symbol_UC">EXCEPTION</b> </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84784"> </a> contextType(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84786"> </a> contextId(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84788"> </a> excVector(h) </div></td><td width="10"> </td><td colspan=1 rowspan=1><div class="CellBody"><a name="84790"> </a> esfAddr(h)</div></td><td width="10"> </td></tr><tr valign="top"><td colspan=1 rowspan=1><div class="CellBody"><a name="84793"> </a><b class="symbol_UC">VIO_WRITE</b> </div></td><td width="10"> </td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -