[4/10] RFC: follow-on to fix PR c++/11990

Tom Tromey tromey@redhat.com
Wed Mar 6 21:25:00 GMT 2013


This is a follow-on to the 11990 fix.

A subsequent patch will want to look up a typeinfo symbol for a type.
However, this will not work if the typeinfo symbol has a version.

This patch arranges for us to install a duplicate symbol when a default
versioned symbol is seen.  That is, for "foo@@VERS", we will install two
symbols, "foo@@VERS" and "foo".  This lets typeinfo lookup succeed.

I'd appreciate comments on this.  It isn't an area I know well.

Tom

	* elfread.c (elf_symtab_read): Install versioned symbol under
	unversioned name as well.
---
 gdb/elfread.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/gdb/elfread.c b/gdb/elfread.c
index 4520209..424624e 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -576,6 +576,21 @@ elf_symtab_read (struct objfile *objfile, int type,
 	      gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
 	    }
 
+	  /* If we see a default versioned symbol, install it under
+	     its version-less name.  */
+	  if (msym != NULL)
+	    {
+	      const char *atsign = strchr (sym->name, '@');
+
+	      if (atsign != NULL && atsign[1] == '@' && atsign > sym->name)
+		{
+		  int len = atsign - sym->name;
+
+		  record_minimal_symbol (sym->name, len, 1, symaddr,
+					 ms_type, sym->section, objfile);
+		}
+	    }
+
 	  /* For @plt symbols, also record a trampoline to the
 	     destination symbol.  The @plt symbol will be used in
 	     disassembly, and the trampoline will be used when we are
-- 
1.7.7.6



More information about the Gdb-patches mailing list