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.
This commit is contained in:
parent
591f19e89b
commit
8de20a37d6
12 changed files with 74 additions and 25 deletions
|
@ -1,3 +1,23 @@
|
|||
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:
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
12
gdb/symtab.c
12
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;
|
||||
|
|
Loading…
Reference in a new issue