[PATCH] Mangling, take 2

Elena Zannoni ezannoni@cygnus.com
Thu Oct 12 12:35:00 GMT 2000


I committed this one as well. With a ChangeLog entry!

Elena


Daniel Berlin writes:
 > This should be correct.
 > I don't have the changelogs handy to paste, I finally just checked out 5
 > seperate copies of the gdb tree so I could do rediffs there.
 > 
 > 
 > Any problems with this one that I missed?
 > Index: symtab.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.c,v
 > retrieving revision 1.15
 > diff -c -3 -p -r1.15 symtab.c
 > *** symtab.c	2000/09/04 08:29:25	1.15
 > --- symtab.c	2000/10/11 03:50:53
 > *************** gdb_mangle_name (struct type *type, int 
 > *** 296,301 ****
 > --- 303,311 ----
 >     char buf[20];
 >     int len = (newname == NULL ? 0 : strlen (newname));
 >   
 > +   if (OPNAME_PREFIX_P (field_name))
 > +     return xstrdup(physname);
 > + 
 >     is_full_physname_constructor =
 >       ((physname[0] == '_' && physname[1] == '_' &&
 >         (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
 > *************** gdb_mangle_name (struct type *type, int 
 > *** 331,357 ****
 >         sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
 >       }
 >     mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
 > ! 		      + strlen (buf) + len
 > ! 		      + strlen (physname)
 > ! 		      + 1);
 >   
 > -   /* Only needed for GNU-mangled names.  ANSI-mangled names
 > -      work with the normal mechanisms.  */
 > -   if (OPNAME_PREFIX_P (field_name))
 >       {
 > -       const char *opname = cplus_mangle_opname (field_name + 3, 0);
 > -       if (opname == NULL)
 > - 	error ("No mangling for \"%s\"", field_name);
 > -       mangled_name_len += strlen (opname);
 >         mangled_name = (char *) xmalloc (mangled_name_len);
 > - 
 > -       strncpy (mangled_name, field_name, 3);
 > -       mangled_name[3] = '\0';
 > -       strcat (mangled_name, opname);
 > -     }
 > -   else
 > -     {
 > -       mangled_name = (char *) xmalloc (mangled_name_len);
 >         if (is_constructor)
 >   	mangled_name[0] = '\0';
 >         else
 > --- 341,350 ----
 >         sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
 >       }
 >     mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
 > ! 		      + strlen (buf) + len + strlen (physname) + 1);
 >   
 >       {
 >         mangled_name = (char *) xmalloc (mangled_name_len);
 >         if (is_constructor)
 >   	mangled_name[0] = '\0';
 >         else
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.h,v
 > retrieving revision 1.13
 > diff -c -3 -p -r1.13 symtab.h
 > *** symtab.h	2000/08/07 15:02:48	1.13
 > --- symtab.h	2000/10/11 03:50:53
 > *************** extern CORE_ADDR symbol_overlayed_addres
 > *** 170,175 ****
 > --- 170,177 ----
 >   #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack)			\
 >     do {									\
 >       char *demangled = NULL;						\
 > +     if (SYMBOL_LANGUAGE (symbol) == language_unknown)                 \
 > +           SYMBOL_LANGUAGE(symbol) = language_auto;                    \
 >       if (SYMBOL_LANGUAGE (symbol) == language_cplus			\
 >   	|| SYMBOL_LANGUAGE (symbol) == language_auto)			\
 >         {									\
 > *************** extern CORE_ADDR symbol_overlayed_addres
 > *** 222,231 ****
 >   	    SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL;		\
 >   	  }								\
 >         }									\
 > -     if (SYMBOL_LANGUAGE (symbol) == language_auto)			\
 > -       {									\
 > - 	SYMBOL_LANGUAGE (symbol) = language_unknown;			\
 > -       }									\
 >     } while (0)
 >   
 >   /* Macro that returns the demangled name for a symbol based on the language
 > --- 224,229 ----
 > *************** struct partial_symtab
 > *** 1047,1059 ****
 >   #define VTBL_FNADDR_OFFSET 2
 >   
 >   /* Macro that yields non-zero value iff NAME is the prefix for C++ operator
 > !    names.  If you leave out the parenthesis here you will lose!
 > !    Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
 > !    symbol-file and the names in gdb's symbol table.
 > !    Note that this macro is g++ specific (FIXME). */
 > ! 
 >   #define OPNAME_PREFIX_P(NAME) \
 > !   ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
 >   
 >   /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
 >      names.  Note that this macro is g++ specific (FIXME).
 > --- 1045,1053 ----
 >   #define VTBL_FNADDR_OFFSET 2
 >   
 >   /* Macro that yields non-zero value iff NAME is the prefix for C++ operator
 > !    names.  If you leave out the parenthesis here you will lose!  */
 >   #define OPNAME_PREFIX_P(NAME) \
 > !   (!strncmp(NAME,"operator",8))
 >   
 >   /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
 >      names.  Note that this macro is g++ specific (FIXME).
 > 
 > 
 > 


More information about the Gdb-patches mailing list