您的位置:首页 > 运维架构 > Linux

Vs2013在Linux开发中的应用(25):曙光

2014-12-31 21:52 399 查看
快乐虾http://blog.csdn.net/lights_joy/欢迎转载,但请保留作者信息在SDM接收到断点命中的消息时,它将停止调试过程,然后获取程序状态,第一个要做的就是线程列表:
// EnumThreads is called by the debugger when it needs to enumerate the threads in the program.
        public int EnumThreads(out IEnumDebugThreads2 ppEnum)

在此需要填充线程的所有信息,由于在检测到线程创建时已经保存了线程信息,这里直接填充就可以了。紧接着要处理:
// Retrieves a list of the stack frames for this thread.
        // We currently call into the process and get the frames.  We might want to cache the frame info.
        int IDebugThread2.EnumFrameInfo(enum_FRAMEINFO_FLAGS dwFieldSpec, uint nRadix, out IEnumDebugFrameInfo2 enumObject) {

这个可以使用gdb的命令完成:-thread-select 1
^done,new-thread-id="1",frame={level="0",addr="0x0805fc75",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffff6e4"}],file="../../app/rc/rc.c",fullname="/mnt/hgfs/nvs_dev/src/ipc/app/rc/rc.c",line="1565"}
-stack-info-frame
^done,frame={level="0",addr="0x0805fc75",func="main",file="../../app/rc/rc.c",fullname="/mnt/hgfs/nvs_dev/src/ipc/app/rc/rc.c",line="1565"}
-stack-list-frames
^done,stack=[frame={level="0",addr="0x0805fc75",func="main",file="../../app/rc/rc.c",fullname="/mnt/hgfs/nvs_dev/src/ipc/app/rc/rc.c",line="1565"}]
至此,我们已经可以看到VS正确地在断点的位置停下来了:



看看调用堆栈:


似乎语言填得有点问题,应该是C/C++才对!局部变量:



模块窗口:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: