* language.h (struct language_defn): Add la_demangle.
(language_demangle): Declare.
* language.c (language_demangle): New function.
(unk_lang_demangle): Likewise.
(unknown_language_defn, auto_language_defn, local_language_defn):
Add ukn_lang_demangle.
* ada-lang.c (ada_language_defn): Add NULL for la_demangle element.
* f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise.
* c-lang.c (c_language_defn, asm_language_defn): Likewise.
(cplus_language_defn): Add cplus_demangle for la_demangle element.
* jv-lang.c (java_demangle): New function
(java_language_defn): Use it for la_demangle element.
* objc-lang.c (objc_demangle): Add options argument
(objc_language_defn): Use objc_demangle for la_demangle element.
* maint.c (maintenance_demangle): Replace switch with
call to language_demangle.
* utils.c (fprintf_symbol_filtered): Likewise.
+2003-04-01 Adam Fedor <fedor@gnu.org>
+
+ * Makefile.in (c_lang.o, jv_lang.o, language.o): Add $(demangle_h).
+ * language.h (struct language_defn): Add la_demangle.
+ (language_demangle): Declare.
+ * language.c (language_demangle): New function.
+ (unk_lang_demangle): Likewise.
+ (unknown_language_defn, auto_language_defn, local_language_defn):
+ Add ukn_lang_demangle.
+ * ada-lang.c (ada_language_defn): Add NULL for la_demangle element.
+ * f-lang.c, m2-lang.c, p-lang.c, scm-lang.c: Likewise.
+ * c-lang.c (c_language_defn, asm_language_defn): Likewise.
+ (cplus_language_defn): Add cplus_demangle for la_demangle element.
+ * jv-lang.c (java_demangle): New function
+ (java_language_defn): Use it for la_demangle element.
+ * objc-lang.c (objc_demangle): Add options argument
+ (objc_language_defn): Use objc_demangle for la_demangle element.
+ * maint.c (maintenance_demangle): Replace switch with
+ call to language_demangle.
+ * utils.c (fprintf_symbol_filtered): Likewise.
+
2003-04-01 Andrew Cagney <cagney@redhat.com>
* printcmd.c (print_frame_nameless_args): Delete #ifdef
$(gdb_string_h) $(gdb_assert_h)
c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \
- $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h)
+ $(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \
+ $(demangle_h)
c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
$(language_h) $(demangle_h) $(c_lang_h) $(typeprint_h) $(cp_abi_h) \
jv-lang.o: jv-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(gdbtypes_h) $(symtab_h) \
$(symfile_h) $(objfiles_h) $(gdb_string_h) $(value_h) $(c_lang_h) \
- $(jv_lang_h) $(gdbcore_h) $(block_h)
+ $(jv_lang_h) $(gdbcore_h) $(block_h) $(demangle_h)
jv-typeprint.o: jv-typeprint.c $(defs_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(demangle_h) $(jv_lang_h) $(gdb_string_h) $(typeprint_h) \
$(c_lang_h) $(cp_abi_h)
$(kod_h)
language.o: language.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
$(value_h) $(gdbcmd_h) $(expression_h) $(language_h) $(target_h) \
- $(parser_defs_h) $(jv_lang_h)
+ $(parser_defs_h) $(jv_lang_h) $(demangle_h)
lin-lwp.o: lin-lwp.c $(defs_h) $(gdb_assert_h) $(gdb_string_h) $(gdb_wait_h) \
$(gdbthread_h) $(inferior_h) $(target_h) $(regcache_h) $(gdbcmd_h)
linespec.o: linespec.c $(defs_h) $(symtab_h) $(frame_h) $(command_h) \
ada_val_print, /* Print a value using appropriate syntax */
ada_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
#if 0
{"8#%lo#", "8#", "o", "#"}, /* Octal format info */
#include "gdb_assert.h"
#include "charset.h"
#include "gdb_string.h"
+#include "demangle.h"
extern void _initialize_c_language (void);
static void c_emit_char (int c, struct ui_file * stream, int quoter);
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ cplus_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
f_val_print, /* Print a value using appropriate syntax */
c_value_print, /* FIXME */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%o", "0", "o", ""}, /* Octal format info */
{"%d", "", "d", ""}, /* Decimal format info */
#include "jv-lang.h"
#include "gdbcore.h"
#include "block.h"
+#include "demangle.h"
#include <ctype.h>
struct type *java_int_type;
return c_create_fundamental_type (objfile, typeid);
}
+static char *java_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options | DMGL_JAVA);
+}
+
+
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
java_val_print, /* Print a value using appropriate syntax */
java_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ java_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
#include "target.h"
#include "parser-defs.h"
#include "jv-lang.h"
+#include "demangle.h"
extern void _initialize_language (void);
return 0;
}
+/* Return demangled language symbol, or NULL.
+ FIXME: Options are only useful for certain languages and ignored
+ by others, so it would be better to remove them here and have a
+ more flexible demangler for the languages that need it.
+ FIXME: Sometimes the demangler is invoked when we don't know the
+ language, so we can't use this everywhere. */
+char *
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options)
+{
+ if (current_language != NULL && current_language->la_demangle)
+ return current_language->la_demangle (mangled, options);
+ return NULL;
+}
+
/* Define the language that is no language. */
return 0;
}
+/* Unknown languages just use the cplus demangler. */
+static char *unk_lang_demangle (const char *mangled, int options)
+{
+ return cplus_demangle (mangled, options);
+}
+
+
static struct type **const (unknown_builtin_types[]) =
{
0
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
unk_lang_val_print, /* Print a value using appropriate syntax */
unk_lang_value_print, /* Print a top-level value */
unk_lang_trampoline, /* Language specific skip_trampoline */
+ unk_lang_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
if it isn't a language tramp for this language. */
CORE_ADDR (*skip_trampoline) (CORE_ADDR pc);
+ /* Return demangled language symbol, or NULL. */
+ char *(*la_demangle) (const char *mangled, int options);
+
/* Base 2 (binary) formats. */
struct language_format_info la_binary_format;
extern CORE_ADDR skip_language_trampoline (CORE_ADDR pc);
+/* Return demangled language symbol, or NULL. */
+extern char *language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options);
+
#endif /* defined (LANGUAGE_H) */
m2_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"%loB", "", "o", "B"}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
}
else
{
- switch (current_language->la_language)
- {
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /* demangled = objc_demangle (args); */
- /* break; */
- case language_cplus:
- default:
- demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
- break;
- }
+ demangled = language_demangle (current_language, args,
+ DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{
printf_unfiltered ("%s\n", demangled);
/* Objective-C name demangling. */
char *
-objc_demangle (const char *mangled)
+objc_demangle (const char *mangled, int options)
{
char *demangled, *cp;
c_val_print, /* Print a value using appropriate syntax */
c_value_print, /* Print a top-level value */
objc_skip_trampoline, /* Language specific skip_trampoline */
+ objc_demangle, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
extern CORE_ADDR lookup_objc_class (char *classname);
extern int lookup_child_selector (char *methodname);
-extern char *objc_demangle (const char *mangled);
+extern char *objc_demangle (const char *mangled, int options);
extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
pascal_val_print, /* Print a value using appropriate syntax */
pascal_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "%", "b", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
scm_val_print, /* Print a value using appropriate syntax */
scm_value_print, /* Print a top-level value */
NULL, /* Language specific skip_trampoline */
+ NULL, /* Language specific symbol demangler */
{"", "", "", ""}, /* Binary format info */
{"#o%lo", "#o", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
}
else
{
- switch (lang)
- {
- case language_cplus:
- demangled = cplus_demangle (name, arg_mode);
- break;
- case language_java:
- demangled = cplus_demangle (name, arg_mode | DMGL_JAVA);
- break;
- case language_objc:
- /* Commented out until ObjC handling is enabled. */
- /*demangled = objc_demangle (name); */
- /*break; */
- default:
- demangled = NULL;
- break;
- }
+ demangled = language_demangle (language_def (lang), name, arg_mode);
fputs_filtered (demangled ? demangled : name, stream);
if (demangled != NULL)
{