mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
* 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.
This commit is contained in:
parent
5eb7f2340a
commit
9a3d7dfd2e
@ -1,3 +1,24 @@
|
||||
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
|
||||
|
@ -1571,7 +1571,8 @@ builtin-regs.o: builtin-regs.c $(defs_h) $(builtin_regs_h) $(gdbtypes_h) \
|
||||
$(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) \
|
||||
@ -1853,7 +1854,7 @@ irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_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)
|
||||
@ -1865,7 +1866,7 @@ kod.o: kod.c $(defs_h) $(command_h) $(gdbcmd_h) $(target_h) $(gdb_string_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) \
|
||||
|
@ -8081,6 +8081,7 @@ const struct language_defn ada_language_defn = {
|
||||
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 */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#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);
|
||||
@ -553,6 +554,7 @@ const struct language_defn c_language_defn =
|
||||
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 */
|
||||
@ -606,6 +608,7 @@ const struct language_defn cplus_language_defn =
|
||||
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 */
|
||||
@ -636,6 +639,7 @@ const struct language_defn asm_language_defn =
|
||||
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 */
|
||||
|
@ -473,6 +473,7 @@ const struct language_defn f_language_defn =
|
||||
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 */
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "jv-lang.h"
|
||||
#include "gdbcore.h"
|
||||
#include "block.h"
|
||||
#include "demangle.h"
|
||||
#include <ctype.h>
|
||||
|
||||
struct type *java_int_type;
|
||||
@ -996,6 +997,12 @@ java_create_fundamental_type (struct objfile *objfile, int typeid)
|
||||
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. */
|
||||
|
||||
@ -1055,6 +1062,7 @@ const struct language_defn java_language_defn =
|
||||
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 */
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "target.h"
|
||||
#include "parser-defs.h"
|
||||
#include "jv-lang.h"
|
||||
#include "demangle.h"
|
||||
|
||||
extern void _initialize_language (void);
|
||||
|
||||
@ -1361,6 +1362,21 @@ skip_language_trampoline (CORE_ADDR pc)
|
||||
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. */
|
||||
|
||||
@ -1428,6 +1444,13 @@ static CORE_ADDR unk_lang_trampoline (CORE_ADDR pc)
|
||||
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
|
||||
@ -1456,6 +1479,7 @@ const struct language_defn unknown_language_defn =
|
||||
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 */
|
||||
@ -1487,6 +1511,7 @@ const struct language_defn auto_language_defn =
|
||||
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 */
|
||||
@ -1517,6 +1542,7 @@ const struct language_defn local_language_defn =
|
||||
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 */
|
||||
|
@ -209,6 +209,9 @@ struct language_defn
|
||||
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;
|
||||
@ -475,4 +478,8 @@ extern enum language get_frame_language (void); /* In stack.c */
|
||||
|
||||
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) */
|
||||
|
@ -427,6 +427,7 @@ const struct language_defn m2_language_defn =
|
||||
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 */
|
||||
|
13
gdb/maint.c
13
gdb/maint.c
@ -151,17 +151,8 @@ maintenance_demangle (char *args, int from_tty)
|
||||
}
|
||||
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);
|
||||
|
@ -237,7 +237,7 @@ value_nsstring (char *ptr, int len)
|
||||
/* Objective-C name demangling. */
|
||||
|
||||
char *
|
||||
objc_demangle (const char *mangled)
|
||||
objc_demangle (const char *mangled, int options)
|
||||
{
|
||||
char *demangled, *cp;
|
||||
|
||||
@ -700,6 +700,7 @@ const struct language_defn objc_language_defn = {
|
||||
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 */
|
||||
|
@ -41,7 +41,7 @@ extern int c_value_print (struct value *, struct ui_file *,
|
||||
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);
|
||||
|
||||
|
@ -462,6 +462,7 @@ const struct language_defn pascal_language_defn =
|
||||
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 */
|
||||
|
@ -251,6 +251,7 @@ const struct language_defn scm_language_defn =
|
||||
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 */
|
||||
|
17
gdb/utils.c
17
gdb/utils.c
@ -2298,22 +2298,7 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name,
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user