gdb的问题7.5.1通过g构建的调试可执行文件4.7.2 [英] Problems with gdb 7.5.1 debugging executable built via g 4.7.2

查看:172
本文介绍了gdb的问题7.5.1通过g构建的调试可执行文件4.7.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在更新我的Mac工具链,以利用C ++ 11的功能,并最终得到漂亮的打印调试的STL数据结构。我使用Homebrew来构建gcc 4.7.2编译器。我已经能够使用这个新的编译器重新编译我当前项目的源代码。但是我尝试的所有版本的gdb在设置断点,查看源代码或查看本地变量时都有各种问题。

I've been updating my Mac toolchain in order to take advantage of C++11 features and eventually get pretty-print debugging of STL data structures. I used Homebrew to build the gcc 4.7.2 compiler. I've been able to recompile the source of my current project using this new compiler. However all versions of gdb that I've tried have various problems when setting breakpoints, viewing source code or viewing local variables.

我相信的gdb版本安装为部分Xcode命令行工具,版本6.3.50,显示各种基于模板的变量有麻烦。我也建立并试图使用其他几个gdb版本(7.3.1,7.4.1& 7.5.1),但每个gdb版本有问题,使得很难不可能设置断点,查看源代码和视图变量。具体来说,这些gdb版本不知道头文件中定义的函数的源文件或行号,断点不能在这些头文件函数中设置,并且许多局部变量已经优化。

The version of gdb that I believe is installed as part of the Xcode command-line tools, version 6.3.50, has trouble displaying various template-based variables. I've also built and tried to use several other gdb versions (7.3.1, 7.4.1 & 7.5.1), but each gdb version has problems that make it difficult to impossible to set breakpoints, view source code and view variables. Specifically, these gdb versions don't know the source file or line number of functions defined in header files, breakpoints can't be set in these header-file functions, and many local variables have been "optimized out".

还有谁遇到这些问题,如果是这样,你能够解决它们吗?我应该在我的工具链中使用哪些版本以避免这些问题?

Has anybody else experienced these problems, and if so have you been able to resolve them? Which versions should I be using in my toolchain in order to avoid these problems?

为了记录,我的开发是在最近的MBP上运行最新的Mountain Lion更新。我的IDE是Eclipse Juno,CDT版本8.1.1。

For the record, my development is on a recent MBP running the latest Mountain Lion updates. My IDE is Eclipse Juno with CDT version 8.1.1. And, yes, I've code signed all versions of gdb that I've built and attempted to use.

感谢任何输入,

Bob

推荐答案


许多局部变量已经 。

many local variables have been "optimized out".

调试优化代码时会发生这种情况吗?如果是,则是预期。你可能没有看到这种情况发生之前,因为旧的GCC没有很好地优化。

Is this happening while debugging optimized code? If so, that is expected. You may not have seen this happening before, because older GCC didn't quite optimize that much.

要修复:构建你的调试代码 -g -O0 标志。

To fix: build your to-be-debugged code with -g -O0 flags.

这篇关于gdb的问题7.5.1通过g构建的调试可执行文件4.7.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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