From: Simon Marchi Date: Mon, 22 Nov 2021 03:03:07 +0000 (-0500) Subject: gdb: remove SYMBOL_ACLASS_INDEX macro, add getter/setter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba44b1a3e0bd6ec2e94e6d6c288786114b8a633c;p=binutils-gdb.git gdb: remove SYMBOL_ACLASS_INDEX macro, add getter/setter Add a getter and a setter for a symbol's aclass index. Remove the corresponding macro and adjust all callers. Change-Id: Ie8c8d732624cfadb714aba5ddafa3d29409b3d39 --- diff --git a/gdb/coffread.c b/gdb/coffread.c index af0699bed2d..d4c4226a8d2 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1575,7 +1575,7 @@ process_coff_symbol (struct coff_symbol *cs, lookup_function_type (decode_function_type (cs, cs->c_type, aux, objfile)); - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT || cs->c_sclass == C_THUMBSTATFUNC) add_symbol_to_list (sym, get_file_symbols ()); @@ -1592,14 +1592,14 @@ process_coff_symbol (struct coff_symbol *cs, break; case C_AUTO: - SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL; + sym->set_aclass_index (LOC_LOCAL); add_symbol_to_list (sym, get_local_symbols ()); break; case C_THUMBEXT: case C_THUMBEXTFUNC: case C_EXT: - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, (CORE_ADDR) cs->c_value + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); @@ -1609,7 +1609,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBSTAT: case C_THUMBSTATFUNC: case C_STAT: - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, (CORE_ADDR) cs->c_value + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); @@ -1629,7 +1629,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_GLBLREG: #endif case C_REG: - SYMBOL_ACLASS_INDEX (sym) = coff_register_index; + sym->set_aclass_index (coff_register_index); SYMBOL_VALUE (sym) = cs->c_value; add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1639,20 +1639,20 @@ process_coff_symbol (struct coff_symbol *cs, break; case C_ARG: - SYMBOL_ACLASS_INDEX (sym) = LOC_ARG; + sym->set_aclass_index (LOC_ARG); SYMBOL_IS_ARGUMENT (sym) = 1; add_symbol_to_list (sym, get_local_symbols ()); break; case C_REGPARM: - SYMBOL_ACLASS_INDEX (sym) = coff_register_index; + sym->set_aclass_index (coff_register_index); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = cs->c_value; add_symbol_to_list (sym, get_local_symbols ()); break; case C_TPDEF: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; /* If type has no name, give it one. */ @@ -1707,7 +1707,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_STRTAG: case C_UNTAG: case C_ENTAG: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; /* Some compilers try to be helpful by inventing "fake" @@ -2098,7 +2098,7 @@ coff_read_enum_type (int index, int length, int lastsym, name = obstack_strdup (&objfile->objfile_obstack, name); sym->set_linkage_name (name); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = ms->c_value; add_symbol_to_list (sym, symlist); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 0a96520411f..dbafe75b831 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -330,7 +330,7 @@ set_symbol_address (struct objfile *of, struct symbol *sym, const char *name) if (msym.minsym != NULL) { SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym)); - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); sym->set_section_index (msym.minsym->section_index ()); } } @@ -450,7 +450,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg) sym->set_language (language_c, &ccp->of->objfile_obstack); sym->compute_and_set_names (name, false, ccp->of->per_bfd); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_TYPE (sym) = fip->ptype; add_symbol_to_list (sym, ccp->builder->get_global_symbols ()); @@ -480,7 +480,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) sym->set_language (language_c, &objfile->objfile_obstack); sym->compute_and_set_names (name, false, objfile->per_bfd); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != nullptr) SYMBOL_TYPE (sym) = type; @@ -491,11 +491,11 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) case CTF_K_STRUCT: case CTF_K_UNION: case CTF_K_ENUM: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; break; case CTF_K_FUNCTION: - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); set_symbol_address (objfile, sym, sym->linkage_name ()); break; case CTF_K_CONST: @@ -505,7 +505,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) case CTF_K_TYPEDEF: case CTF_K_INTEGER: case CTF_K_FLOAT: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; break; case CTF_K_POINTER: @@ -1171,7 +1171,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg) OBJSTAT (ccp->of, n_syms++); SYMBOL_TYPE (sym) = type; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); sym->compute_and_set_names (name, false, ccp->of->per_bfd); add_symbol_to_list (sym, ccp->builder->get_file_symbols ()); break; @@ -1207,7 +1207,7 @@ add_stt_entries (struct ctf_context *ccp, int functions) OBJSTAT (ccp->of, n_syms++); SYMBOL_TYPE (sym) = type; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); sym->compute_and_set_names (tname, false, ccp->of->per_bfd); add_symbol_to_list (sym, ccp->builder->get_global_symbols ()); set_symbol_address (ccp->of, sym, tname); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 3bbd253d841..1155efb6df7 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8917,7 +8917,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) /* This is not VAR_DOMAIN because we want a way to ensure a lookup of, e.g., "main" finds the "main" module and not C's main(). */ SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_TYPE (sym) = type; add_symbol_to_list (sym, cu->get_builder ()->get_global_symbols ()); @@ -16865,7 +16865,7 @@ mark_common_block_symbol_computed (struct symbol *sym, gdb_assert (ptr - baton->data == baton->size); SYMBOL_LOCATION_BATON (sym) = baton; - SYMBOL_ACLASS_INDEX (sym) = dwarf2_locexpr_index; + sym->set_aclass_index (dwarf2_locexpr_index); } /* Create appropriate locally-scoped variables for all the @@ -21601,7 +21601,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, variable has been optimized away. */ if (attr->form_is_block () && attr->as_block ()->size == 0) { - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); return; } @@ -21632,7 +21632,7 @@ var_decode_location (struct attribute *attr, struct symbol *sym, SET_SYMBOL_VALUE_ADDRESS (sym, read_addr_index_from_leb128 (cu, block->data + 1, &dummy)); - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); fixup_symbol_section (sym, objfile); SET_SYMBOL_VALUE_ADDRESS (sym, @@ -21718,7 +21718,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* Default assumptions. Use the passed type or decode it from the die. */ SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != NULL) SYMBOL_TYPE (sym) = type; else @@ -21760,10 +21760,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, addr = attr->as_address (); addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr + baseaddr); SET_SYMBOL_VALUE_ADDRESS (sym, addr); - SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL; + sym->set_aclass_index (LOC_LABEL); } else - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr; SYMBOL_DOMAIN (sym) = LABEL_DOMAIN; add_symbol_to_list (sym, cu->list_in_scope); @@ -21771,7 +21771,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, case DW_TAG_subprogram: /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by finish_block. */ - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); attr2 = dwarf2_attr (die, DW_AT_external, cu); if ((attr2 != nullptr && attr2->as_boolean ()) || cu->per_cu->lang == language_ada @@ -21793,7 +21793,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, case DW_TAG_inlined_subroutine: /* SYMBOL_BLOCK_VALUE (sym) will be filled in later by finish_block. */ - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); SYMBOL_INLINED (sym) = 1; list_to_add = cu->list_in_scope; break; @@ -21913,7 +21913,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, ? cu->get_builder ()->get_global_symbols () : cu->list_in_scope); - SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED; + sym->set_aclass_index (LOC_UNRESOLVED); } else if (!die_is_declaration (die, cu)) { @@ -21963,7 +21963,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, case DW_TAG_union_type: case DW_TAG_set_type: case DW_TAG_enumeration_type: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; { @@ -22001,14 +22001,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, } break; case DW_TAG_typedef: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; list_to_add = cu->list_in_scope; break; case DW_TAG_array_type: case DW_TAG_base_type: case DW_TAG_subrange_type: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; list_to_add = cu->list_in_scope; break; @@ -22031,16 +22031,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, break; case DW_TAG_imported_declaration: case DW_TAG_namespace: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); list_to_add = cu->get_builder ()->get_global_symbols (); break; case DW_TAG_module: - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; list_to_add = cu->get_builder ()->get_global_symbols (); break; case DW_TAG_common_block: - SYMBOL_ACLASS_INDEX (sym) = LOC_COMMON_BLOCK; + sym->set_aclass_index (LOC_COMMON_BLOCK); SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; add_symbol_to_list (sym, cu->list_in_scope); break; @@ -22238,17 +22238,17 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym, if (baton != NULL) { SYMBOL_LOCATION_BATON (sym) = baton; - SYMBOL_ACLASS_INDEX (sym) = dwarf2_locexpr_index; + sym->set_aclass_index (dwarf2_locexpr_index); } else if (bytes != NULL) { SYMBOL_VALUE_BYTES (sym) = bytes; - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES; + sym->set_aclass_index (LOC_CONST_BYTES); } else { SYMBOL_VALUE (sym) = value; - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); } } @@ -24341,9 +24341,9 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, complaint (_("Location list used without " "specifying the CU base address.")); - SYMBOL_ACLASS_INDEX (sym) = (is_block - ? dwarf2_loclist_block_index - : dwarf2_loclist_index); + sym->set_aclass_index ((is_block + ? dwarf2_loclist_block_index + : dwarf2_loclist_index)); SYMBOL_LOCATION_BATON (sym) = baton; } else @@ -24373,9 +24373,9 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, baton->size = 0; } - SYMBOL_ACLASS_INDEX (sym) = (is_block - ? dwarf2_locexpr_block_index - : dwarf2_locexpr_index); + sym->set_aclass_index ((is_block + ? dwarf2_locexpr_block_index + : dwarf2_locexpr_index)); SYMBOL_LOCATION_BATON (sym) = baton; } } diff --git a/gdb/jit.c b/gdb/jit.c index 9d844bfb4b2..8e7cc46c4dc 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -560,7 +560,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) /* The name. */ SYMBOL_DOMAIN (block_name) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (block_name) = LOC_BLOCK; + block_name->set_aclass_index (LOC_BLOCK); symbol_set_symtab (block_name, filetab); SYMBOL_TYPE (block_name) = lookup_function_type (block_type); SYMBOL_BLOCK_VALUE (block_name) = new_block; diff --git a/gdb/language.c b/gdb/language.c index f000142fc2d..aff6c21e2b6 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1002,7 +1002,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol symbol->set_section_index (0); SYMBOL_TYPE (symbol) = type; SYMBOL_DOMAIN (symbol) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (symbol) = LOC_TYPEDEF; + symbol->set_aclass_index (LOC_TYPEDEF); return symbol; } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index b98ac8fe799..e0d108935e1 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -563,7 +563,7 @@ add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend, struct objfile *objfile, const char *name) { SYMBOL_DOMAIN (s) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = aclass_index; + s->set_aclass_index (aclass_index); add_symbol (s, top_stack->cur_st, b); /* Type could be missing if file is compiled without debugging info. */ @@ -681,19 +681,19 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, { case scRegister: /* Pass by value in register. */ - SYMBOL_ACLASS_INDEX (s) = mdebug_register_index; + s->set_aclass_index (mdebug_register_index); break; case scVar: /* Pass by reference on stack. */ - SYMBOL_ACLASS_INDEX (s) = LOC_REF_ARG; + s->set_aclass_index (LOC_REF_ARG); break; case scVarRegister: /* Pass by reference in register. */ - SYMBOL_ACLASS_INDEX (s) = mdebug_regparm_index; + s->set_aclass_index (mdebug_regparm_index); break; default: /* Pass by value on stack. */ - SYMBOL_ACLASS_INDEX (s) = LOC_ARG; + s->set_aclass_index (LOC_ARG); break; } SYMBOL_VALUE (s) = svalue; @@ -704,7 +704,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, case stLabel: /* label, goes into current block. */ s = new_symbol (name); SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* So that it can be used */ - SYMBOL_ACLASS_INDEX (s) = LOC_LABEL; /* but not misused. */ + s->set_aclass_index (LOC_LABEL); /* but not misused. */ SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int; add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -745,7 +745,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, } s = new_symbol (name); SYMBOL_DOMAIN (s) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = LOC_BLOCK; + s->set_aclass_index (LOC_BLOCK); /* Type of the return value. */ if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil) t = objfile_type (objfile)->builtin_int; @@ -1065,7 +1065,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, enum_sym->set_linkage_name (obstack_strdup (&mdebugread_objfile->objfile_obstack, f->name ())); - SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST; + enum_sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (enum_sym) = t; SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; SYMBOL_VALUE (enum_sym) = tsym.value; @@ -1098,7 +1098,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); SYMBOL_DOMAIN (s) = STRUCT_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = LOC_TYPEDEF; + s->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (s) = 0; SYMBOL_TYPE (s) = t; add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -1155,7 +1155,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* Make up special symbol to contain procedure specific info. */ s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); SYMBOL_DOMAIN (s) = LABEL_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = LOC_CONST; + s->set_aclass_index (LOC_CONST); SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->builtin_void; e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack, mdebug_extra_func_info); @@ -1296,7 +1296,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, break; s = new_symbol (name); SYMBOL_DOMAIN (s) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = LOC_TYPEDEF; + s->set_aclass_index (LOC_TYPEDEF); SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block; SYMBOL_TYPE (s) = t; add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -3988,7 +3988,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); SYMBOL_DOMAIN (s) = LABEL_DOMAIN; - SYMBOL_ACLASS_INDEX (s) = LOC_CONST; + s->set_aclass_index (LOC_CONST); SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void; SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; e->pdr.framereg = -1; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 20cba381cc5..21f824f6e73 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -425,7 +425,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, a N_GSYM stab for it, but no regular (C_EXT) symbol. */ sym = new (&objfile->objfile_obstack) symbol; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; + sym->set_aclass_index (LOC_OPTIMIZED_OUT); sym->set_linkage_name (obstack_strndup (&objfile->objfile_obstack, name, pp - name)); pp += 2; @@ -783,7 +783,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */ if (*p != '=') { - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); @@ -806,7 +806,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = dbl_type; SYMBOL_VALUE_BYTES (sym) = dbl_valu; - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES; + sym->set_aclass_index (LOC_CONST_BYTES); } break; case 'i': @@ -820,7 +820,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_long; SYMBOL_VALUE (sym) = atoi (p); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); } break; @@ -828,7 +828,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, { SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_char; SYMBOL_VALUE (sym) = atoi (p); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); } break; @@ -842,7 +842,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (quote != '\'' && quote != '"') { - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); @@ -867,7 +867,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, } if (*p != quote) { - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); @@ -889,7 +889,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, p++; SYMBOL_VALUE_BYTES (sym) = string_value; - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES; + sym->set_aclass_index (LOC_CONST_BYTES); } break; @@ -899,7 +899,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, e.g. "b:c=e6,0" for "const b = blob1" (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */ { - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = read_type (&p, objfile); if (*p != ',') @@ -920,7 +920,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, break; default: { - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); } } @@ -931,7 +931,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'C': /* The name of a caught exception. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL; + sym->set_aclass_index (LOC_LABEL); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SET_SYMBOL_VALUE_ADDRESS (sym, valu); add_symbol_to_list (sym, get_local_symbols ()); @@ -940,7 +940,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'f': /* A static function definition. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); /* fall into process_function_types. */ @@ -1012,7 +1012,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'F': /* A global function definition. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_global_symbols ()); goto process_function_types; @@ -1023,7 +1023,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, corresponding linker definition to find the value. These definitions appear at the end of the namelist. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; /* Don't add symbol references to global_sym_chain. Symbol references don't have valid names and wont't match up with @@ -1044,7 +1044,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 's': case 'l': SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL; + sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_local_symbols ()); @@ -1064,7 +1064,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, else SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_ARG; + sym->set_aclass_index (LOC_ARG); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_IS_ARGUMENT (sym) = 1; @@ -1113,7 +1113,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'R': /* Parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = stab_register_index; + sym->set_aclass_index (stab_register_index); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -1123,7 +1123,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'r': /* Register variable (either global or local). */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = stab_register_index; + sym->set_aclass_index (stab_register_index); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; if (within_function) @@ -1160,7 +1160,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, && strcmp (prev_sym->linkage_name (), sym->linkage_name ()) == 0) { - SYMBOL_ACLASS_INDEX (prev_sym) = stab_register_index; + prev_sym->set_aclass_index (stab_register_index); /* Use the type from the LOC_REGISTER; that is the type that is actually in that register. */ SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym); @@ -1178,7 +1178,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'S': /* Static symbol at top level of file. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); @@ -1209,7 +1209,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (nameless) return NULL; - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; /* C++ vagaries: we may have a type which is derived from @@ -1286,7 +1286,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct symbol *struct_sym = new (&objfile->objfile_obstack) symbol; *struct_sym = *sym; - SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF; + struct_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (struct_sym) = valu; SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; if (SYMBOL_TYPE (sym)->name () == 0) @@ -1313,7 +1313,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (nameless) return NULL; - SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (SYMBOL_TYPE (sym)->name () == 0) @@ -1328,7 +1328,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct symbol *typedef_sym = new (&objfile->objfile_obstack) symbol; *typedef_sym = *sym; - SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF; + typedef_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (typedef_sym) = valu; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (SYMBOL_TYPE (sym)->name () == 0) @@ -1342,7 +1342,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'V': /* Static symbol of local scope. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; + sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_local_symbols ()); @@ -1351,7 +1351,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'v': /* Reference parameter */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_REF_ARG; + sym->set_aclass_index (LOC_REF_ARG); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -1361,7 +1361,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'a': /* Reference parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = stab_regparm_index; + sym->set_aclass_index (stab_regparm_index); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -1374,7 +1374,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, that Pascal uses it too, but when I tried it Pascal used "x:3" (local symbol) instead. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL; + sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_local_symbols ()); @@ -1382,7 +1382,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, default: SYMBOL_TYPE (sym) = error_type (&p, objfile); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_VALUE (sym) = 0; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, get_file_symbols ()); @@ -1399,11 +1399,11 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for variables passed in a register). */ if (SYMBOL_CLASS (sym) == LOC_REGISTER) - SYMBOL_ACLASS_INDEX (sym) = LOC_REGPARM_ADDR; + sym->set_aclass_index (LOC_REGPARM_ADDR); /* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th and subsequent arguments on SPARC, for example). */ else if (SYMBOL_CLASS (sym) == LOC_ARG) - SYMBOL_ACLASS_INDEX (sym) = LOC_REF_ARG; + sym->set_aclass_index (LOC_REF_ARG); } return sym; @@ -3592,7 +3592,7 @@ read_enum_type (const char **pp, struct type *type, sym->set_linkage_name (name); sym->set_language (get_current_subfile ()->language, &objfile->objfile_obstack); - SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; + sym->set_aclass_index (LOC_CONST); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = n; if (n < 0) @@ -4260,7 +4260,7 @@ common_block_end (struct objfile *objfile) sym = new (&objfile->objfile_obstack) symbol; /* Note: common_block_name already saved on objfile_obstack. */ sym->set_linkage_name (common_block_name); - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); /* Now we copy all the symbols which have been defined since the BCOMM. */ @@ -4628,7 +4628,7 @@ scan_file_globals (struct objfile *objfile) /* Complain about unresolved common block symbols. */ if (SYMBOL_CLASS (prev) == LOC_STATIC) - SYMBOL_ACLASS_INDEX (prev) = LOC_UNRESOLVED; + prev->set_aclass_index (LOC_UNRESOLVED); else complaint (_("%s: common block `%s' from " "global_sym_chain unresolved"), diff --git a/gdb/symtab.h b/gdb/symtab.h index a765d1a7618..aa380aa7be2 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1112,7 +1112,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack symbol () /* Class-initialization of bitfields is only allowed in C++20. */ : domain (UNDEF_DOMAIN), - aclass_index (0), + m_aclass_index (0), is_objfile_owned (1), is_argument (0), is_inlined (0), @@ -1136,6 +1136,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack symbol (const symbol &) = default; symbol &operator= (const symbol &) = default; + unsigned int aclass_index () const + { + return m_aclass_index; + } + + void set_aclass_index (unsigned int aclass_index) + { + m_aclass_index = aclass_index; + } + /* Data type of value */ struct type *type = nullptr; @@ -1162,7 +1172,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack table. The actual enum address_class value is stored there, alongside any per-class ops vectors. */ - unsigned int aclass_index : SYMBOL_ACLASS_BITS; + unsigned int m_aclass_index : SYMBOL_ACLASS_BITS; /* If non-zero then symbol is objfile-owned, use owner.symtab. Otherwise symbol is arch-owned, use owner.arch. */ @@ -1241,8 +1251,7 @@ extern const struct symbol_impl *symbol_impls; "private". */ #define SYMBOL_DOMAIN(symbol) (symbol)->domain -#define SYMBOL_IMPL(symbol) (symbol_impls[(symbol)->aclass_index]) -#define SYMBOL_ACLASS_INDEX(symbol) (symbol)->aclass_index +#define SYMBOL_IMPL(symbol) (symbol_impls[(symbol)->aclass_index ()]) #define SYMBOL_CLASS(symbol) (SYMBOL_IMPL (symbol).aclass) #define SYMBOL_OBJFILE_OWNED(symbol) ((symbol)->is_objfile_owned) #define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 33e9148f672..6458e9f52d0 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1574,7 +1574,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) sym->set_linkage_name (SYMNAME_ALLOC (name, symname_alloced)); SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol; - SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; + sym->set_aclass_index (LOC_BLOCK); sym2 = new (&objfile->objfile_obstack) symbol (*sym); if (cs->c_sclass == C_EXT || C_WEAKEXT)