* 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++/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>:
"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 */
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
/* 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;
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
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 */
}
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)
{
{
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;
/* 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)
{
#include "gdb_assert.h"
#include "hashtab.h"
#include "exceptions.h"
+#include "cp-support.h"
/* Initialize BADNESS constants. */
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;
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)
}
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);
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)
#include "gdb_assert.h"
#include "charset.h"
#include "valprint.h"
+#include "cp-support.h"
/* Local functions */
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
#include "typeprint.h"
#include "c-lang.h"
#include "cp-abi.h"
+#include "cp-support.h"
#include "gdb_assert.h"
/* Local functions */
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);
#include "jv-lang.h"
#include "demangle.h"
#include "symfile.h"
+#include "cp-support.h"
extern void _initialize_language (void);
/* 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)
|| 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;
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;
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;
}
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;