* symtab.h (SYMBOL_INIT_MANGLED_NAME): Turn this macro's body into
a function; leave this macro here to invoke that function. (symbol_init_mangled_name): Declaration for that function. * symtab.c (symbol_init_mangled_name): New function.
This commit is contained in:
parent
fd74cc6bd4
commit
12af6855fb
@ -1,3 +1,10 @@
|
||||
2002-03-27 Jim Blandy <jimb@redhat.com>
|
||||
|
||||
* symtab.h (SYMBOL_INIT_MANGLED_NAME): Turn this macro's body into
|
||||
a function; leave this macro here to invoke that function.
|
||||
(symbol_init_mangled_name): Declaration for that function.
|
||||
* symtab.c (symbol_init_mangled_name): New function.
|
||||
|
||||
2002-03-27 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* valarith.c: Replace strerror with safe_strerror.
|
||||
|
77
gdb/symtab.c
77
gdb/symtab.c
@ -349,6 +349,83 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
|
||||
strcat (mangled_name, physname);
|
||||
return (mangled_name);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a symbol's mangled name. */
|
||||
|
||||
/* Try to initialize the demangled name for a symbol, based on the
|
||||
language of that symbol. If the language is set to language_auto,
|
||||
it will attempt to find any demangling algorithm that works and
|
||||
then set the language appropriately. If no demangling of any kind
|
||||
is found, the language is set back to language_unknown, so we can
|
||||
avoid doing this work again the next time we encounter the symbol.
|
||||
Any required space to store the name is obtained from the specified
|
||||
obstack. */
|
||||
|
||||
void
|
||||
symbol_init_demangled_name (struct general_symbol_info *gsymbol,
|
||||
struct obstack *obstack)
|
||||
{
|
||||
char *mangled = gsymbol->name;
|
||||
char *demangled = NULL;
|
||||
|
||||
if (gsymbol->language == language_unknown)
|
||||
gsymbol->language = language_auto;
|
||||
if (gsymbol->language == language_cplus
|
||||
|| gsymbol->language == language_auto)
|
||||
{
|
||||
demangled =
|
||||
cplus_demangle (gsymbol->name, DMGL_PARAMS | DMGL_ANSI);
|
||||
if (demangled != NULL)
|
||||
{
|
||||
gsymbol->language = language_cplus;
|
||||
gsymbol->language_specific.cplus_specific.demangled_name =
|
||||
obsavestring (demangled, strlen (demangled), obstack);
|
||||
xfree (demangled);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsymbol->language_specific.cplus_specific.demangled_name = NULL;
|
||||
}
|
||||
}
|
||||
if (gsymbol->language == language_java)
|
||||
{
|
||||
demangled =
|
||||
cplus_demangle (gsymbol->name,
|
||||
DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA);
|
||||
if (demangled != NULL)
|
||||
{
|
||||
gsymbol->language = language_java;
|
||||
gsymbol->language_specific.cplus_specific.demangled_name =
|
||||
obsavestring (demangled, strlen (demangled), obstack);
|
||||
xfree (demangled);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsymbol->language_specific.cplus_specific.demangled_name = NULL;
|
||||
}
|
||||
}
|
||||
if (demangled == NULL
|
||||
&& (gsymbol->language == language_chill
|
||||
|| gsymbol->language == language_auto))
|
||||
{
|
||||
demangled =
|
||||
chill_demangle (gsymbol->name);
|
||||
if (demangled != NULL)
|
||||
{
|
||||
gsymbol->language = language_chill;
|
||||
gsymbol->language_specific.chill_specific.demangled_name =
|
||||
obsavestring (demangled, strlen (demangled), obstack);
|
||||
xfree (demangled);
|
||||
}
|
||||
else
|
||||
{
|
||||
gsymbol->language_specific.chill_specific.demangled_name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
72
gdb/symtab.h
72
gdb/symtab.h
@ -159,74 +159,12 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Macro that attempts to initialize the demangled name for a symbol,
|
||||
based on the language of that symbol. If the language is set to
|
||||
language_auto, it will attempt to find any demangling algorithm
|
||||
that works and then set the language appropriately. If no demangling
|
||||
of any kind is found, the language is set back to language_unknown,
|
||||
so we can avoid doing this work again the next time we encounter
|
||||
the symbol. Any required space to store the name is obtained from the
|
||||
specified obstack. */
|
||||
|
||||
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
|
||||
do { \
|
||||
char *demangled = NULL; \
|
||||
if (SYMBOL_LANGUAGE (symbol) == language_unknown) \
|
||||
SYMBOL_LANGUAGE (symbol) = language_auto; \
|
||||
if (SYMBOL_LANGUAGE (symbol) == language_cplus \
|
||||
|| SYMBOL_LANGUAGE (symbol) == language_auto) \
|
||||
{ \
|
||||
demangled = \
|
||||
cplus_demangle (SYMBOL_NAME (symbol), DMGL_PARAMS | DMGL_ANSI);\
|
||||
if (demangled != NULL) \
|
||||
{ \
|
||||
SYMBOL_LANGUAGE (symbol) = language_cplus; \
|
||||
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = \
|
||||
obsavestring (demangled, strlen (demangled), (obstack)); \
|
||||
xfree (demangled); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
|
||||
} \
|
||||
} \
|
||||
if (SYMBOL_LANGUAGE (symbol) == language_java) \
|
||||
{ \
|
||||
demangled = \
|
||||
cplus_demangle (SYMBOL_NAME (symbol), \
|
||||
DMGL_PARAMS | DMGL_ANSI | DMGL_JAVA); \
|
||||
if (demangled != NULL) \
|
||||
{ \
|
||||
SYMBOL_LANGUAGE (symbol) = language_java; \
|
||||
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = \
|
||||
obsavestring (demangled, strlen (demangled), (obstack)); \
|
||||
xfree (demangled); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
SYMBOL_CPLUS_DEMANGLED_NAME (symbol) = NULL; \
|
||||
} \
|
||||
} \
|
||||
if (demangled == NULL \
|
||||
&& (SYMBOL_LANGUAGE (symbol) == language_chill \
|
||||
|| SYMBOL_LANGUAGE (symbol) == language_auto)) \
|
||||
{ \
|
||||
demangled = \
|
||||
chill_demangle (SYMBOL_NAME (symbol)); \
|
||||
if (demangled != NULL) \
|
||||
{ \
|
||||
SYMBOL_LANGUAGE (symbol) = language_chill; \
|
||||
SYMBOL_CHILL_DEMANGLED_NAME (symbol) = \
|
||||
obsavestring (demangled, strlen (demangled), (obstack)); \
|
||||
xfree (demangled); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
|
||||
(symbol_init_demangled_name (&symbol->ginfo, (obstack)))
|
||||
extern void symbol_init_demangled_name (struct general_symbol_info *symbol,
|
||||
struct obstack *obstack);
|
||||
|
||||
|
||||
/* Macro that returns the demangled name for a symbol based on the language
|
||||
for that symbol. If no demangled name exists, returns NULL. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user