diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-11-26 14:41:30 -0600 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-11-27 11:09:18 -0600 |
commit | 43678b0afe412f6e920e1edd6d403068918ab259 (patch) | |
tree | a7306431f0369659eb437b9d0ea258e4f1c7bc79 | |
parent | db5960b4d22761507097f816b1dac3bb56a22bb5 (diff) | |
download | binutils-43678b0afe412f6e920e1edd6d403068918ab259.zip binutils-43678b0afe412f6e920e1edd6d403068918ab259.tar.gz binutils-43678b0afe412f6e920e1edd6d403068918ab259.tar.bz2 |
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
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/ada-exp.y | 3 | ||||
-rw-r--r-- | gdb/coffread.c | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 5 | ||||
-rw-r--r-- | gdb/stabsread.c | 17 | ||||
-rw-r--r-- | gdb/symtab.h | 17 | ||||
-rw-r--r-- | gdb/xcoffread.c | 2 |
7 files changed, 37 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6544661..028a58c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 5e9d3e7..00020cd 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -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); diff --git a/gdb/coffread.c b/gdb/coffread.c index ac00e1c..d0a9233 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c58e40c..f279f13 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -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; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 6ec9f97..979df02 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -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. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index a52f2a5..7a51456 100644 --- a/gdb/symtab.h +++ b/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. */ diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 4ea9b0b..eaa77fd 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -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; |