我可以防止调试器进入Boost或STL头文件吗? [英] Can I prevent debugger from stepping into Boost or STL header files?

查看:142
本文介绍了我可以防止调试器进入Boost或STL头文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Qt Creator与gdb在Linux平台上调试我的C ++代码。每当我使用 boost :: shared_ptr 等时,调试器将进入包含boost实现的头文件(即/ usr / include / boost /shared_ptr.hpp )。我想在调试方面忽略这些文件,并简单地介绍它们。我知道一旦达到这些文件之一,我就可以退出,但是每个调试会话几次都不需要这么做就可以很容易地进行调试。



我使用的是在使用QtCreator 2.2的OpenSuSE Linux 11.2上运行的gcc编译器( g ++ gdb 作为调试器。)



编辑添加:该问题面向Boost文件,但也可以应用也是STL文件。

解决方案

gdb是可编写脚本的。它具有while,if,variable,shell子命令,用户定义的函数(define)等等,它具有可编写脚本的python接口。



有一点工作,你可以按照这些方式制作gdb脚本:

 定义step-bypass-boost 
step
while 1
使用info source,将源文件放入变量
,如果源文件不匹配* / boost / *然后
break-loop
end
step
end
end

或查找是否有人已经制作了这样的脚本


I'm using Qt Creator with gdb to debug my C++ code on a Linux Platform. Whenever I use a boost::shared_ptr or the like, the debugger steps into the header files containing the boost implementation (i.e. /usr/include/boost/shared_ptr.hpp). I would like to ignore these files in terms of debugging and simply step over them. I know that I can step out as soon as it reaches one of these files, but it would be much easier to debug without doing so several times per debugging session.

I'm using the gcc compiler (g++), running on OpenSuSE Linux 11.2 with QtCreator 2.2 (which uses gdb as the debugger.)

Edit to add: The question is geared toward Boost files, but could also apply toward STL files as well.

解决方案

gdb is scriptable. it has while, if, variables, shell subcommands, user-defined functions (define) etc etc. it has python interface for scriptability.

With a bit of work, you can to make gdb script along these lines:

define step-bypass-boost
  step
  while 1
    use "info source", put current source file into variable
    if source file does not match */boost/* then
        break-loop
    end
    step
  end
end

or find whether somebody already made such script

这篇关于我可以防止调试器进入Boost或STL头文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆