diff options
-rw-r--r-- | gdb/ada-exp.y | 4 | ||||
-rw-r--r-- | gdb/ada-lang.c | 14 | ||||
-rw-r--r-- | gdb/block.c | 17 | ||||
-rw-r--r-- | gdb/coffread.c | 10 | ||||
-rw-r--r-- | gdb/compile/compile-c-symbols.c | 2 | ||||
-rw-r--r-- | gdb/compile/compile-cplus-symbols.c | 4 | ||||
-rw-r--r-- | gdb/ctfread.c | 12 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 16 | ||||
-rw-r--r-- | gdb/f-valprint.c | 2 | ||||
-rw-r--r-- | gdb/jit.c | 2 | ||||
-rw-r--r-- | gdb/language.c | 2 | ||||
-rw-r--r-- | gdb/linespec.c | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 22 | ||||
-rw-r--r-- | gdb/stabsread.c | 52 | ||||
-rw-r--r-- | gdb/stack.c | 2 | ||||
-rw-r--r-- | gdb/symmisc.c | 4 | ||||
-rw-r--r-- | gdb/symtab.c | 22 | ||||
-rw-r--r-- | gdb/symtab.h | 15 | ||||
-rw-r--r-- | gdb/xcoffread.c | 2 |
19 files changed, 107 insertions, 99 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index c9fce7d..0cb4aac 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -290,7 +290,7 @@ ada_funcall (int nargs) int array_arity = 0; struct type *callee_t = nullptr; if (vvo == nullptr - || SYMBOL_DOMAIN (vvo->get_symbol ()) != UNDEF_DOMAIN) + || vvo->get_symbol ()->domain () != UNDEF_DOMAIN) { struct value *callee_v = callee->evaluate (nullptr, pstate->expout.get (), @@ -1435,7 +1435,7 @@ write_ambiguous_var (struct parser_state *par_state, { struct symbol *sym = new (&temp_parse_space) symbol (); - SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN; + sym->set_domain (UNDEF_DOMAIN); sym->set_linkage_name (obstack_strndup (&temp_parse_space, name, len)); sym->set_language (language_ada, nullptr); diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c689548..dd1be60 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4477,7 +4477,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) { if (sym0 == sym1) return 1; - if (SYMBOL_DOMAIN (sym0) != SYMBOL_DOMAIN (sym1) + if (sym0->domain () != sym1->domain () || sym0->aclass () != sym1->aclass ()) return 0; @@ -5740,7 +5740,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result, sym != NULL; sym = block_iter_match_next (lookup_name, &iter)) { - if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), sym->domain (), domain)) { if (sym->aclass () != LOC_UNRESOLVED) { @@ -5780,7 +5780,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result, ALL_BLOCK_SYMBOLS (block, iter, sym) { if (symbol_matches_domain (sym->language (), - SYMBOL_DOMAIN (sym), domain)) + sym->domain (), domain)) { int cmp; @@ -10411,7 +10411,7 @@ ada_var_value_operation::evaluate (struct type *expect_type, { symbol *sym = std::get<0> (m_storage).symbol; - if (SYMBOL_DOMAIN (sym) == UNDEF_DOMAIN) + if (sym->domain () == UNDEF_DOMAIN) /* Only encountered when an unresolved symbol occurs in a context other than a function call, in which case, it is invalid. */ @@ -10501,7 +10501,7 @@ ada_var_value_operation::resolve (struct expression *exp, struct type *context_type) { symbol *sym = std::get<0> (m_storage).symbol; - if (SYMBOL_DOMAIN (sym) == UNDEF_DOMAIN) + if (sym->domain () == UNDEF_DOMAIN) { block_symbol resolved = ada_resolve_variable (sym, std::get<0> (m_storage).block, @@ -10666,7 +10666,7 @@ ada_funcall_operation::evaluate (struct type *expect_type, ada_var_value_operation *avv = dynamic_cast<ada_var_value_operation *> (callee_op.get ()); if (avv != nullptr - && SYMBOL_DOMAIN (avv->get_symbol ()) == UNDEF_DOMAIN) + && avv->get_symbol ()->domain () == UNDEF_DOMAIN) error (_("Unexpected unresolved symbol, %s, during evaluation"), avv->get_symbol ()->print_name ()); @@ -10810,7 +10810,7 @@ ada_funcall_operation::resolve (struct expression *exp, return false; symbol *sym = avv->get_symbol (); - if (SYMBOL_DOMAIN (sym) != UNDEF_DOMAIN) + if (sym->domain () != UNDEF_DOMAIN) return false; const std::vector<operation_up> &args_up = std::get<1> (m_storage); diff --git a/gdb/block.c b/gdb/block.c index 38773af..7ec56c7 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -664,7 +664,7 @@ block_iter_match_next (const lookup_name_info &name, bool best_symbol (struct symbol *a, const domain_enum domain) { - return (SYMBOL_DOMAIN (a) == domain + return (a->domain () == domain && a->aclass () != LOC_UNRESOLVED); } @@ -678,11 +678,10 @@ better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain) if (b == NULL) return a; - if (SYMBOL_DOMAIN (a) == domain - && SYMBOL_DOMAIN (b) != domain) + if (a->domain () == domain && b->domain () != domain) return a; - if (SYMBOL_DOMAIN (b) == domain - && SYMBOL_DOMAIN (a) != domain) + + if (b->domain () == domain && a->domain () != domain) return b; if (a->aclass () != LOC_UNRESOLVED && b->aclass () == LOC_UNRESOLVED) @@ -730,7 +729,7 @@ block_lookup_symbol (const struct block *block, const char *name, make sure there is no "better" matching symbol, i.e., one with exactly the same domain. PR 16253. */ if (symbol_matches_domain (sym->language (), - SYMBOL_DOMAIN (sym), domain)) + sym->domain (), domain)) other = better_symbol (other, sym, domain); } return other; @@ -751,7 +750,7 @@ block_lookup_symbol (const struct block *block, const char *name, ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym) { if (symbol_matches_domain (sym->language (), - SYMBOL_DOMAIN (sym), domain)) + sym->domain (), domain)) { sym_found = sym; if (!SYMBOL_IS_ARGUMENT (sym)) @@ -819,7 +818,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name, STRUCT vs VAR domain symbols. So if a matching symbol is found, make sure there is no "better" matching symbol, i.e., one with exactly the same domain. PR 16253. */ - if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), sym->domain (), domain)) other = better_symbol (other, sym, domain); } @@ -846,7 +845,7 @@ block_find_symbol (const struct block *block, const char *name, { /* MATCHER is deliberately called second here so that it never sees a non-domain-matching symbol. */ - if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain) + if (symbol_matches_domain (sym->language (), sym->domain (), domain) && matcher (sym, data)) return sym; } diff --git a/gdb/coffread.c b/gdb/coffread.c index 9fef280..8bf7421 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1491,7 +1491,7 @@ patch_opaque_types (struct symtab *s) but search the whole chain, as there may be several syms from different files with the same name. */ if (real_sym->aclass () == LOC_TYPEDEF - && SYMBOL_DOMAIN (real_sym) == VAR_DOMAIN + && real_sym->domain () == VAR_DOMAIN && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) { @@ -1565,7 +1565,7 @@ process_coff_symbol (struct coff_symbol *cs, /* default assumptions */ SYMBOL_VALUE (sym) = cs->c_value; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); sym->set_section_index (cs_to_section (cs, objfile)); if (ISFCN (cs->c_type)) @@ -1653,7 +1653,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_TPDEF: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); /* If type has no name, give it one. */ if (SYMBOL_TYPE (sym)->name () == 0) @@ -1708,7 +1708,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_UNTAG: case C_ENTAG: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; + sym->set_domain (STRUCT_DOMAIN); /* Some compilers try to be helpful by inventing "fake" names for anonymous enums, structures, and unions, like @@ -2099,7 +2099,7 @@ coff_read_enum_type (int index, int length, int lastsym, name = obstack_strdup (&objfile->objfile_obstack, name); sym->set_linkage_name (name); sym->set_aclass_index (LOC_CONST); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); SYMBOL_VALUE (sym) = ms->c_value; add_symbol_to_list (sym, symlist); nsyms++; diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 8602480..41746c2 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -67,7 +67,7 @@ convert_one_symbol (compile_c_instance *context, else sym_type = context->convert_type (SYMBOL_TYPE (sym.symbol)); - if (SYMBOL_DOMAIN (sym.symbol) == STRUCT_DOMAIN) + if (sym.symbol->domain () == STRUCT_DOMAIN) { /* Binding a tag, so we don't need to build a decl. */ context->plugin ().tagbind (sym.symbol->natural_name (), diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index de7afca..3a24aa7 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -58,7 +58,7 @@ convert_one_symbol (compile_cplus_instance *instance, else sym_type = instance->convert_type (SYMBOL_TYPE (sym.symbol)); - if (SYMBOL_DOMAIN (sym.symbol) == STRUCT_DOMAIN) + if (sym.symbol->domain () == STRUCT_DOMAIN) { /* Nothing to do. */ } @@ -374,7 +374,7 @@ gcc_cplus_convert_symbol (void *datum, { found = true; convert_symbol_sym (instance, identifier, it, - SYMBOL_DOMAIN (it.symbol)); + it.symbol->domain ()); } } diff --git a/gdb/ctfread.c b/gdb/ctfread.c index dbafe75..2f8c039 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -451,7 +451,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); sym->set_aclass_index (LOC_CONST); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); SYMBOL_TYPE (sym) = fip->ptype; add_symbol_to_list (sym, ccp->builder->get_global_symbols ()); } @@ -479,7 +479,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; + sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != nullptr) @@ -492,7 +492,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) case CTF_K_UNION: case CTF_K_ENUM: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; + sym->set_domain (STRUCT_DOMAIN); break; case CTF_K_FUNCTION: sym->set_aclass_index (LOC_STATIC); @@ -506,7 +506,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) case CTF_K_INTEGER: case CTF_K_FLOAT: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); break; case CTF_K_POINTER: break; @@ -1170,7 +1170,7 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg) sym = new (&ccp->of->objfile_obstack) symbol; OBJSTAT (ccp->of, n_syms++); SYMBOL_TYPE (sym) = type; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); 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 ()); @@ -1206,7 +1206,7 @@ add_stt_entries (struct ctf_context *ccp, int functions) sym = new (&ccp->of->objfile_obstack) symbol; OBJSTAT (ccp->of, n_syms++); SYMBOL_TYPE (sym) = type; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); 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 ()); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d07c9d2..b62252e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8916,7 +8916,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) sym->compute_and_set_names (saved_package_name, false, objfile->per_bfd); /* 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; + sym->set_domain (STRUCT_DOMAIN); sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_TYPE (sym) = type; @@ -21717,7 +21717,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; + sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != NULL) SYMBOL_TYPE (sym) = type; @@ -21765,7 +21765,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, else sym->set_aclass_index (LOC_OPTIMIZED_OUT); SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr; - SYMBOL_DOMAIN (sym) = LABEL_DOMAIN; + sym->set_domain (LABEL_DOMAIN); add_symbol_to_list (sym, cu->list_in_scope); break; case DW_TAG_subprogram: @@ -21964,7 +21964,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, case DW_TAG_set_type: case DW_TAG_enumeration_type: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; + sym->set_domain (STRUCT_DOMAIN); { /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't @@ -22002,14 +22002,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, break; case DW_TAG_typedef: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (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: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); list_to_add = cu->list_in_scope; break; case DW_TAG_enumerator: @@ -22036,12 +22036,12 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, break; case DW_TAG_module: sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; + sym->set_domain (MODULE_DOMAIN); list_to_add = cu->get_builder ()->get_global_symbols (); break; case DW_TAG_common_block: sym->set_aclass_index (LOC_COMMON_BLOCK); - SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; + sym->set_domain (COMMON_BLOCK_DOMAIN); add_symbol_to_list (sym, cu->list_in_scope); break; default: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 5925937..e8d8627 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -595,7 +595,7 @@ info_common_command_for_block (const struct block *block, const char *comname, get_user_print_options (&opts); ALL_BLOCK_SYMBOLS (block, iter, sym) - if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) + if (sym->domain () == COMMON_BLOCK_DOMAIN) { const struct common_block *common = SYMBOL_VALUE_COMMON_BLOCK (sym); size_t index; @@ -559,7 +559,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter.end; /* The name. */ - SYMBOL_DOMAIN (block_name) = VAR_DOMAIN; + block_name->set_domain (VAR_DOMAIN); block_name->set_aclass_index (LOC_BLOCK); symbol_set_symtab (block_name, filetab); SYMBOL_TYPE (block_name) = lookup_function_type (block_type); diff --git a/gdb/language.c b/gdb/language.c index aff6c21..b33ff7f 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1001,7 +1001,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol SYMBOL_OBJFILE_OWNED (symbol) = 0; symbol->set_section_index (0); SYMBOL_TYPE (symbol) = type; - SYMBOL_DOMAIN (symbol) = VAR_DOMAIN; + symbol->set_domain (VAR_DOMAIN); symbol->set_aclass_index (LOC_TYPEDEF); return symbol; } diff --git a/gdb/linespec.c b/gdb/linespec.c index 0a930e1..ac21bbd 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3995,7 +3995,7 @@ find_label_symbols_in_block (const struct block *block, ALL_BLOCK_SYMBOLS (block, iter, sym) { if (symbol_matches_domain (sym->language (), - SYMBOL_DOMAIN (sym), LABEL_DOMAIN) + sym->domain (), LABEL_DOMAIN) && cmp (sym->search_name (), name, name_len) == 0) { result->push_back ({sym, block}); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 131b033..0a2a4c3 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -562,7 +562,7 @@ add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend, struct symbol *s, int aclass_index, struct block *b, struct objfile *objfile, const char *name) { - SYMBOL_DOMAIN (s) = VAR_DOMAIN; + s->set_domain (VAR_DOMAIN); s->set_aclass_index (aclass_index); add_symbol (s, top_stack->cur_st, b); @@ -675,7 +675,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, name = "this"; /* FIXME, not alloc'd in obstack. */ s = new_symbol (name); - SYMBOL_DOMAIN (s) = VAR_DOMAIN; + s->set_domain (VAR_DOMAIN); SYMBOL_IS_ARGUMENT (s) = 1; switch (sh->sc) { @@ -703,7 +703,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 */ + s->set_domain (VAR_DOMAIN); /* So that it can be used */ 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; @@ -744,7 +744,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, break; } s = new_symbol (name); - SYMBOL_DOMAIN (s) = VAR_DOMAIN; + s->set_domain (VAR_DOMAIN); s->set_aclass_index (LOC_BLOCK); /* Type of the return value. */ if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil) @@ -1067,7 +1067,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, f->name ())); enum_sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (enum_sym) = t; - SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; + enum_sym->set_domain (VAR_DOMAIN); SYMBOL_VALUE (enum_sym) = tsym.value; if (SYMBOL_VALUE (enum_sym) < 0) unsigned_enum = 0; @@ -1097,7 +1097,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, } s = new_symbol (name); - SYMBOL_DOMAIN (s) = STRUCT_DOMAIN; + s->set_domain (STRUCT_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (s) = 0; SYMBOL_TYPE (s) = t; @@ -1154,7 +1154,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; + s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->builtin_void; e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack, @@ -1295,7 +1295,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (has_opaque_xref (cur_fdr, sh)) break; s = new_symbol (name); - SYMBOL_DOMAIN (s) = VAR_DOMAIN; + s->set_domain (VAR_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block; SYMBOL_TYPE (s) = t; @@ -1987,7 +1987,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, #else /* FIXME -- delete. We can't do symbol allocation now; it's all done. */ s = new_symbol (sh_name); - SYMBOL_DOMAIN (s) = VAR_DOMAIN; + s->set_domain (VAR_DOMAIN); SYMBOL_CLASS (s) = LOC_BLOCK; /* Don't know its type, hope int is ok. */ SYMBOL_TYPE (s) @@ -3987,7 +3987,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) mdebug_extra_func_info); struct symbol *s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); - SYMBOL_DOMAIN (s) = LABEL_DOMAIN; + s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void; SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; @@ -4467,7 +4467,7 @@ mylookup_symbol (const char *name, const struct block *block, ALL_BLOCK_SYMBOLS (block, iter, sym) { if (sym->linkage_name ()[0] == inc - && SYMBOL_DOMAIN (sym) == domain + && sym->domain () == domain && sym->aclass () == theclass && strcmp (sym->linkage_name (), name) == 0) return sym; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 467f622..38e9481 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -424,7 +424,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, ld will remove it from the executable. There is then a N_GSYM stab for it, but no regular (C_EXT) symbol. */ sym = new (&objfile->objfile_obstack) symbol; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); sym->set_linkage_name (obstack_strndup (&objfile->objfile_obstack, name, pp - name)); @@ -785,7 +785,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, { sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; } @@ -844,7 +844,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, { sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; } @@ -869,7 +869,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, { sym->set_aclass_index (LOC_CONST); SYMBOL_TYPE (sym) = error_type (&p, objfile); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; } @@ -924,7 +924,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = error_type (&p, objfile); } } - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; @@ -932,7 +932,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* The name of a caught exception. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_LABEL); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); SET_SYMBOL_VALUE_ADDRESS (sym, valu); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -941,7 +941,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* A static function definition. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_BLOCK); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); /* fall into process_function_types. */ @@ -1013,7 +1013,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* A global function definition. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_BLOCK); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_global_symbols ()); goto process_function_types; @@ -1024,7 +1024,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, These definitions appear at the end of the namelist. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_STATIC); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); /* Don't add symbol references to global_sym_chain. Symbol references don't have valid names and wont't match up with minimal symbols when the global_sym_chain is relocated. @@ -1046,7 +1046,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1066,7 +1066,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (LOC_ARG); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); SYMBOL_IS_ARGUMENT (sym) = 1; add_symbol_to_list (sym, get_local_symbols ()); @@ -1116,7 +1116,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (stab_register_index); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1125,7 +1125,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (stab_register_index); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); if (within_function) { /* Sun cc uses a pair of symbols, one 'p' and one 'r', with @@ -1180,7 +1180,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); break; @@ -1211,7 +1211,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); /* C++ vagaries: we may have a type which is derived from a base type which did not have its name defined when the derived class was output. We fill in the derived class's @@ -1288,7 +1288,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, *struct_sym = *sym; struct_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (struct_sym) = valu; - SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; + struct_sym->set_domain (STRUCT_DOMAIN); if (SYMBOL_TYPE (sym)->name () == 0) SYMBOL_TYPE (sym)->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), @@ -1315,7 +1315,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; + sym->set_domain (STRUCT_DOMAIN); if (SYMBOL_TYPE (sym)->name () == 0) SYMBOL_TYPE (sym)->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), @@ -1330,7 +1330,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, *typedef_sym = *sym; typedef_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (typedef_sym) = valu; - SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; + typedef_sym->set_domain (VAR_DOMAIN); if (SYMBOL_TYPE (sym)->name () == 0) SYMBOL_TYPE (sym)->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), @@ -1344,7 +1344,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1354,7 +1354,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (LOC_REF_ARG); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1364,7 +1364,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (stab_regparm_index); SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1376,7 +1376,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1384,7 +1384,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = error_type (&p, objfile); sym->set_aclass_index (LOC_CONST); SYMBOL_VALUE (sym) = 0; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); break; } @@ -1629,7 +1629,7 @@ again: struct symbol *sym = ppt->symbol[i]; if (sym->aclass () == LOC_TYPEDEF - && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN + && sym->domain () == STRUCT_DOMAIN && (SYMBOL_TYPE (sym)->code () == code) && strcmp (sym->linkage_name (), type_name) == 0) { @@ -3593,7 +3593,7 @@ read_enum_type (const char **pp, struct type *type, sym->set_language (get_current_subfile ()->language, &objfile->objfile_obstack); sym->set_aclass_index (LOC_CONST); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); SYMBOL_VALUE (sym) = n; if (n < 0) unsigned_enum = 0; @@ -4467,7 +4467,7 @@ cleanup_undefined_types_1 (void) struct symbol *sym = ppt->symbol[i]; if (sym->aclass () == LOC_TYPEDEF - && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN + && sym->domain () == STRUCT_DOMAIN && (SYMBOL_TYPE (sym)->code () == (*type)->code ()) && ((*type)->instance_flags () == SYMBOL_TYPE (sym)->instance_flags ()) diff --git a/gdb/stack.c b/gdb/stack.c index 1df3f6b..fcdcd35 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2258,7 +2258,7 @@ iterate_over_block_locals (const struct block *b, case LOC_OPTIMIZED_OUT: if (SYMBOL_IS_ARGUMENT (sym)) break; - if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) + if (sym->domain () == COMMON_BLOCK_DOMAIN) break; (*cb) (sym->print_name (), sym, cb_data); break; diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 5c96bf9..9bba067 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -508,7 +508,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, section = NULL; print_spaces_filtered (depth, outfile); - if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN) + if (symbol->domain () == LABEL_DOMAIN) { fprintf_filtered (outfile, "label %s at ", symbol->print_name ()); fputs_filtered (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), @@ -521,7 +521,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, return; } - if (SYMBOL_DOMAIN (symbol) == STRUCT_DOMAIN) + if (symbol->domain () == STRUCT_DOMAIN) { if (SYMBOL_TYPE (symbol)->name ()) { diff --git a/gdb/symtab.c b/gdb/symtab.c index 9357b5b..5e4a461 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1229,7 +1229,7 @@ eq_symbol_entry (const struct symbol_cache_slot *slot, else { slot_name = slot->value.found.symbol->search_name (); - slot_domain = SYMBOL_DOMAIN (slot->value.found.symbol); + slot_domain = slot->value.found.symbol->domain (); } /* NULL names match. */ @@ -1582,7 +1582,7 @@ symbol_cache_dump (const struct symbol_cache *cache) printf_filtered (" [%4u] = %s, %s %s\n", i, host_address_to_string (context), found->print_name (), - domain_name (SYMBOL_DOMAIN (found))); + domain_name (found->domain ())); break; } } @@ -2329,7 +2329,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, break; } if (symbol_matches_domain (result.symbol->language (), - SYMBOL_DOMAIN (result.symbol), domain)) + result.symbol->domain (), domain)) { struct symbol *better = better_symbol (other.symbol, result.symbol, domain); @@ -2906,7 +2906,7 @@ iterate_over_symbols (const struct block *block, ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym) { - if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (sym->language (), sym->domain (), domain)) { struct block_symbol block_sym = {sym, block}; @@ -4847,9 +4847,9 @@ global_symbol_searcher::add_matching_symbols sym))) || (kind == TYPES_DOMAIN && sym->aclass () == LOC_TYPEDEF - && SYMBOL_DOMAIN (sym) != MODULE_DOMAIN) + && sym->domain () != MODULE_DOMAIN) || (kind == MODULES_DOMAIN - && SYMBOL_DOMAIN (sym) == MODULE_DOMAIN + && sym->domain () == MODULE_DOMAIN && SYMBOL_LINE (sym) != 0)))) { if (result_set->size () < m_max_search_results) @@ -5030,7 +5030,7 @@ symbol_to_info_string (struct symbol *sym, int block, /* Typedef that is not a C++ class. */ if (kind == TYPES_DOMAIN - && SYMBOL_DOMAIN (sym) != STRUCT_DOMAIN) + && sym->domain () != STRUCT_DOMAIN) { string_file tmp_stream; @@ -5051,7 +5051,7 @@ symbol_to_info_string (struct symbol *sym, int block, /* variable, func, or typedef-that-is-c++-class. */ else if (kind < TYPES_DOMAIN || (kind == TYPES_DOMAIN - && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN)) + && sym->domain () == STRUCT_DOMAIN)) { string_file tmp_stream; @@ -5525,7 +5525,7 @@ completion_list_add_symbol (completion_tracker &tracker, the msymbol name and removes the msymbol name from the completion tracker. */ if (sym->language () == language_cplus - && SYMBOL_DOMAIN (sym) == VAR_DOMAIN + && sym->domain () == VAR_DOMAIN && sym->aclass () == LOC_BLOCK) { /* The call to canonicalize returns the empty string if the input @@ -5788,7 +5788,7 @@ add_symtab_completions (struct compunit_symtab *cust, continue; if (code == TYPE_CODE_UNDEF - || (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN + || (sym->domain () == STRUCT_DOMAIN && SYMBOL_TYPE (sym)->code () == code)) completion_list_add_symbol (tracker, sym, lookup_name, @@ -5941,7 +5941,7 @@ default_collect_symbol_completion_matches_break_on completion_list_add_fields (tracker, sym, lookup_name, sym_text, word); } - else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN + else if (sym->domain () == STRUCT_DOMAIN && SYMBOL_TYPE (sym)->code () == code) completion_list_add_symbol (tracker, sym, lookup_name, sym_text, word); diff --git a/gdb/symtab.h b/gdb/symtab.h index a00b48f..2825697 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1113,7 +1113,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), + : m_domain (UNDEF_DOMAIN), m_aclass_index (0), is_objfile_owned (1), is_argument (0), @@ -1158,6 +1158,16 @@ struct symbol : public general_symbol_info, public allocate_on_obstack return this->impl ().aclass; } + domain_enum domain () const + { + return m_domain; + } + + void set_domain (domain_enum domain) + { + m_domain = domain; + } + /* Data type of value */ struct type *type = nullptr; @@ -1178,7 +1188,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack /* Domain code. */ - ENUM_BITFIELD(domain_enum_tag) domain : SYMBOL_DOMAIN_BITS; + ENUM_BITFIELD(domain_enum_tag) m_domain : SYMBOL_DOMAIN_BITS; /* Address class. This holds an index into the 'symbol_impls' table. The actual enum address_class value is stored there, @@ -1260,7 +1270,6 @@ struct block_symbol /* Note: There is no accessor macro for symbol.owner because it is "private". */ -#define SYMBOL_DOMAIN(symbol) (symbol)->domain #define SYMBOL_OBJFILE_OWNED(symbol) ((symbol)->is_objfile_owned) #define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument #define SYMBOL_INLINED(symbol) (symbol)->is_inlined diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 6458e9f..bdfbdbf 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1562,7 +1562,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) /* default assumptions */ SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off); - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + sym->set_domain (VAR_DOMAIN); sym->set_section_index (secnum_to_section (cs->c_secnum, objfile)); if (ISFCN (cs->c_type)) |