温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Shell中Debug命令怎么用

发布时间:2021-10-19 17:39:39 来源:亿速云 阅读:496 作者:小新 栏目:互联网科技

小编给大家分享一下Shell中Debug命令怎么用,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

使用Host的Target Server与Target的WDB Agent连接后,既可以使用  Workbench的Debugger进行图形化的在线调试,也可以使用  Host Shell的gdb进行命令行的调试。  
如果没有Target Connection呢?其实VxWorks还提供了一个专门用在Shell里的dbgLib - debugging facilities(INCLUDE_DEBUG)
-> dbgHelpb                               Display breakpoints and eventpointsb         addr[,task[,count [,quiet]]]                                Set breakpointbi        [bpId]                Display breakpoint(s) detailed informatione         addr[,eventNo[,task[,func[,arg]]]]] Set eventpointdprintf   addr,task,count,fmtStr[,args]                                Set dynamic printf eventpointbd        addr[,task]           Delete breakpointbdall     [task]                Delete all breakpoints and eventpointsc         [task[,addr[,addr1]]] Continue from breakpointcret      [task]                Continue to subroutine returns         [task[,addr[,addr1]]] Single stepso        [task]                Single step/step over subroutinel         [adr[,nInst]]         List disassembled memorytt        [task]                Do stack trace on taskhdprintf  addr,access,task,count,fmtStr[,args]                                Set hardware dynamic printf eventpoint                                (bh() help entry lists access modes)bh addr[,access[,task[,count[,quiet]]]] Set hardware breakpoint         access :      0 - instruction        1 - write 1 byte                       3 - read/write 1 byte  5 - write 2 bytes                       7 - read/write 2 bytes d - write 4 bytes                       f - read/write 4 bytes 9 - write 8 bytes                       b - read/write 8 bytes

写个小栗子

#include <stdio.h>
void eee(){    printf("!%s\n", __FUNCTION__);    }void ddd(){    printf("!%s\n", __FUNCTION__);    eee();    }void ccc(){    printf("!%s\n", __FUNCTION__);    ddd();    }void bbb(){    printf("!%s\n", __FUNCTION__);    ccc();    }void aaa(){    printf("!%s\n", __FUNCTION__);    bbb();    }

用它来试试这个dbgLib的操作

先加个断点,例如在bbb()的位置

Shell中Debug命令怎么用

从aaa()启动程序,新任务会在bbb()处停住  

Shell中Debug命令怎么用

使用tt  ()看一下调用栈,使用l  ()看一下即将执行的汇编代码(尽管我也看不懂)  

Shell中Debug命令怎么用

使用dprintf()加个动态事件点,例如在ddd()的位置

Shell中Debug命令怎么用

使用c()让程序执行到下一个断点或结束  

Shell中Debug命令怎么用

以上是“Shell中Debug命令怎么用”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI