mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-25 01:13:37 +08:00
Convert symbol_set_demangled_name to a method
This changes symbol_set_demangled_name to be a method on general_symbol_info, and updates the users. gdb/ChangeLog 2020-04-24 Tom Tromey <tom@tromey.com> * symtab.h (struct general_symbol_info) <set_demangled_name>: New method. (symbol_set_demangled_name): Don't declare. * symtab.c (general_symbol_info::set_demangled_name): Rename from symbol_set_demangled_name. (general_symbol_info::set_language) (general_symbol_info::compute_and_set_names): Update. * minsyms.c (minimal_symbol_reader::install): Update. * dwarf2/read.c (new_symbol): Update.
This commit is contained in:
parent
7cf288744f
commit
ff98567107
@ -1,3 +1,15 @@
|
||||
2020-04-24 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* symtab.h (struct general_symbol_info) <set_demangled_name>: New
|
||||
method.
|
||||
(symbol_set_demangled_name): Don't declare.
|
||||
* symtab.c (general_symbol_info::set_demangled_name): Rename from
|
||||
symbol_set_demangled_name.
|
||||
(general_symbol_info::set_language)
|
||||
(general_symbol_info::compute_and_set_names): Update.
|
||||
* minsyms.c (minimal_symbol_reader::install): Update.
|
||||
* dwarf2/read.c (new_symbol): Update.
|
||||
|
||||
2020-04-24 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
PR python/23662:
|
||||
|
@ -20569,9 +20569,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
between gfortran, iFort etc. */
|
||||
if (cu->language == language_fortran
|
||||
&& symbol_get_demangled_name (sym) == NULL)
|
||||
symbol_set_demangled_name (sym,
|
||||
dwarf2_full_name (name, die, cu),
|
||||
NULL);
|
||||
sym->set_demangled_name (dwarf2_full_name (name, die, cu), NULL);
|
||||
|
||||
/* Default assumptions.
|
||||
Use the passed type or decode it from the die. */
|
||||
|
@ -1418,9 +1418,8 @@ minimal_symbol_reader::install ()
|
||||
/* This will be freed later, by compute_and_set_names. */
|
||||
char *demangled_name
|
||||
= symbol_find_demangled_name (msym, msym->linkage_name ());
|
||||
symbol_set_demangled_name
|
||||
(msym, demangled_name,
|
||||
&m_objfile->per_bfd->storage_obstack);
|
||||
msym->set_demangled_name
|
||||
(demangled_name, &m_objfile->per_bfd->storage_obstack);
|
||||
msym->name_set = 1;
|
||||
}
|
||||
/* This mangled_name_hash computation has to be outside of
|
||||
|
27
gdb/symtab.c
27
gdb/symtab.c
@ -667,29 +667,27 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
|
||||
return (mangled_name);
|
||||
}
|
||||
|
||||
/* Set the demangled name of GSYMBOL to NAME. NAME must be already
|
||||
correctly allocated. */
|
||||
/* See symtab.h. */
|
||||
|
||||
void
|
||||
symbol_set_demangled_name (struct general_symbol_info *gsymbol,
|
||||
const char *name,
|
||||
struct obstack *obstack)
|
||||
general_symbol_info::set_demangled_name (const char *name,
|
||||
struct obstack *obstack)
|
||||
{
|
||||
if (gsymbol->language () == language_ada)
|
||||
if (language () == language_ada)
|
||||
{
|
||||
if (name == NULL)
|
||||
{
|
||||
gsymbol->ada_mangled = 0;
|
||||
gsymbol->language_specific.obstack = obstack;
|
||||
ada_mangled = 0;
|
||||
language_specific.obstack = obstack;
|
||||
}
|
||||
else
|
||||
{
|
||||
gsymbol->ada_mangled = 1;
|
||||
gsymbol->language_specific.demangled_name = name;
|
||||
ada_mangled = 1;
|
||||
language_specific.demangled_name = name;
|
||||
}
|
||||
}
|
||||
else
|
||||
gsymbol->language_specific.demangled_name = name;
|
||||
language_specific.demangled_name = name;
|
||||
}
|
||||
|
||||
/* Return the demangled name of GSYMBOL. */
|
||||
@ -722,7 +720,7 @@ general_symbol_info::set_language (enum language language,
|
||||
|| language == language_objc
|
||||
|| language == language_fortran)
|
||||
{
|
||||
symbol_set_demangled_name (this, NULL, obstack);
|
||||
set_demangled_name (NULL, obstack);
|
||||
}
|
||||
else if (language == language_ada)
|
||||
{
|
||||
@ -872,7 +870,7 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
|
||||
m_name = obstack_strndup (&per_bfd->storage_obstack,
|
||||
linkage_name.data (),
|
||||
linkage_name.length ());
|
||||
symbol_set_demangled_name (this, NULL, &per_bfd->storage_obstack);
|
||||
set_demangled_name (NULL, &per_bfd->storage_obstack);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -962,8 +960,7 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
|
||||
m_language = (*slot)->language;
|
||||
|
||||
m_name = (*slot)->mangled.data ();
|
||||
symbol_set_demangled_name (this, (*slot)->demangled.get (),
|
||||
&per_bfd->storage_obstack);
|
||||
set_demangled_name ((*slot)->demangled.get (), &per_bfd->storage_obstack);
|
||||
}
|
||||
|
||||
/* See symtab.h. */
|
||||
|
@ -454,6 +454,11 @@ struct general_symbol_info
|
||||
void set_linkage_name (const char *linkage_name)
|
||||
{ m_name = linkage_name; }
|
||||
|
||||
/* Set the demangled name of this symbol to NAME. NAME must be
|
||||
already correctly allocated. If the symbol's language is Ada,
|
||||
then the name is ignored and the obstack is set. */
|
||||
void set_demangled_name (const char *name, struct obstack *obstack);
|
||||
|
||||
enum language language () const
|
||||
{ return m_language; }
|
||||
|
||||
@ -537,10 +542,6 @@ struct general_symbol_info
|
||||
short section;
|
||||
};
|
||||
|
||||
extern void symbol_set_demangled_name (struct general_symbol_info *,
|
||||
const char *,
|
||||
struct obstack *);
|
||||
|
||||
extern const char *symbol_get_demangled_name
|
||||
(const struct general_symbol_info *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user