c++ - 调试 C++ 程序时出现奇怪的 gdb 消息

标签 c++ c++11 gdb osx-snow-leopard

我用的是苹果的gdb,版本如下

GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul  3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".

我不使用 Xcode IDE,因为对于我的需要,makefile 管理的项目更方便,尤其是因为我经常需要在远程机器上编译和运行程序。我最近开始使用以下 c++11 功能(在 macports 的 g++-4.6 和 4.7 上):移动构造函数、nullptr、auto 和 decltype。我最近需要对我的代码进行 d3bug,但出现了以下奇怪的消息,而不是进入函数:

Die: DW_TAG_unspecified_type (abbrev = 36, offset = 4315)
        has children: FALSE
        attributes:
                DW_AT_name (DW_FORM_string) string: "decltype(nullptr)"

自从出现此消息后,所有后续的 gdb 命令都得到相同的奇怪消息的答复,因此无法再进行调试。它似乎与 c++11 有关。我的问题是,你有没有遇到过这个消息,如何摆脱 它的?

提前致谢

朱利亚诺

最佳答案

http://gcc.gnu.org/gcc-4.5/changes.html

GCC now generates unwind info also for epilogues. DWARF debuginfo generated by GCC now uses more features of DWARF3 than before, and also some DWARF4 features. GDB older than 7.0 is not able to handle either of these, so to debug GCC 4.5 generated binaries or libraries GDB 7.0 or later is needed. You can disable use of DWARF4 features with the -gdwarf-3 -gstrict-dwarf options, or use -gdwarf-2 -gstrict-dwarf to restrict GCC to just DWARF2, but epilogue unwind info is emitted unconditionally whenever unwind info is emitted.

但是您已经知道了,因为每个人在升级编译器时都会阅读发行说明,对吧?! ;-)

关于c++ - 调试 C++ 程序时出现奇怪的 gdb 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10621461/

相关文章:

c - 使用计时器/信号进行调试始终以 <timer_settime+16> 结束

c++ - 具有抽象参数的抽象工厂?

c++ - 我应该看到 std::bind 和 boost::bind 之间的显着差异吗?

c++ - 关于如何识别 Rvalue 或 Lvalue 引用和 if-it-has-a-name 规则

c++ - 在 gdb 中使用核心转储时,我如何确切知道哪个线程导致了 SIGSEGV?

android - Android NDK 的 ARM NEON 调试

c++ - native c++ 编译器和 .net c++ 编译器有什么区别?

c++ - 反对 Json 并返回

c++ - 关于应用程序速度,最好的 C++ 编译器和 Windows 构建选项?

c++ - unique_copy 元素值从 map 到 vector