Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 586
Giuliano Avatar asked May 16 '12 15:05

Giuliano


1 Answers

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?! ;-)

like image 176
Jonathan Wakely Avatar answered Oct 13 '22 09:10

Jonathan Wakely