Vs2013在Linux开发中的应用(27):线程列表
2015-01-02 12:09
543 查看
快乐虾http://blog.csdn.net/lights_joy/欢迎转载,但请保留作者信息
在gdb加载应用程序并运行时,可以检测到线程的创建,我们将此消息以事件的形式通知了SDM。因此当中断发生时,对于每一个线程,VS的SDM将调用我们的回调:
双击可以查看线程的栈列表:
这里存在的一个问题是速度,当线程比较多的时候(44个),刷新一次居然要将近5秒,看来需要改进gdb命令调用的方式。
在gdb加载应用程序并运行时,可以检测到线程的创建,我们将此消息以事件的形式通知了SDM。因此当中断发生时,对于每一个线程,VS的SDM将调用我们的回调:
// 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) { if(_debuggedThread.Id == -1) { enumObject = null; return VSConstants.E_FAIL; } IList<PythonStackFrame> stackFrames = new List<PythonStackFrame>(); string info = _debuggedThread.Process.ExecCommand("-thread-select " + _debuggedThread.Id.ToString()); int depth = GetStackInfoDepth(); for (int i = 0; i < depth; i++ ) { PythonStackFrame frm = GetStackInfo(i); stackFrames.Add(frm); } _debuggedThread.Frames = stackFrames; int numStackFrames = stackFrames.Count; FRAMEINFO[] frameInfoArray; frameInfoArray = new FRAMEINFO[numStackFrames]; for (int i = 0; i < numStackFrames; i++) { AD7StackFrame frame = new AD7StackFrame(_engine, this, stackFrames[i]); frame.SetFrameInfo(dwFieldSpec, out frameInfoArray[i]); } enumObject = new AD7FrameInfoEnum(frameInfoArray); return VSConstants.S_OK; }在此我们填上了此线程中的栈信息,而后SDM还将针对栈的每一层调用查询更进一步的信息,如局部变量、函数参数等,按照接口的要求返回之后就可以在VS下看到线程列表的信息了:
双击可以查看线程的栈列表:
这里存在的一个问题是速度,当线程比较多的时候(44个),刷新一次居然要将近5秒,看来需要改进gdb命令调用的方式。
相关文章推荐
- Vs2013在Linux开发中的应用(21): 线程创建
- Vs2013在Linux开发中的应用(24):触发断点
- Vs2013在Linux开发中的应用(26):表达式计算
- Vs2013在Linux开发中的应用(36):Milestone-0.1.0
- Vs2013在Linux开发中的应用(23):信息输出
- Vs2013在Linux开发中的应用(33):反汇编
- Vs2013在Linux开发中的应用(29):寄存器信息
- Vs2013在Linux开发中的应用(30):程序中断
- Vs2013在Linux开发中的应用(16): 修改调试器参数
- Vs2013在Linux开发中的应用(18): 应用程序调试方案
- Vs2013在Linux开发中的应用(35):Telnet支持
- Vs2013在Linux开发中的应用(32):文本可视化
- Vs2013在Linux开发中的应用(31):内存块显示
- Vs2013在Linux开发中的应用(28):单步执行
- Vs2013在Linux开发中的应用(22):模块加载
- Vs2013在Linux开发中的应用(20): 断点设置
- Vs2013在Linux开发中的应用(14): 远程调试设想
- linux入门-使用vs2015开发与调试linux下应用
- 用VS.NET开发在Linux Apache Tomcat上运行的应用
- opencv2.4.13+vs2013开发环境配置+2.4.13配置lib列表