diff options
-rw-r--r-- | gdb/ChangeLog | 20 | ||||
-rw-r--r-- | gdb/c-lang.c | 2 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 4 | ||||
-rw-r--r-- | gdb/cp-support.c | 10 | ||||
-rw-r--r-- | gdb/cp-support.h | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 14 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 5 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 17 | ||||
-rw-r--r-- | gdb/jv-lang.c | 3 | ||||
-rw-r--r-- | gdb/jv-typeprint.c | 5 | ||||
-rw-r--r-- | gdb/language.c | 3 | ||||
-rw-r--r-- | gdb/symtab.c | 12 |
12 files changed, 74 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a2a435c..4e0ac4b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,25 @@ 2013-04-15 Tom Tromey <tromey@redhat.com> + PR c++/11990: + * c-lang.c (cplus_language_defn): Use gdb_demangle. + * c-typeprint.c (c_type_print_base): Use gdb_demangle. + * cp-support.c (mangled_name_to_comp): Use gdb_demangle. + (gdb_demangle): New function. + * cp-support.h (gdb_demangle): Declare. + * dwarf2read.c (dwarf2_physname, fixup_partial_die) + (dwarf2_name): Use gdb_demangle. + * gdbtypes.c (check_stub_method): Use gdb_demangle. + * gnu-v3-abi.c (gnuv3_rtti_type): Strip @plt and version + suffixes from name. + (gnuv3_print_method_ptr): Use gdb_demangle. + * jv-lang.c (java_demangle): Use gdb_demangle. + * jv-typeprint.c (java_type_print_base): Use gdb_demangle. + * language.c (unk_lang_demangle): Use gdb_demangle. + * symtab.c (symbol_find_demangled_name) + (demangle_for_lookup): Use gdb_demangle. + +2013-04-15 Tom Tromey <tromey@redhat.com> + PR c++/12824: * NEWS: Update. * breakpoint.c (enum exception_event_kind) <EX_EVENT_RETHROW>: diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 1c1d60b..6f9d392 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -959,7 +959,7 @@ const struct language_defn cplus_language_defn = "this", /* name_of_this */ cp_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ cp_lookup_transparent_type, /* lookup_transparent_type */ - cplus_demangle, /* Language specific symbol demangler */ + gdb_demangle, /* Language specific symbol demangler */ cp_class_name_from_physname, /* Language specific class_name_from_physname */ c_op_print_tab, /* expression operators for printing */ diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index ca8d89b..bf4564f 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1227,8 +1227,8 @@ c_type_print_base (struct type *type, struct ui_file *stream, mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j); demangled_name = - cplus_demangle (mangled_name, - DMGL_ANSI | DMGL_PARAMS); + gdb_demangle (mangled_name, + DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) { /* In some cases (for instance with the HP diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 22e8fc4..3c1442d 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -635,7 +635,7 @@ mangled_name_to_comp (const char *mangled_name, int options, /* If it doesn't, or if that failed, then try to demangle the name. */ - demangled_name = cplus_demangle (mangled_name, options); + demangled_name = gdb_demangle (mangled_name, options); if (demangled_name == NULL) return NULL; @@ -1476,6 +1476,14 @@ cp_lookup_rtti_type (const char *name, struct block *block) return rtti_type; } +/* A wrapper for bfd_demangle. */ + +char * +gdb_demangle (const char *name, int options) +{ + return bfd_demangle (NULL, name, options); +} + /* Don't allow just "maintenance cplus". */ static void diff --git a/gdb/cp-support.h b/gdb/cp-support.h index c7141d5..0f2cebb 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -241,4 +241,8 @@ extern struct demangle_parse_info *cp_new_demangle_parse_info (void); extern struct cmd_list_element *maint_cplus_cmd_list; +/* A wrapper for bfd_demangle. */ + +char *gdb_demangle (const char *name, int options); + #endif /* CP_SUPPORT_H */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 9f10a0d..8947f8f 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7763,11 +7763,11 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) } else { - demangled = cplus_demangle (mangled, - (DMGL_PARAMS | DMGL_ANSI - | (cu->language == language_java - ? DMGL_JAVA | DMGL_RET_POSTFIX - : DMGL_RET_DROP))); + demangled = gdb_demangle (mangled, + (DMGL_PARAMS | DMGL_ANSI + | (cu->language == language_java + ? DMGL_JAVA | DMGL_RET_POSTFIX + : DMGL_RET_DROP))); } if (demangled) { @@ -14154,7 +14154,7 @@ fixup_partial_die (struct partial_die_info *part_die, { char *demangled; - demangled = cplus_demangle (part_die->linkage_name, DMGL_TYPES); + demangled = gdb_demangle (part_die->linkage_name, DMGL_TYPES); if (demangled) { const char *base; @@ -17214,7 +17214,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) /* Avoid demangling DW_STRING (attr) the second time on a second call for the same DIE. */ if (!DW_STRING_IS_CANONICAL (attr)) - demangled = cplus_demangle (DW_STRING (attr), DMGL_TYPES); + demangled = gdb_demangle (DW_STRING (attr), DMGL_TYPES); if (demangled) { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index a1c4018..d19c593 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -37,6 +37,7 @@ #include "gdb_assert.h" #include "hashtab.h" #include "exceptions.h" +#include "cp-support.h" /* Initialize BADNESS constants. */ @@ -1764,8 +1765,8 @@ check_stub_method (struct type *type, int method_id, int signature_id) struct gdbarch *gdbarch = get_type_arch (type); struct fn_field *f; char *mangled_name = gdb_mangle_name (type, method_id, signature_id); - char *demangled_name = cplus_demangle (mangled_name, - DMGL_PARAMS | DMGL_ANSI); + char *demangled_name = gdb_demangle (mangled_name, + DMGL_PARAMS | DMGL_ANSI); char *argtypetext, *p; int depth = 0, argcount = 1; struct field *argtypes; diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index ee01f52..b3585a6 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -283,6 +283,7 @@ gnuv3_rtti_type (struct value *value, const char *class_name; struct type *run_time_type; LONGEST offset_to_top; + char *atsign; /* We only have RTTI for class objects. */ if (TYPE_CODE (values_type) != TYPE_CODE_CLASS) @@ -327,6 +328,18 @@ gnuv3_rtti_type (struct value *value, } class_name = vtable_symbol_name + 11; + /* Strip off @plt and version suffixes. */ + atsign = strchr (class_name, '@'); + if (atsign != NULL) + { + char *copy; + + copy = alloca (atsign - class_name + 1); + memcpy (copy, class_name, atsign - class_name); + copy[atsign - class_name] = '\0'; + class_name = copy; + } + /* Try to look up the class name as a type name. */ /* FIXME: chastain/2003-11-26: block=NULL is bogus. See pr gdb/1465. */ run_time_type = cp_lookup_rtti_type (class_name, NULL); @@ -593,8 +606,8 @@ gnuv3_print_method_ptr (const gdb_byte *contents, possible paths to the method based on the adjustment. */ if (physname) { - char *demangled_name = cplus_demangle (physname, - DMGL_ANSI | DMGL_PARAMS); + char *demangled_name = gdb_demangle (physname, + DMGL_ANSI | DMGL_PARAMS); fprintf_filtered (stream, "&virtual "); if (demangled_name == NULL) diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 00818f6..1ef1296 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -39,6 +39,7 @@ #include "gdb_assert.h" #include "charset.h" #include "valprint.h" +#include "cp-support.h" /* Local functions */ @@ -1010,7 +1011,7 @@ nosideret: static char *java_demangle (const char *mangled, int options) { - return cplus_demangle (mangled, options | DMGL_JAVA); + return gdb_demangle (mangled, options | DMGL_JAVA); } /* Find the member function name of the demangled name NAME. NAME diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c index 69ebf5a..23b3f4e 100644 --- a/gdb/jv-typeprint.c +++ b/gdb/jv-typeprint.c @@ -28,6 +28,7 @@ #include "typeprint.h" #include "c-lang.h" #include "cp-abi.h" +#include "cp-support.h" #include "gdb_assert.h" /* Local functions */ @@ -286,8 +287,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show, mangled_name = physname; demangled_name = - cplus_demangle (mangled_name, - DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); + gdb_demangle (mangled_name, + DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); if (demangled_name == NULL) demangled_name = xstrdup (mangled_name); diff --git a/gdb/language.c b/gdb/language.c index c873f2e..10073e1 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -43,6 +43,7 @@ #include "jv-lang.h" #include "demangle.h" #include "symfile.h" +#include "cp-support.h" extern void _initialize_language (void); @@ -764,7 +765,7 @@ static CORE_ADDR unk_lang_trampoline (struct frame_info *frame, CORE_ADDR pc) /* Unknown languages just use the cplus demangler. */ static char *unk_lang_demangle (const char *mangled, int options) { - return cplus_demangle (mangled, options); + return gdb_demangle (mangled, options); } static char *unk_lang_class_name (const char *mangled) diff --git a/gdb/symtab.c b/gdb/symtab.c index cf4a476..def556b 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -596,7 +596,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, || gsymbol->language == language_auto) { demangled = - cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); + gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); if (demangled != NULL) { gsymbol->language = language_cplus; @@ -606,8 +606,8 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, if (gsymbol->language == language_java) { demangled = - cplus_demangle (mangled, - DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); + gdb_demangle (mangled, + DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); if (demangled != NULL) { gsymbol->language = language_java; @@ -1160,7 +1160,7 @@ demangle_for_lookup (const char *name, enum language lang, lookup, so we can always binary search. */ if (lang == language_cplus) { - demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); + demangled_name = gdb_demangle (name, DMGL_ANSI | DMGL_PARAMS); if (demangled_name) { modified_name = demangled_name; @@ -1180,8 +1180,8 @@ demangle_for_lookup (const char *name, enum language lang, } else if (lang == language_java) { - demangled_name = cplus_demangle (name, - DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); + demangled_name = gdb_demangle (name, + DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); if (demangled_name) { modified_name = demangled_name; |