我用的是苹果的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/