This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch by Michael Matz] Re: archer gdb and gcc 4.1 globalnamespace DIE

Hi Sami,

sending a followup with patch I got.

--- Begin Message ---

(it's my understanding that Richard already mentioned this, but anyway)
due to 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.

Index: gdb-
--- gdb-	2009-05-13 15:53:22.000000000 +0200
+++ gdb-	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 ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]