TornadoShell命令使用.doc_第1页
TornadoShell命令使用.doc_第2页
TornadoShell命令使用.doc_第3页
TornadoShell命令使用.doc_第4页
TornadoShell命令使用.doc_第5页
已阅读5页,还剩29页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Tornado Shell 使用指南:Tornado Shell,即WindSh,可以用来下载应用模块、激活VxWorks操作系统和应用程序模块的子程序。这些功能有许多的用途:查看VxWorks操作系统,交互开发、测试等。WindSh能够解释绝大多数的C言语表达式;能执行C语言的绝大多数操作。你可以通过TCL解释器与WindSh交互,TCL提供了一个完整的控制结构,对目标功能提供了更低级的访问,关于TCL语言,可以参见附件2的描述。WindSh在开发主机上运行,但它能够创建任务,能够读写目标机上的设备,提供对目标机的完全控制。因为WindSh在开发主机上运行,所以对目标机资源的占用比较少。与其它的工具一样,只需在目标机上运行target Agent。WindSh操作牵系到Tornado开发环境的三个部件。 WindSh是你直接操作的部件,它接收你的命令并在本地执行,发送请求到target server以操作符号表和驻留在目标机上的程序。 Target server 管理符号表并处理所有与远程目标机的通讯,调用发送功能发送回所需的结果。(尽管符号表包含了对目标机访问的地址,但它全部存储在主机上。) Target agent 是唯一一个运行在目标机上的部件;它是一个极小的监视程序,提供对目标机内存的访问以及其它功能。WindSh具有双重功能: 作为一个命令解释器通过调用VxWorks的子程序提供对VxWorks功能的访问。 作为一个应用程序的调试工具使你能调用任何的应用程序。WindSh提供硬件异常的通知。见下面的系统修改和调试。WishSh的功能:(1) 设定任务级的断点。(2) 任务级的单步调试。(3) 符号的反汇编。(4) 任务和系统的信息。(5) 调用用户程序(6) 创建和检查符号变量。(7) 检查和修改内存。(8) 异常的捕获。使用WishSh: WishSh从输入流中读入一行输入,解释并执行该行的命令,把计算结果写入输出流中。使用默认的C翻译器,WishSh能接收与C编译器相同的语法表达式(变量不能太多)。 启动、停止WishSh: 有三种方法启动WishSh:(1) 使用图形界面按钮。(2) 使用图形界面的菜单命令。(3) 使用windows的命令行界面,命令为windsh,指定target-server 名称。如: C: windsh phobos可以用exit()或quit()命令,或CTRL+D来终止WindSh的运行,当. WindSh不接收输入时(如target server已经关闭)可以使用(CTRL+BREAK。可以对一个target运行多个不同的WindSh。Windsh中调用的所有函数的输出都被重定向到Windsh窗口,并且它从那里接收输入。(除非使用命令shConfig改变配置)。Windsh的特征: I/O重定向:开发者们经常调用程序来显示数据或从标准输入接收数据。默认的输入和输出流指向同一Tornade Shell窗口。例如,默认配置下,从shell中激活printf()函数输出内容如下: - printf(Hello Worldn) Hello World! value = 13 = 0xd -这可以通过使用TCL过程shConfig来动态修改,如下: - ?shConfig SH_GET_TASK_IO off - - printf(Hello World!n) value = 13 = 0xd -Tornade shell 报告printf()结果。(有13个字符被打印,输出结果到target的标准输出,而不是shell。为了确定当前的配置,可以使用shConfig。如果该命令不带参数,则显示所有的配置参数的当前值。使用一个参数则仅显示该参数的当前值。例如: - ?shConfig SH_GET_TASK_IO SH_GET_TASK_IO = offShConfig的更多信息,请参看WindSh的环境变量。只有那些从WindSh中调用的函数的输入和输出才被重定向到Windsh,如果该函数产生了其它的任务,该新产生任务的的输入和输出并不被重定向到windsh。如果要使所有的IO操作都重定向到WINDSH。可以在启动target server的时候使用参数-C redirectShell。目标符号和路径的自动填充:输入目标符号或路径的一些开始字符,然后按ctrl+d,则WindSh会自动完成剩下字符串的输入。如果存在多个选项,则shell显示这些选项,你可以重新输入。例如:- C:Tor CTRL+DTornado/ TorClass/- C:Tor你可以增加一个或多个字符,然后按CTRL+D以完成输入。显示摘要:当你完成了一个函数名的输入,再按CTRL+D,则SHELL显示该函数的摘要信息,并接着输出该函数名以等待你的进一步输入,例如:- _taskIdDefault CTRL+DtaskIdDefault() - set the default task ID (WindSh)int taskIdDefault(int tid /* user-supplied task ID; if 0, return default */)- _taskIdDefault如果该例程在主机和目标机中都存在,则WindSh显示摘要。为了显示目标机上函数的摘要可以在函数名前加入字符。 你也可以扩展摘要打印功能到包括你自己的例程,步骤如下:(1) 创建一个包含新例程的文件。(在WRS编码约定后,参见VxWorks Programmers Guide: WRS Coding Conventions.)(2) 在项目中包含这些文件。(3) 把该文件名增加到makefile的宏DOC_FILES中。(4) 进入项目树的顶层目录,运行“make sysnopsis”,如下: - cd $WIND_BASE/target/src/projectX - make synopsis这将在host/resource/synopsis目录下增加文件projectX。HTML 帮助: 输入任何函数名,一个空格,然后键入CTRL+W能打开一个browser并显示与该函数相关的HTML参考。(确保在函数名后有一个空格)。数据转换: SHELL以十进制和十六进制显示所有的整数,如果可能,可以作为一个字符常数或符号地址和偏移量。 - 68 value = 68 = 0x44 = D - 0xf5de value = 62942 = 0xf5de = _init + 0x52- svalue = 115 = 0x73 = s数据计算: 几乎所有的C操作符都可以用来进行数据计算。可以使用“(”和“)”来改变优先级。- (14 * 9) / 3value = 42 = 0x2a = *- (0x1355 4.3 * 5value = 21.5带参数计算:- (j + k) * 3value = .- *(j + 8 * k)(address (j + 8 * k): value = - x = (val1 - val2) / val3new symbol x added to symbol tableaddress = value = - f = 1.41 * 2new symbol f added to symbol tablef = (address of f): value = 2.82WindSh的环境变量:通过改变WindSh的环境变量可以改变特定会话的行为。Tcl过程shConfig可以用来显示和设置I/O重定向,C+构造器和释构器,等。因为shConfig是一个Tcl进程,使用?来把C翻译器换成Tcl翻译器。WindSh的环境变量见下表:变量结果SH_GET_TASK_IOSets the I/O redirection mode for called functions.The default is “on”, which redirects input and outputof called functions to WindSh. To have input andoutput of called functions appear in the targetconsole, set SH_GET_TASK_IO to “off.”LD_CALL_XTORSSets the C+ strategy related to constructors anddestructors. The default is “target”, which causesWindSh to use the value set on the target usingcplusXtorSet(). If LD_CALL_XTORS is set to “on”,the C+ strategy is set to automatic (for the currentWindSh only). “Off” sets the C+ strategy to manual for the current shell.LD_SEND_MODULESSets the load mode. The default “on” causes modulesto be transferred to the target server. This means thatany module WindSh can see can be loaded. IfLD_SEND_MODULES if “off”, the target servermust be able to see the module to load it.LD_PATHSets the search path for modules using the separator“;”. When a ld() command is issued, WindSh firstsearches the current directory and loads the moduleif it finds it. If not, WindSh searches the directorypath for the module.LD_COMMON_MATCH_ALLSets the loader behavior for common symbols. If it isset to on, the loader tries to match a common symbolwith an existing one. If a symbol with the same nameis already defined, the loader take its address.Otherwise, the loader creates a new entry. If set to off,the loader does not try to find an existing symbol. Itcreates an entry for each common symbol.DSM_HEX_MODSets the disassembling “symbolic + offset” mode.When set to “off” the “symbolic + offset” addressrepresentation is turned on and addresses inside thedisassembled instructions are given in terms of “symbol name + offset.” When set to “on” these addresses are given in hexadecimal.例子:使用shConfig修改WindSh的行为:- ?shConfigSH_GET_TASK_IO = onLD_CALL_XTORS = targetLD_SEND_MODULES = onLD_PATH = C:/ProjectX/lib/objR4650gnutest/;C:/ProjectY/lib/objR4560gnuvx- ?shConfig LD_CALL_XTORS on- ?shConfig LD_CALL_XTORSLD_CALL_XTORS = on激活SHELL中的内嵌例程: 一些可以从SHELL中可以执行的命令(例程)是与SHELL内嵌在一起的,而不是作为目标机上的函数运行。通过使用这些,可以减少对目标机内存和性能的影响。下面描述WindSh中的命令。任务管理:命令功能sp( )Spawn a task with default parameters.sps()Spawn a task, but leave it suspended.tr()Resume a suspended task.ts()Suspend a task.td()Delete a task.period()Spawn a task to call a function periodically.repeat()Spawn a tas k to call a function repeatedly.taskIdDefault()Set or report the default (current) task ID 任务信息:命令功能i()Display system information. This command gives a snapshot of what tasks are in the system, and some information about each of them, such as state, PC, SP, and TCB address. To save memory, this commandqueries the target repeatedly; thus, it may occasionally give aninconsistent snapshot.iStrict()Display the same information as i(), but query target system information only once. At the expense of consuming more intermediate memory, this guarantees an accurate snapshotti()Display task information. This command gives all the informationcontained in a tasks TCB. This includes everything shown for that taskby an i()command, plus all the tasks registers, and the links in the TCBchain. If task is 0 (or the argument is omitted), the current task isreported on.w()Print a summary of each tasks pending information, task by task. Thisroutine calls taskWaitShow()in quiet mode on all tasks in the system,or a specified task if the argument is given.tw()Print information about the object the given task is pending on. Thisroutine calls taskWaitShow() on the given task in verbose mode.checkStack()Show a stack usage summary for a task, or for all tasks if no task isspecified. The summary includes the total stack size (SIZE), the currentnumber of stack bytes (CUR), the maximum number of stack bytes used(HIGH), and the number of bytes never used at the top of the stack(MARGIN = SIZE - HIGH). Use this routine to determine how muchstack space to allocate, and to detect stack overflow. This routine doesnot work for tasks that use the VX_NO_STACK_FILL option.tt()Display a stack trace.taskIdFigure()Report a task ID, given its name.命令i( )通常用来快速得到目标机的活动情况,若要周期性地得到这些信息,可以使用tornado 的 browser。- iNAME ENTRY TID PRI STATUS PC SP ERRNO DELAY- - - - - - - - -tExcTask _excTask 3ad290 0 PEND 4df10 3ad0c0 0 0tLogTask _logTask 3aa918 0 PEND 4df10 3aa748 0 0tWdbTask 0x41288 3870f0 3 READY 23ff4 386d78 3d0004 0tNetTask _netTask 3a59c0 50 READY 24200 3a5730 0 0tFtpdTask _ftpdTask 3a2c18 55 PEND 23b28 3a2938 0 0value =0 =0x0命令w()和tw()可以用来查看VxWorks上那些对象被阻塞。命令w()显示所有任务的一个总结,命令tw()显示指定任务的对象信息。6- wNAME ENTRY TID STATUS DELAY OBJ_TYPE OBJ_ID OBJ_NAME- - - - - - - -tExcTask _excTask 3d9e3c PEND 0 MSG_Q(R) 3d9ff4 N/AtLogTask _logTask 3d7510 PEND 0 MSG_Q(R) 3d76c8 N/AtWdbTask _wdbCmdLoo 36dde4 READY 0 0tNetTask _netTask 3a43d0 READY 0 0u0 _smtask1 36cc2c PEND 0 MSG_Q_S(S) 370b61 N/Au1 _smtask3 367c54 PEND 0 MSG_Q_S(S) 370b61 N/Au3 _taskB 362c7c PEND 0 SEM_B 8d378 _mySem2u6 _smtask1 35dca4 PEND 0 MSG_Q_S(S) 370ae1 N/Au9 _task3B 358ccc PEND 0 MSG_Q(S) 8cf1c _myMsgQvalue = 0 = 0x0- tw u1NAME ENTRY TID STATUS DELAY OBJ_TYPE OBJ_ID OBJ_NAME- - - - - - - -u1 _smtask3 367c54 PEND 0 MSG_Q_S(S) 370b61 N/AMessage Queue Id : 0x370b61Task Queueing : SHARED_FIFOMessage Byte Len : 100Messages Max : 0Messages Queued : 0Senders Blocked : 2Send Timeouts : 0Receive Timeouts : 0Senders Blocked:TID CPU Number Shared TCB- - -0x36cc2c 0 0x36e4640x367c54 0 0x36e47cvalue = 0 = 0x0-系统信息:下表显示了WindSh有关显示符号表信息,目标机系统信息以及Shell本身信息的命令:命令功能devs()List all devices known on the target system.lkup()List symbols from symbol table.lkAddr()List symbols whose values are near a specified value.d()Display target memory. You can specify a starting address, size of memory units, and number of units to display.l()Disassemble and display a specified number of instructions.printErrno()Describe the most recent error status value.version()Print VxWorks version information.cd()Change the host working directory (no effect on target)ls()List files in host working directory.pwd()Display the current host working directory.help()Display a summary of selected shell commands.h()Display up to 20 lines of command history.shellHistory()Set or display shell history.shellPromptSet()Change the C-interpreter shell prompt.printLogo()Display the Tornado shell logo.命令 lkup()使用正则表达式作参数,查询符号表中包含匹配字符串的符号(区分大小写), 例如可以用下述命令显示包含字符串“dsm”的例程名和以声明的变量名的列表。- lkup dsm_dsmData 0x00049d08 text (vxWorks)_dsmNbytes 0x00049d76 text (vxWorks)_dsmInst 0x00049d28 text (vxWorks)mydsm 0x003c6510 bss (vxWorks)上面的例子如果想显示匹配Dsm和dsm的字符串则可以使用下面的命令:- lkup dDsm此外还可以使用其它的正则表达式,下面是另外一个例子:- lkup sem.Take_semBTake 0x0002aeec text (vxWorks)_semCTake 0x0002b268 text (vxWorks)_semMTake 0x0002bc48 text (vxWorks)value = 0 = 0x0另外一个与信息相关的函数是符号反汇编函数l()。该命令的语法为: l adr, n该命令列出从位置adr 开始的n条反汇编指令,如果n的值为0或未赋值,则n从以前使用的该命令中获得值或者使用默认值10。如果adr的值为0,则命令l()从先前该命令的停止处开始或者从上次该命令产生异常的位置开始。下面是一个反汇编MC680x0目标机的实例:- l printf_printf00033bce 4856 PEA (A6)00033bd0 2c4f MOVEA .L A7,A600033bd2 4878 0001 PEA 0x100033bd6 4879 0003 460e PEA _fioFormatV + 0x78000033bdc 486e 000c PEA (0xc,A6)00033be0 2f2e 0008 MOVE .L (0x8,A6),-(A7)00033be4 6100 02a8 BSR _fioFormatV00033be8 4e5e UNLK A600033bea 4e75 RTS该实例显示了printf()例程的内部实现方法。或许使用得最多的系统信息命令是d(),它显示从某一地址开始一块内存区域。与许多其它的命令一样,该命令需要一个地址参数,该参数可以是数字,变量名或例程名,或一个表达式。下面提供了一些具体的例子。显示从地址1000(十进制)开始的内存区域。- d (1000)显示从十六进制进制1000开始的内存区域:- d 0x1000显示从包含变量dog开始的内存区域:- d dog上面的命令不同于显示从地址dog开始的区域,例如,如果变量dog在地址0x1234,而该内存位置包含值10000,上述命令显示的开始位置为10000,下面的命令显示的开始位置为0x1234。- d &dog显示从变量dog的偏移位置100开始的内存区域:- d dog + 100显示从函数func (dog)计算结果开始的内存区域: - d func (dog)显示函数func()的内存转储区域的代码:- d func系统修改和调试:开发者经常需要改变目标机的状态,如运行某一软件模块的新版本,单步调试程序,等。下表列出了这种类型的WindSh命令。命令功能描述ld()Load an object module into target memory and link it dynamically into the run-time.unld()Remove a dynamically-linked object module from target memory, and free the storage it occupied.m()Modify memory in width (byte, short, or long) starting at adr. The m() command displays successive words in memory on the terminal; you can change each word by typing a new hex value, leave the word unchanged and continue by typing ENTER, or return to the shell by typing a dot (.)mRegs()Modify register values for a particular task.b()Set or display breakpoints, in a specified task or in all tasks.bh()Set a hardware breakpoint.s()Step a program to the next instruction.so()Single-step, but step over a subroutine.c()Continue from a breakpoint.cret()Continue until the current subroutine returns.bdall()Delete all breakpoints.bd()Delete a breakpoint.reboot()Return target control to the target boot ROMs, then reset the target server and reattach the shell.bootChange()Modify the saved values of boot parameters (see 2.5.4 Description of Boot Parameters, p.41).sysSuspend()If supported by the target-agent configuration, enter system mode. See 6.2.6 Using the Shell for System Mode Debugging, p.169.sysResume()If supported by the target agent (and if system mode is in effect),return to task mode from system mode.agentModeShow()Show the agent mode (system or task).sysStatusShow()Show the system context status (suspended or running).quit()Dismiss the shell.exit()Dismiss the shell. Shell对于交互模式的开发的一个最大有用特征是它的动态连接器。通过使用命令ld(),你能下载并连接应用程序中更新的部分。由于连接是动态的,你只需重建应用程序中特定的一部分,而不是整个应用程序。下载过程可以被取消(CTRL+C),动态连接在编程指南中有进一步的描述。配置与创建:命令m()提供了一种以交互的方式配置目标机内存的方法。该组中剩下的命令用于断点和单步调试。你可以对任何的指令设置断点,当目标机的应用程序运行到该断点时将被悬挂,在shell上显示一条消息。在该断点,你可以检查任务寄存器、进行任务跟踪,等。然后可以删除任务、继续执行任务或进行单步调试。 如果从shell中调用的例程碰到了断点,它与其它的例程一样被悬挂,但为了使你能够重新获得对shell的控制权,这些被悬挂的例程在shell中被当作已经返回了0处理,然而这些被悬挂的例程还是可以被检查。当你使用命令s()对任务进行单步调试时,任务执行一条机器指令,然后悬挂。Shell显示任务所有的寄存器和该任务下一条要执行的指令。 你可以使用命令bh()在任何指令和数据元素处设置硬件断点。指令硬件断点可以调试ROM和flash EPROM中的代码。如果你想在程序访问了一特定地址时终止执行,则数据硬件断点(观察点)非常有用。硬件断点在Intel x86, Intel i960(CX/JX/HX), MIPSR4650和一些PPC处理器 (PPC860, PPC603, PPC604, PPC403)上可用。命令bh()的参数是体系指定的。更详细的信息可以运行help() ,你可以设置的硬件断点数是由硬件决定的,如果你超出了最大的断点数,将导致错误。.C+ 开发:Windsh的一些命令是为C+应用程序设置的,下表总结了这些命令,进一步的讨论,请参考VxWorks Programmers Guide: C+ Development.WindSh Commands for C+ Development:命令功能描述cplusCtors()Call static constructors manually.cplusDtors()Call static destructors manually.cplusStratShow()Report on whether current constructor/destructor strategy is manual or automatic.cplusXtorSet()Set constructor/destructor strategy.此外,你可以在一个特定的shell中使用Tcl例程shConfig来设置环境变量LD_CALL_XTORS。这使你在shell中能使用与目标机中不同的C+策略。对象显示:下表总结了WindSh中用来显示VxWorks对象的命令,浏览工具browser提供类似的功能,此外浏览工具的窗口有周期更新的能力。详细描述请见Browser工具使用方法。命令功能show()Print information on a specified object in the shell window.browse()Display a specified object in the Tornado browser.classShow()Show information about a class of VxWorks kernel objects. List available classes with: - lkup ClassIdtaskShow()Display information from a tasks TCB.taskCreateHookShow()Show the list of task create routines.taskDeleteHookShow() show the list of task delete routines.taskRegsShow()Display the contents of a tasks registers.taskSwitchHookShow()Show the list of task switch routines.taskWaitShow()Show information about the object a task is pended on. Note that taskWaitShow() cannot give object IDs for POSIX semaphores or message queues.semShow()Show information about a semaphore.semPxShow()Show information about a POSIX semaphore.wdShow()Show information about a watchdog timer.msgQShow()Show information about a message queue.mqPxShow()Show information about a POSIX message queue.iosDrvShow()Display a list of system drivers.iosDevShow()Display the list of devices in the system.iosFdShow()Display a list of file descriptor names in the system.memPartShow()Show partition blocks and statistics.memShow()Display the total amount of free and allocated space in the system partition, the number of free and allocated fragments,the average free and allocated fragment sizes, and the maximum free fragment size. Show current as well as cumulative values.With an argument of 1, also display the free list of the system partition.smMemShow()Display the amount of free space and statistics on memory-block allocation for the shared-memory system partition.smMemPartShow()Display the amount of free space and statistics on memory-block allocation for a specified shared-memory partition.moduleShow()Show the current status for all the loaded modules.moduleIdFigure()Report a loaded modules module ID, given its VecShow()Display the interrupt vector table. This routine displays information about the given vector or the whole interrupt vector table if vector is equal to -1. Note that intVecShow() is not supported on architectures such as ARM and PowerPC that do not use interrupt vectors.网络状态显示:下表总结了windsh中用来显示VxWorks网络信息的命令:命令功能描述hostShow()Display the host table.icmpstatShow()Display statistics for ICMP (Internet Control Message Protocol).ifShow()Display the attached network interfaces.inetstatShow()Display all active connections for Internet protocol sockets.ipstatShow()Display IP statistics.routestatShow()Display routing statistics.tcpstatShow()Display all statistics for the TCP protocol.tftpInfoShow()Get TFTP status information.udpstatShow()Display statistics for the UDP protocol.要使特定协议的命令可用,则该协议必须包含在VxWorks配置中。解决主机和目标机的名字冲突: 如果你调用一个主机shell中存在的命令名字,shell总是激活该命令,即使目标机中存在相同名字的例程。然而在某些情况下你可能需要调用目标机上的同名例程,在这种情况下,你可以在命令前假如一前缀来表示执行目标机上的该命令。例如,如果你想执行主机上的例程i(),你应该使用下面的命令i()。从shell中运行目标机例程: 从SHELL中可以访问目标机中的所有例程,包括VxWorks例程和你自己的应用程序例程。于是shell提供了一种强大的使用主机资源的工具来调试和检

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论