简体   繁体   中英

weird gdb message when debugging C++ program

I use the apple's gdb, version as follow

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".

I don't use Xcode IDE since for my needs makefile-managed projects are more convenient, especially because I often need to compile and run programs on remote machines. I have recently started to use the following c++11 features (on g++-4.6 and 4.7 from macports): move constructors, nullptr, auto and decltype. I rencently needed to d3bug my code, and the following weird message appeared instead of stepping into a function:

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

from since this message appears, all following gdb commands are answered by the same weird message, so it is not possible to debug anymore. It seems something related to c++11. My question is, have you ever encountered this message, and how to get rid of it?

Thanks in advance

Giuliano

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

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.

But you already knew that, because everyone reads the release notes when they upgrade their compiler, right?! ;-)

The version of GDB you're using (Apple's version) doesn't seem to support the newer features of the compiler you installed from macports.

The error message is reporting that GDB doesn't understand some of the debugging information it's encountered in the program. The debugging information it has shown is a C++11 feature.

The solution is to either upgrade to a newer GDB (probably from macports if there's one there), not use the features that GDB doesn't understand, or accept that the version of GDB you have won't be able to understand this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM