mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 20:14:06 +08:00
Replace SYMBOL_SET_LINKAGE_NAME with a member function
Easier to read, shorter, and will later make it possible to make the name field private. gdb/ChangeLog: 2019-11-27 Christian Biesinger <cbiesinger@google.com> * ada-exp.y (write_ambiguous_var): Replace SYMBOL_SET_LINKAGE_NAME with sym->set_linkage_name. * coffread.c (coff_read_enum_type): Likewise. * mdebugread.c (parse_symbol): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (read_enum_type): Likewise. (common_block_end): Likewise. * symtab.h (struct general_symbol_info) <set_linkage_name>: New function. (SYMBOL_SET_LINKAGE_NAME): Remove. * xcoffread.c (process_xcoff_symbol): Replace SYMBOL_SET_LINKAGE_NAME with sym->set_linkage_name. Change-Id: I174a0542c014f1b035070068076308bb8ae79abb
This commit is contained in:
parent
db5960b4d2
commit
43678b0afe
@ -1,3 +1,19 @@
|
||||
2019-11-27 Christian Biesinger <cbiesinger@google.com>
|
||||
|
||||
* ada-exp.y (write_ambiguous_var): Replace SYMBOL_SET_LINKAGE_NAME
|
||||
with sym->set_linkage_name.
|
||||
* coffread.c (coff_read_enum_type): Likewise.
|
||||
* mdebugread.c (parse_symbol): Likewise.
|
||||
* stabsread.c (patch_block_stabs): Likewise.
|
||||
(define_symbol): Likewise.
|
||||
(read_enum_type): Likewise.
|
||||
(common_block_end): Likewise.
|
||||
* symtab.h (struct general_symbol_info) <set_linkage_name>: New
|
||||
function.
|
||||
(SYMBOL_SET_LINKAGE_NAME): Remove.
|
||||
* xcoffread.c (process_xcoff_symbol): Replace SYMBOL_SET_LINKAGE_NAME
|
||||
with sym->set_linkage_name.
|
||||
|
||||
2019-11-27 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* mi/mi-cmds.c (mi_cmds): Add 'symbol-info-modules' entry.
|
||||
|
@ -1105,8 +1105,7 @@ write_ambiguous_var (struct parser_state *par_state,
|
||||
struct symbol *sym = new (&temp_parse_space) symbol ();
|
||||
|
||||
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
|
||||
SYMBOL_SET_LINKAGE_NAME (sym,
|
||||
obstack_strndup (&temp_parse_space, name, len));
|
||||
sym->set_linkage_name (obstack_strndup (&temp_parse_space, name, len));
|
||||
SYMBOL_LANGUAGE (sym) = language_ada;
|
||||
|
||||
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
|
||||
|
@ -2106,7 +2106,7 @@ coff_read_enum_type (int index, int length, int lastsym,
|
||||
sym = allocate_symbol (objfile);
|
||||
|
||||
name = obstack_strdup (&objfile->objfile_obstack, name);
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, name);
|
||||
sym->set_linkage_name (name);
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
|
||||
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
|
||||
SYMBOL_VALUE (sym) = ms->c_value;
|
||||
|
@ -1066,9 +1066,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||
FIELD_BITSIZE (*f) = 0;
|
||||
|
||||
enum_sym = allocate_symbol (mdebugread_objfile);
|
||||
SYMBOL_SET_LINKAGE_NAME
|
||||
(enum_sym,
|
||||
obstack_strdup (&mdebugread_objfile->objfile_obstack,
|
||||
enum_sym->set_linkage_name
|
||||
(obstack_strdup (&mdebugread_objfile->objfile_obstack,
|
||||
f->name));
|
||||
SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
|
||||
SYMBOL_TYPE (enum_sym) = t;
|
||||
|
@ -426,9 +426,8 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
|
||||
SYMBOL_SET_LINKAGE_NAME
|
||||
(sym, obstack_strndup (&objfile->objfile_obstack,
|
||||
name, pp - name));
|
||||
sym->set_linkage_name
|
||||
(obstack_strndup (&objfile->objfile_obstack, name, pp - name));
|
||||
pp += 2;
|
||||
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
|
||||
{
|
||||
@ -710,14 +709,14 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
||||
switch (string[1])
|
||||
{
|
||||
case 't':
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, "this");
|
||||
sym->set_linkage_name ("this");
|
||||
break;
|
||||
|
||||
case 'v': /* $vtbl_ptr_type */
|
||||
goto normal;
|
||||
|
||||
case 'e':
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, "eh_throw");
|
||||
sym->set_linkage_name ("eh_throw");
|
||||
break;
|
||||
|
||||
case '_':
|
||||
@ -1202,7 +1201,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
||||
const char *new_name = gdbarch_static_transform_name
|
||||
(gdbarch, sym->linkage_name ());
|
||||
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, new_name);
|
||||
sym->set_linkage_name (new_name);
|
||||
SET_SYMBOL_VALUE_ADDRESS (sym,
|
||||
BMSYMBOL_VALUE_ADDRESS (msym));
|
||||
}
|
||||
@ -1385,7 +1384,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
|
||||
const char *new_name = gdbarch_static_transform_name
|
||||
(gdbarch, sym->linkage_name ());
|
||||
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, new_name);
|
||||
sym->set_linkage_name (new_name);
|
||||
SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym));
|
||||
}
|
||||
}
|
||||
@ -3638,7 +3637,7 @@ read_enum_type (const char **pp, struct type *type,
|
||||
return error_type (pp, objfile);
|
||||
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, name);
|
||||
sym->set_linkage_name (name);
|
||||
SYMBOL_SET_LANGUAGE (sym, get_current_subfile ()->language,
|
||||
&objfile->objfile_obstack);
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
|
||||
@ -4306,7 +4305,7 @@ common_block_end (struct objfile *objfile)
|
||||
|
||||
sym = allocate_symbol (objfile);
|
||||
/* Note: common_block_name already saved on objfile_obstack. */
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, common_block_name);
|
||||
sym->set_linkage_name (common_block_name);
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
|
||||
|
||||
/* Now we copy all the symbols which have been defined since the BCOMM. */
|
||||
|
17
gdb/symtab.h
17
gdb/symtab.h
@ -416,6 +416,14 @@ struct general_symbol_info
|
||||
returns the same value (same pointer) as linkage_name (). */
|
||||
const char *search_name () const;
|
||||
|
||||
/* Set just the linkage name of a symbol; do not try to demangle
|
||||
it. Used for constructs which do not have a mangled name,
|
||||
e.g. struct tags. Unlike SYMBOL_SET_NAMES, linkage_name must
|
||||
be terminated and either already on the objfile's obstack or
|
||||
permanently allocated. */
|
||||
void set_linkage_name (const char *linkage_name)
|
||||
{ name = linkage_name; }
|
||||
|
||||
/* Name of the symbol. This is a required field. Storage for the
|
||||
name is allocated on the objfile_obstack for the associated
|
||||
objfile. For languages like C++ that make a distinction between
|
||||
@ -528,7 +536,6 @@ extern void symbol_set_language (struct general_symbol_info *symbol,
|
||||
enum language language,
|
||||
struct obstack *obstack);
|
||||
|
||||
|
||||
/* Try to determine 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
|
||||
@ -538,14 +545,6 @@ extern void symbol_set_language (struct general_symbol_info *symbol,
|
||||
extern char *symbol_find_demangled_name (struct general_symbol_info *gsymbol,
|
||||
const char *mangled);
|
||||
|
||||
/* Set just the linkage name of a symbol; do not try to demangle
|
||||
it. Used for constructs which do not have a mangled name,
|
||||
e.g. struct tags. Unlike SYMBOL_SET_NAMES, linkage_name must
|
||||
be terminated and either already on the objfile's obstack or
|
||||
permanently allocated. */
|
||||
#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
|
||||
(symbol)->name = (linkage_name)
|
||||
|
||||
/* Set the linkage and natural names of a symbol, by demangling
|
||||
the linkage name. If linkage_name may not be nullterminated,
|
||||
copy_name must be set to true. */
|
||||
|
@ -1574,7 +1574,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
||||
will be patched with the type from its stab entry later on in
|
||||
patch_block_stabs (), unless the file was compiled without -g. */
|
||||
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced));
|
||||
sym->set_linkage_name (SYMNAME_ALLOC (name, symname_alloced));
|
||||
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
|
||||
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
|
||||
|
Loading…
Reference in New Issue
Block a user