--- Begin Message ---
- From: Michael Matz <matz at suse dot de>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Richard Guenther <rguenther at suse dot de>
- Date: Wed, 13 May 2009 16:44:53 +0200 (CEST)
- Subject: Support bogus global namespace emitted by g++ 4.1
Hi,
(it's my understanding that Richard already mentioned this, but anyway)
due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28460 some old G++ emit
an explicit namespace declaration for the global namespace for some decls.
This is bogus and indeed confuses gdb (not the current CVS it seems, but
the archer branch at least). Unfortunately we now have to deal with this
in gdb as the bogus debug info is already out there.
So, here's a patch for that. I saw two options:
(1) hacking determine_prefix to return "" when it was just about to
return "::" for namespaces.
(2) not even linking that bogus namespace DIE into its children
It seems to me that option (2) is slightly more clear, so that's what I've
chosen. It works with the simple testcases I have using global decls.
Let me know what you think.
Ciao,
Michael.
--
Index: gdb-6.8.50.20090302/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.50.20090302.orig/gdb/dwarf2read.c 2009-05-13 15:53:22.000000000 +0200
+++ gdb-6.8.50.20090302/gdb/dwarf2read.c 2009-05-13 16:40:44.000000000 +0200
@@ -6540,6 +6540,13 @@ load_partial_dies (bfd *abfd, gdb_byte *
/* We'll save this DIE so link it in. */
part_die->die_parent = parent_die;
+ /* Special hack for bogus global namespace that is emitted as an
+ explicit namespace with the name '::' in g++ 4.1, for some decls. */
+ if (parent_die && parent_die->name && parent_die->die_parent == NULL
+ && parent_die->name[0] == ':'
+ && parent_die->name[1] == ':'
+ && parent_die->name[2] == 0)
+ part_die->die_parent = NULL;
part_die->die_sibling = NULL;
part_die->die_child = NULL;
--- End Message ---