From: Simon Marchi Date: Mon, 22 Nov 2021 03:26:24 +0000 (-0500) Subject: gdb: remove SYMBOL_CLASS macro, add getter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66d7f48f8045adf266046df7ceb84161d5678cfa;p=binutils-gdb.git gdb: remove SYMBOL_CLASS macro, add getter Change-Id: I83211d5a47efc0564386e5b5ea4a29c00b1fd46a --- diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 0d5083f513b..c9fce7d40b0 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1157,7 +1157,7 @@ write_object_renaming (struct parser_state *par_state, ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info); if (sym_info.symbol == NULL) error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ()); - else if (SYMBOL_CLASS (sym_info.symbol) == LOC_TYPEDEF) + else if (sym_info.symbol->aclass () == LOC_TYPEDEF) /* We have a renaming of an old-style renaming symbol. Don't trust the block information. */ sym_info.block = orig_left_context; @@ -1226,7 +1226,7 @@ write_object_renaming (struct parser_state *par_state, VAR_DOMAIN, &index_sym_info); if (index_sym_info.symbol == NULL) error (_("Could not find %s"), index_name); - else if (SYMBOL_CLASS (index_sym_info.symbol) == LOC_TYPEDEF) + else if (index_sym_info.symbol->aclass () == LOC_TYPEDEF) /* Index is an old-style renaming symbol. */ index_sym_info.block = orig_left_context; write_var_from_sym (par_state, index_sym_info); @@ -1296,14 +1296,14 @@ block_lookup (const struct block *context, const char *raw_name) = ada_lookup_symbol_list (name, context, VAR_DOMAIN); if (context == NULL - && (syms.empty () || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK)) + && (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK)) symtab = lookup_symtab (name); else symtab = NULL; if (symtab != NULL) result = BLOCKVECTOR_BLOCK (symtab->blockvector (), STATIC_BLOCK); - else if (syms.empty () || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK) + else if (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK) { if (context == NULL) error (_("No file or function \"%s\"."), raw_name); @@ -1329,7 +1329,7 @@ select_possible_type_sym (const std::vector &syms) preferred_index = -1; preferred_type = NULL; for (i = 0; i < syms.size (); i += 1) - switch (SYMBOL_CLASS (syms[i].symbol)) + switch (syms[i].symbol->aclass ()) { case LOC_TYPEDEF: if (ada_prefer_type (SYMBOL_TYPE (syms[i].symbol), preferred_type)) @@ -1373,7 +1373,7 @@ find_primitive_type (struct parser_state *par_state, const char *name) strcpy (expanded_name, "standard__"); strcat (expanded_name, name); sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN).symbol; - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym != NULL && sym->aclass () == LOC_TYPEDEF) type = SYMBOL_TYPE (sym); } @@ -1690,7 +1690,7 @@ write_name_assoc (struct parser_state *par_state, struct stoken name) par_state->expression_context_block, VAR_DOMAIN); - if (syms.size () != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF) + if (syms.size () != 1 || syms[0].symbol->aclass () == LOC_TYPEDEF) pstate->push_new (copy_name (name)); else write_var_from_sym (par_state, syms[0]); diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index e6bfb8e1467..c689548aab6 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3325,7 +3325,7 @@ See set/show multiple-symbol.")); if (syms[i].symbol == NULL) continue; - if (SYMBOL_CLASS (syms[i].symbol) == LOC_BLOCK) + if (syms[i].symbol->aclass () == LOC_BLOCK) { struct symtab_and_line sal = find_function_start_sal (syms[i].symbol, 1); @@ -3347,7 +3347,7 @@ See set/show multiple-symbol.")); else { int is_enumeral = - (SYMBOL_CLASS (syms[i].symbol) == LOC_CONST + (syms[i].symbol->aclass () == LOC_CONST && SYMBOL_TYPE (syms[i].symbol) != NULL && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); struct symtab *symtab = NULL; @@ -3491,7 +3491,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block, candidates.end (), [] (block_symbol &bsym) { - switch (SYMBOL_CLASS (bsym.symbol)) + switch (bsym.symbol->aclass ()) { case LOC_REGISTER: case LOC_ARG: @@ -3514,7 +3514,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block, candidates.end (), [] (block_symbol &bsym) { - return SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF; + return bsym.symbol->aclass () == LOC_TYPEDEF; }), candidates.end ()); } @@ -3628,7 +3628,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals) int i; struct type *func_type = SYMBOL_TYPE (func); - if (SYMBOL_CLASS (func) == LOC_CONST + if (func->aclass () == LOC_CONST && func_type->code () == TYPE_CODE_ENUM) return (n_actuals == 0); else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC) @@ -3934,7 +3934,7 @@ ada_parse_renaming (struct symbol *sym, if (sym == NULL) return ADA_NOT_RENAMING; - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { default: return ADA_NOT_RENAMING; @@ -4443,7 +4443,7 @@ is_nonfunction (const std::vector &syms) for (const block_symbol &sym : syms) if (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_FUNC && (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_ENUM - || SYMBOL_CLASS (sym.symbol) != LOC_CONST)) + || sym.symbol->aclass () != LOC_CONST)) return 1; return 0; @@ -4478,10 +4478,10 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) if (sym0 == sym1) return 1; if (SYMBOL_DOMAIN (sym0) != SYMBOL_DOMAIN (sym1) - || SYMBOL_CLASS (sym0) != SYMBOL_CLASS (sym1)) + || sym0->aclass () != sym1->aclass ()) return 0; - switch (SYMBOL_CLASS (sym0)) + switch (sym0->aclass ()) { case LOC_UNDEF: return 1; @@ -4743,7 +4743,7 @@ remove_extra_symbols (std::vector *syms) should be identical. */ else if ((*syms)[i].symbol->linkage_name () != NULL - && SYMBOL_CLASS ((*syms)[i].symbol) == LOC_STATIC + && (*syms)[i].symbol->aclass () == LOC_STATIC && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol))) { for (j = 0; j < syms->size (); j += 1) @@ -4752,8 +4752,8 @@ remove_extra_symbols (std::vector *syms) && (*syms)[j].symbol->linkage_name () != NULL && strcmp ((*syms)[i].symbol->linkage_name (), (*syms)[j].symbol->linkage_name ()) == 0 - && SYMBOL_CLASS ((*syms)[i].symbol) - == SYMBOL_CLASS ((*syms)[j].symbol) + && ((*syms)[i].symbol->aclass () + == (*syms)[j].symbol->aclass ()) && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol) == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol)) remove_p = 1; @@ -4845,7 +4845,7 @@ is_package_name (const char *name) static int old_renaming_is_invisible (const struct symbol *sym, const char *function_name) { - if (SYMBOL_CLASS (sym) != LOC_TYPEDEF) + if (sym->aclass () != LOC_TYPEDEF) return 0; std::string scope = xget_renaming_scope (SYMBOL_TYPE (sym)); @@ -4924,7 +4924,7 @@ remove_irrelevant_renamings (std::vector *syms, const char *name; const char *suffix; - if (sym == NULL || SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym == NULL || sym->aclass () == LOC_TYPEDEF) continue; name = sym->linkage_name (); suffix = strstr (name, "___XR"); @@ -5051,7 +5051,7 @@ match_data::operator() (struct block_symbol *bsym) } else { - if (SYMBOL_CLASS (sym) == LOC_UNRESOLVED) + if (sym->aclass () == LOC_UNRESOLVED) return true; else if (SYMBOL_IS_ARGUMENT (sym)) arg_sym = sym; @@ -5742,7 +5742,7 @@ ada_add_block_symbols (std::vector &result, { if (symbol_matches_domain (sym->language (), SYMBOL_DOMAIN (sym), domain)) { - if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) + if (sym->aclass () != LOC_UNRESOLVED) { if (SYMBOL_IS_ARGUMENT (sym)) arg_sym = sym; @@ -5796,7 +5796,7 @@ ada_add_block_symbols (std::vector &result, if (cmp == 0 && is_name_suffix (sym->linkage_name () + name_len + 5)) { - if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) + if (sym->aclass () != LOC_UNRESOLVED) { if (SYMBOL_IS_ARGUMENT (sym)) arg_sym = sym; @@ -7214,7 +7214,7 @@ ada_find_any_type_symbol (const char *name) struct symbol *sym; sym = standard_lookup (name, get_selected_block (NULL), VAR_DOMAIN); - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym != NULL && sym->aclass () == LOC_TYPEDEF) return sym; sym = standard_lookup (name, NULL, STRUCT_DOMAIN); @@ -11253,10 +11253,10 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) /* Make sure that the symbol we found corresponds to a function. */ - if (SYMBOL_CLASS (sym) != LOC_BLOCK) + if (sym->aclass () != LOC_BLOCK) { error (_("Symbol \"%s\" is not a function (class = %d)"), - sym->linkage_name (), SYMBOL_CLASS (sym)); + sym->linkage_name (), sym->aclass ()); return 0; } @@ -11276,10 +11276,10 @@ ada_has_this_exception_support (const struct exception_support_info *einfo) /* Make sure that the symbol we found corresponds to a function. */ - if (SYMBOL_CLASS (sym) != LOC_BLOCK) + if (sym->aclass () != LOC_BLOCK) { error (_("Symbol \"%s\" is not a function (class = %d)"), - sym->linkage_name (), SYMBOL_CLASS (sym)); + sym->linkage_name (), sym->aclass ()); return 0; } @@ -12246,7 +12246,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, if (sym == NULL) error (_("Catchpoint symbol not found: %s"), sym_name); - if (SYMBOL_CLASS (sym) != LOC_BLOCK) + if (sym->aclass () != LOC_BLOCK) error (_("Unable to insert catchpoint. %s is not a function."), sym_name); /* Set ADDR_STRING. */ @@ -12420,10 +12420,10 @@ ada_is_exception_sym (struct symbol *sym) { const char *type_name = SYMBOL_TYPE (sym)->name (); - return (SYMBOL_CLASS (sym) != LOC_TYPEDEF - && SYMBOL_CLASS (sym) != LOC_BLOCK - && SYMBOL_CLASS (sym) != LOC_CONST - && SYMBOL_CLASS (sym) != LOC_UNRESOLVED + return (sym->aclass () != LOC_TYPEDEF + && sym->aclass () != LOC_BLOCK + && sym->aclass () != LOC_CONST + && sym->aclass () != LOC_UNRESOLVED && type_name != NULL && strcmp (type_name, "exception") == 0); } @@ -12545,7 +12545,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg, ALL_BLOCK_SYMBOLS (block, iter, sym) { - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_TYPEDEF: case LOC_BLOCK: diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 0383ec6c1a7..7ba44c4c8c0 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -520,7 +520,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) } /* I'm imitating the code in read_var_value. */ - switch (SYMBOL_CLASS (var)) + switch (var->aclass ()) { case LOC_CONST: /* A constant, like an enum value. */ ax_const_l (ax, (LONGEST) SYMBOL_VALUE (var)); diff --git a/gdb/block.c b/gdb/block.c index c0e3e465a11..38773afe6a6 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -665,7 +665,7 @@ bool best_symbol (struct symbol *a, const domain_enum domain) { return (SYMBOL_DOMAIN (a) == domain - && SYMBOL_CLASS (a) != LOC_UNRESOLVED); + && a->aclass () != LOC_UNRESOLVED); } /* See block.h. */ @@ -685,11 +685,10 @@ better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain) && SYMBOL_DOMAIN (a) != domain) return b; - if (SYMBOL_CLASS (a) != LOC_UNRESOLVED - && SYMBOL_CLASS (b) == LOC_UNRESOLVED) + if (a->aclass () != LOC_UNRESOLVED && b->aclass () == LOC_UNRESOLVED) return a; - if (SYMBOL_CLASS (b) != LOC_UNRESOLVED - && SYMBOL_CLASS (a) == LOC_UNRESOLVED) + + if (b->aclass () != LOC_UNRESOLVED && a->aclass () == LOC_UNRESOLVED) return b; return a; diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 4b58ce04100..73347243f55 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1093,7 +1093,7 @@ block : block COLONCOLON name = lookup_symbol (copy.c_str (), $1, VAR_DOMAIN, NULL).symbol; - if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + if (!tem || tem->aclass () != LOC_BLOCK) error (_("No function \"%s\" in specified context."), copy.c_str ()); $$ = SYMBOL_BLOCK_VALUE (tem); } @@ -3067,7 +3067,7 @@ classify_name (struct parser_state *par_state, const struct block *block, par_state->language ()->name_of_this () ? &is_a_field_of_this : NULL); - if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK) + if (bsym.symbol && bsym.symbol->aclass () == LOC_BLOCK) { yylval.ssym.sym = bsym; yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; @@ -3116,7 +3116,7 @@ classify_name (struct parser_state *par_state, const struct block *block, } } - if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF) + if (bsym.symbol && bsym.symbol->aclass () == LOC_TYPEDEF) { yylval.tsym.type = SYMBOL_TYPE (bsym.symbol); return TYPENAME; @@ -3211,7 +3211,7 @@ classify_inner_name (struct parser_state *par_state, return ERROR; } - switch (SYMBOL_CLASS (yylval.ssym.sym.symbol)) + switch (yylval.ssym.sym.symbol->aclass ()) { case LOC_BLOCK: case LOC_LABEL: diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index a24ada66434..14d671e2989 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -883,7 +883,7 @@ c_type_print_template_args (const struct type_print_options *flags, { struct symbol *sym = TYPE_TEMPLATE_ARGUMENT (type, i); - if (SYMBOL_CLASS (sym) != LOC_TYPEDEF) + if (sym->aclass () != LOC_TYPEDEF) continue; if (first) diff --git a/gdb/coffread.c b/gdb/coffread.c index d4c4226a8d2..9fef2801976 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1490,7 +1490,7 @@ patch_opaque_types (struct symtab *s) Remove syms from the chain when their types are stored, but search the whole chain, as there may be several syms from different files with the same name. */ - if (SYMBOL_CLASS (real_sym) == LOC_TYPEDEF + if (real_sym->aclass () == LOC_TYPEDEF && SYMBOL_DOMAIN (real_sym) == VAR_DOMAIN && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 96a7b786b39..8602480d01a 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -62,7 +62,7 @@ convert_one_symbol (compile_c_instance *context, context->error_symbol_once (sym.symbol); - if (SYMBOL_CLASS (sym.symbol) == LOC_LABEL) + if (sym.symbol->aclass () == LOC_LABEL) sym_type = 0; else sym_type = context->convert_type (SYMBOL_TYPE (sym.symbol)); @@ -80,7 +80,7 @@ convert_one_symbol (compile_c_instance *context, CORE_ADDR addr = 0; gdb::unique_xmalloc_ptr symbol_name; - switch (SYMBOL_CLASS (sym.symbol)) + switch (sym.symbol->aclass ()) { case LOC_TYPEDEF: kind = GCC_C_SYMBOL_TYPEDEF; @@ -398,7 +398,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context, /* We only need global functions here. */ sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL).symbol; - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym != NULL && sym->aclass () == LOC_BLOCK) { if (compile_debug) fprintf_unfiltered (gdb_stdlog, @@ -577,7 +577,7 @@ generate_c_for_for_one_variable (compile_instance *compiler, } else { - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_REGISTER: case LOC_ARG: diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 7d265357a2e..de7afcaebcf 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -53,7 +53,7 @@ convert_one_symbol (compile_cplus_instance *instance, instance->error_symbol_once (sym.symbol); - if (SYMBOL_CLASS (sym.symbol) == LOC_LABEL) + if (sym.symbol->aclass () == LOC_LABEL) sym_type = 0; else sym_type = instance->convert_type (SYMBOL_TYPE (sym.symbol)); @@ -70,7 +70,7 @@ convert_one_symbol (compile_cplus_instance *instance, std::string name; gdb::unique_xmalloc_ptr symbol_name; - switch (SYMBOL_CLASS (sym.symbol)) + switch (sym.symbol->aclass ()) { case LOC_TYPEDEF: if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF) @@ -435,7 +435,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context, struct symbol *sym = lookup_symbol (identifier, nullptr, VAR_DOMAIN, nullptr).symbol; - if (sym != nullptr && SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym != nullptr && sym->aclass () == LOC_BLOCK) { if (compile_debug) fprintf_unfiltered (gdb_stdlog, diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 028ff0f4754..f146183f377 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1501,7 +1501,7 @@ cp_lookup_rtti_type (const char *name, const struct block *block) return NULL; } - if (SYMBOL_CLASS (rtti_sym) != LOC_TYPEDEF) + if (rtti_sym->aclass () != LOC_TYPEDEF) { warning (_("RTTI symbol for class '%s' is not a type"), name); return NULL; diff --git a/gdb/d-exp.y b/gdb/d-exp.y index ef858ecbd4b..601659d080d 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -448,7 +448,7 @@ PrimaryExpression: sym = lookup_symbol (copy.c_str (), pstate->expression_context_block, VAR_DOMAIN, &is_a_field_of_this); - if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) + if (sym.symbol && sym.symbol->aclass () != LOC_TYPEDEF) { if (symbol_read_needs_frame (sym.symbol)) pstate->block_tracker->update (sym); @@ -1341,7 +1341,7 @@ classify_name (struct parser_state *par_state, const struct block *block) std::string copy = copy_name (yylval.sval); sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this); - if (sym.symbol && SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF) + if (sym.symbol && sym.symbol->aclass () == LOC_TYPEDEF) { yylval.tsym.type = SYMBOL_TYPE (sym.symbol); return TYPENAME; @@ -1388,7 +1388,7 @@ classify_inner_name (struct parser_state *par_state, if (yylval.ssym.sym.symbol == NULL) return ERROR; - if (SYMBOL_CLASS (yylval.ssym.sym.symbol) == LOC_TYPEDEF) + if (yylval.ssym.sym.symbol->aclass () == LOC_TYPEDEF) { yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol); return TYPENAME; diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1155efb6df7..d07c9d26abd 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8879,7 +8879,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) struct symbol *sym = list->symbol[i]; if (sym->language () == language_go - && SYMBOL_CLASS (sym) == LOC_BLOCK) + && sym->aclass () == LOC_BLOCK) { gdb::unique_xmalloc_ptr this_package_name (go_symbol_package_name (sym)); @@ -21844,7 +21844,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, && die->parent->tag == DW_TAG_common_block) attr2 = NULL; - if (SYMBOL_CLASS (sym) == LOC_STATIC + if (sym->aclass () == LOC_STATIC && SYMBOL_VALUE_ADDRESS (sym) == 0 && !per_objfile->per_bfd->has_section_at_zero) { @@ -21855,7 +21855,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, } else if (attr2 != nullptr && attr2->as_boolean ()) { - if (SYMBOL_CLASS (sym) == LOC_STATIC + if (sym->aclass () == LOC_STATIC && (objfile->flags & OBJF_MAINLINE) == 0 && per_objfile->per_bfd->can_copy) { @@ -21918,7 +21918,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, else if (!die_is_declaration (die, cu)) { /* Use the default LOC_OPTIMIZED_OUT class. */ - gdb_assert (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT); + gdb_assert (sym->aclass () == LOC_OPTIMIZED_OUT); if (!suppress_add) list_to_add = cu->list_in_scope; } diff --git a/gdb/eval.c b/gdb/eval.c index 713f977bc77..91ff41cfe25 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2588,7 +2588,7 @@ var_value_operation::evaluate_for_address (struct expression *exp, if (noside == EVAL_AVOID_SIDE_EFFECTS) { struct type *type = lookup_pointer_type (SYMBOL_TYPE (var)); - enum address_class sym_class = SYMBOL_CLASS (var); + enum address_class sym_class = var->aclass (); if (sym_class == LOC_CONST || sym_class == LOC_CONST_BYTES diff --git a/gdb/expop.h b/gdb/expop.h index 279774ca3af..58863b8f3ab 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -482,7 +482,7 @@ check_constant (ULONGEST cst) static inline bool check_constant (struct symbol *sym) { - enum address_class sc = SYMBOL_CLASS (sym); + enum address_class sc = sym->aclass (); return (sc == LOC_BLOCK || sc == LOC_CONST || sc == LOC_CONST_BYTES diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 42d3130bf8a..13f8c10897f 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1487,7 +1487,7 @@ yylex (void) { result = lookup_symbol (tmp.c_str (), pstate->expression_context_block, domain, NULL); - if (result.symbol && SYMBOL_CLASS (result.symbol) == LOC_TYPEDEF) + if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF) { yylval.tsym.type = SYMBOL_TYPE (result.symbol); return TYPENAME; diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 3d13eb11fb0..592593715c9 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -600,7 +600,7 @@ info_common_command_for_block (const struct block *block, const char *comname, const struct common_block *common = SYMBOL_VALUE_COMMON_BLOCK (sym); size_t index; - gdb_assert (SYMBOL_CLASS (sym) == LOC_COMMON_BLOCK); + gdb_assert (sym->aclass () == LOC_COMMON_BLOCK); if (comname && (!sym->linkage_name () || strcmp (comname, sym->linkage_name ()) != 0)) diff --git a/gdb/findvar.c b/gdb/findvar.c index 8fcdcbb92b2..fdfad599f32 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -358,7 +358,7 @@ symbol_read_needs (struct symbol *sym) if (SYMBOL_COMPUTED_OPS (sym) != NULL) return SYMBOL_COMPUTED_OPS (sym)->get_symbol_read_needs (sym); - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { /* All cases listed explicitly so that gcc -Wall will detect it if we failed to consider one. */ @@ -616,7 +616,7 @@ language_defn::read_var_value (struct symbol *var, if (SYMBOL_COMPUTED_OPS (var) != NULL) return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame); - switch (SYMBOL_CLASS (var)) + switch (var->aclass ()) { case LOC_CONST: if (is_dynamic_type (type)) @@ -718,7 +718,7 @@ language_defn::read_var_value (struct symbol *var, ->register_number (var, get_frame_arch (frame)); struct value *regval; - if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR) + if (var->aclass () == LOC_REGPARM_ADDR) { regval = value_from_register (lookup_pointer_type (type), regno, diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 79584473310..2e7f6540f94 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1690,7 +1690,7 @@ lookup_typename (const struct language_defn *language, sym = lookup_symbol_in_language (name, block, VAR_DOMAIN, language->la_language, NULL).symbol; - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym != NULL && sym->aclass () == LOC_TYPEDEF) return SYMBOL_TYPE (sym); if (noerr) diff --git a/gdb/go-exp.y b/gdb/go-exp.y index 359af226056..5436072d66e 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1338,7 +1338,7 @@ package_name_p (const char *name, const struct block *block) sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol; if (sym - && SYMBOL_CLASS (sym) == LOC_TYPEDEF + && sym->aclass () == LOC_TYPEDEF && SYMBOL_TYPE (sym)->code () == TYPE_CODE_MODULE) return 1; diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 05e6b88fc84..9816a90a8dd 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -412,7 +412,7 @@ gdbscm_symbol_addr_class (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - return scm_from_int (SYMBOL_CLASS (symbol)); + return scm_from_int (symbol->aclass ()); } /* (symbol-argument? ) -> boolean */ @@ -437,7 +437,7 @@ gdbscm_symbol_constant_p (SCM self) const struct symbol *symbol = s_smob->symbol; enum address_class theclass; - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return scm_from_bool (theclass == LOC_CONST || theclass == LOC_CONST_BYTES); } @@ -452,7 +452,7 @@ gdbscm_symbol_function_p (SCM self) const struct symbol *symbol = s_smob->symbol; enum address_class theclass; - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return scm_from_bool (theclass == LOC_BLOCK); } @@ -467,7 +467,7 @@ gdbscm_symbol_variable_p (SCM self) const struct symbol *symbol = s_smob->symbol; enum address_class theclass; - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return scm_from_bool (!SYMBOL_IS_ARGUMENT (symbol) && (theclass == LOC_LOCAL || theclass == LOC_REGISTER @@ -534,7 +534,7 @@ gdbscm_symbol_value (SCM self, SCM rest) if (!gdbscm_is_false (frame_scm)) f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME); - if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF) + if (symbol->aclass () == LOC_TYPEDEF) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, _("cannot get the value of a typedef")); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 994dd5b32a3..b02040f68d3 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -976,7 +976,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) if (inline_skipped_frames (tp) > 0) { symbol *sym = inline_skipped_symbol (tp); - if (SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym->aclass () == LOC_BLOCK) { const block *block = SYMBOL_BLOCK_VALUE (sym); if (BLOCK_END (block) < tp->control.step_range_end) diff --git a/gdb/linespec.c b/gdb/linespec.c index bacf34309a5..0a930e148ed 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -204,7 +204,7 @@ collect_info::add_symbol (block_symbol *bsym) { /* In list mode, add all matching symbols, regardless of class. This allows the user to type "list a_global_variable". */ - if (SYMBOL_CLASS (bsym->symbol) == LOC_BLOCK || this->state->list_mode) + if (bsym->symbol->aclass () == LOC_BLOCK || this->state->list_mode) this->result.symbols->push_back (*bsym); /* Continue iterating. */ @@ -2298,7 +2298,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) if (state->funfirstline && !ls->minimal_symbols.empty () - && SYMBOL_CLASS (sym.symbol) == LOC_BLOCK) + && sym.symbol->aclass () == LOC_BLOCK) { const CORE_ADDR addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol)); @@ -3491,7 +3491,7 @@ decode_compound_collector::operator () (block_symbol *bsym) struct type *t; struct symbol *sym = bsym->symbol; - if (SYMBOL_CLASS (sym) != LOC_TYPEDEF) + if (sym->aclass () != LOC_TYPEDEF) return true; /* Continue iterating. */ t = SYMBOL_TYPE (sym); @@ -4439,14 +4439,14 @@ static int symbol_to_sal (struct symtab_and_line *result, int funfirstline, struct symbol *sym) { - if (SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym->aclass () == LOC_BLOCK) { *result = find_function_start_sal (sym, funfirstline); return 1; } else { - if (SYMBOL_CLASS (sym) == LOC_LABEL && SYMBOL_VALUE_ADDRESS (sym) != 0) + if (sym->aclass () == LOC_LABEL && SYMBOL_VALUE_ADDRESS (sym) != 0) { *result = {}; result->symtab = symbol_symtab (sym); diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 86409cf78b1..02e3cf1b4e7 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -507,7 +507,7 @@ fblock : block COLONCOLON BLOCKNAME { struct symbol *tem = lookup_symbol (copy_name ($3).c_str (), $1, VAR_DOMAIN, 0).symbol; - if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + if (!tem || tem->aclass () != LOC_BLOCK) error (_("No function \"%s\" in specified context."), copy_name ($3).c_str ()); $$ = tem; @@ -932,7 +932,7 @@ yylex (void) return BLOCKNAME; sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block, VAR_DOMAIN, 0).symbol; - if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym && sym->aclass () == LOC_BLOCK) return BLOCKNAME; if (lookup_typename (pstate->language (), tmp.c_str (), pstate->expression_context_block, 1)) @@ -940,7 +940,7 @@ yylex (void) if(sym) { - switch(SYMBOL_CLASS (sym)) + switch(sym->aclass ()) { case LOC_STATIC: case LOC_REGISTER: diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index e0d108935e1..131b033777c 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4468,7 +4468,7 @@ mylookup_symbol (const char *name, const struct block *block, { if (sym->linkage_name ()[0] == inc && SYMBOL_DOMAIN (sym) == domain - && SYMBOL_CLASS (sym) == theclass + && sym->aclass () == theclass && strcmp (sym->linkage_name (), name) == 0) return sym; } diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 87ed547e5fb..0c2172f0c63 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -599,7 +599,7 @@ list_args_or_locals (const frame_print_options &fp_opts, { int print_me = 0; - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { default: case LOC_UNDEF: /* catches errors */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 1c080bbe50f..5cd72ae2451 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -483,7 +483,7 @@ msymbol_is_micromips (struct minimal_symbol *msym) static void mips_make_symbol_special (struct symbol *sym, struct objfile *objfile) { - if (SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym->aclass () == LOC_BLOCK) { /* We are in symbol reading so it is OK to cast away constness. */ struct block *block = (struct block *) SYMBOL_BLOCK_VALUE (sym); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 90163ca59b8..35b275ad301 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -616,8 +616,8 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile, any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN. But I'm leaving out that test, on the theory that they can't possibly pass the tests below. */ - if ((SYMBOL_CLASS (sym) == LOC_LABEL - || SYMBOL_CLASS (sym) == LOC_STATIC) + if ((sym->aclass () == LOC_LABEL + || sym->aclass () == LOC_STATIC) && sym->section_index () >= 0) { SET_SYMBOL_VALUE_ADDRESS (sym, diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 10738d073f6..c7fa0dc882d 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -635,7 +635,7 @@ block : block COLONCOLON name = lookup_symbol (copy.c_str (), $1, VAR_DOMAIN, NULL).symbol; - if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + if (!tem || tem->aclass () != LOC_BLOCK) error (_("No function \"%s\" in specified context."), copy.c_str ()); $$ = SYMBOL_BLOCK_VALUE (tem); } @@ -1544,7 +1544,7 @@ yylex (void) /* Call lookup_symtab, not lookup_partial_symtab, in case there are no psymtabs (coff, xcoff, or some future change to blow away the psymtabs once once symbols are read). */ - if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + if ((sym && sym->aclass () == LOC_BLOCK) || lookup_symtab (tmp.c_str ())) { yylval.ssym.sym.symbol = sym; @@ -1553,7 +1553,7 @@ yylex (void) free (uptokstart); return BLOCKNAME; } - if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym && sym->aclass () == LOC_TYPEDEF) { #if 1 /* Despite the following flaw, we need to keep this code enabled. @@ -1622,7 +1622,7 @@ yylex (void) VAR_DOMAIN, NULL).symbol; if (cur_sym) { - if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) + if (cur_sym->aclass () == LOC_TYPEDEF) { best_sym = cur_sym; pstate->lexptr = p; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index ab87310965d..0b0a1d63a81 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1700,7 +1700,7 @@ info_address_command (const char *exp, int from_tty) return; } - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_CONST: case LOC_CONST_BYTES: diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 708fcc535e2..70fec4aad5d 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -169,7 +169,7 @@ mi_should_print (struct symbol *sym, enum mi_print_types type) { int print_me = 0; - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { default: case LOC_UNDEF: /* catches errors */ diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index f636f5119a1..fe62809c19b 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -131,7 +131,7 @@ sympy_get_addr_class (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - return gdb_py_object_from_longest (SYMBOL_CLASS (symbol)).release (); + return gdb_py_object_from_longest (symbol->aclass ()).release (); } static PyObject * @@ -152,7 +152,7 @@ sympy_is_constant (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES); } @@ -165,7 +165,7 @@ sympy_is_function (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return PyBool_FromLong (theclass == LOC_BLOCK); } @@ -178,7 +178,7 @@ sympy_is_variable (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - theclass = SYMBOL_CLASS (symbol); + theclass = symbol->aclass (); return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol) && (theclass == LOC_LOCAL || theclass == LOC_REGISTER @@ -260,7 +260,7 @@ sympy_value (PyObject *self, PyObject *args) } SYMPY_REQUIRE_VALID (self, symbol); - if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF) + if (symbol->aclass () == LOC_TYPEDEF) { PyErr_SetString (PyExc_TypeError, "cannot get the value of a typedef"); return NULL; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index e71e635ecdf..6ab551a8520 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -997,9 +997,9 @@ typy_template_argument (PyObject *self, PyObject *args) } sym = TYPE_TEMPLATE_ARGUMENT (type, argno); - if (SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym->aclass () == LOC_TYPEDEF) return type_to_type_object (SYMBOL_TYPE (sym)); - else if (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT) + else if (sym->aclass () == LOC_OPTIMIZED_OUT) { PyErr_Format (PyExc_RuntimeError, _("Template argument is optimized out")); diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c index 8be7d33cfe9..75f8a3cf6ad 100644 --- a/gdb/rust-parse.c +++ b/gdb/rust-parse.c @@ -1210,14 +1210,14 @@ rust_parser::name_to_operation (const std::string &name) struct block_symbol sym = lookup_symbol (name.c_str (), pstate->expression_context_block, VAR_DOMAIN); - if (sym.symbol != nullptr && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) + if (sym.symbol != nullptr && sym.symbol->aclass () != LOC_TYPEDEF) return make_operation (sym); struct type *type = nullptr; if (sym.symbol != nullptr) { - gdb_assert (SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF); + gdb_assert (sym.symbol->aclass () == LOC_TYPEDEF); type = SYMBOL_TYPE (sym.symbol); } if (type == nullptr) diff --git a/gdb/source.c b/gdb/source.c index 53854c02eac..249a88318e0 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -323,7 +323,7 @@ select_source_symtab (struct symtab *s) /* Make the default place to list be the function `main' if one exists. */ block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0); - if (bsym.symbol != nullptr && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK) + if (bsym.symbol != nullptr && bsym.symbol->aclass () == LOC_BLOCK) { symtab_and_line sal = find_function_start_sal (bsym.symbol, true); if (sal.symtab == NULL) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 21f824f6e73..467f622a367 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1155,8 +1155,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct symbol *prev_sym; prev_sym = local_symbols->symbol[local_symbols->nsyms - 1]; - if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG - || SYMBOL_CLASS (prev_sym) == LOC_ARG) + if ((prev_sym->aclass () == LOC_REF_ARG + || prev_sym->aclass () == LOC_ARG) && strcmp (prev_sym->linkage_name (), sym->linkage_name ()) == 0) { @@ -1398,11 +1398,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) + if (sym->aclass () == LOC_REGISTER) 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) + else if (sym->aclass () == LOC_ARG) sym->set_aclass_index (LOC_REF_ARG); } @@ -1628,7 +1628,7 @@ again: { struct symbol *sym = ppt->symbol[i]; - if (SYMBOL_CLASS (sym) == LOC_TYPEDEF + if (sym->aclass () == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (SYMBOL_TYPE (sym)->code () == code) && strcmp (sym->linkage_name (), type_name) == 0) @@ -4466,7 +4466,7 @@ cleanup_undefined_types_1 (void) { struct symbol *sym = ppt->symbol[i]; - if (SYMBOL_CLASS (sym) == LOC_TYPEDEF + if (sym->aclass () == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && (SYMBOL_TYPE (sym)->code () == (*type)->code ()) && ((*type)->instance_flags () @@ -4576,7 +4576,7 @@ scan_file_globals (struct objfile *objfile) the same symbol if there are multiple references. */ if (sym) { - if (SYMBOL_CLASS (sym) == LOC_BLOCK) + if (sym->aclass () == LOC_BLOCK) { fix_common_block (sym, MSYMBOL_VALUE_ADDRESS (resolve_objfile, @@ -4627,7 +4627,7 @@ scan_file_globals (struct objfile *objfile) SET_SYMBOL_VALUE_ADDRESS (prev, 0); /* Complain about unresolved common block symbols. */ - if (SYMBOL_CLASS (prev) == LOC_STATIC) + if (prev->aclass () == LOC_STATIC) prev->set_aclass_index (LOC_UNRESOLVED); else complaint (_("%s: common block `%s' from " diff --git a/gdb/stack.c b/gdb/stack.c index 8d5983e6439..1df3f6b8de3 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -773,7 +773,7 @@ print_frame_args (const frame_print_options &fp_opts, break; } - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_ARG: case LOC_REF_ARG: @@ -828,7 +828,7 @@ print_frame_args (const frame_print_options &fp_opts, nsym = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN).symbol; gdb_assert (nsym != NULL); - if (SYMBOL_CLASS (nsym) == LOC_REGISTER + if (nsym->aclass () == LOC_REGISTER && !SYMBOL_IS_ARGUMENT (nsym)) { /* There is a LOC_ARG/LOC_REGISTER pair. This means @@ -2248,7 +2248,7 @@ iterate_over_block_locals (const struct block *b, ALL_BLOCK_SYMBOLS (b, iter, sym) { - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_CONST: case LOC_LOCAL: diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 179b83e416f..5c96bf9886d 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -543,7 +543,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, } else { - if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF) + if (symbol->aclass () == LOC_TYPEDEF) fprintf_filtered (outfile, "typedef "); if (SYMBOL_TYPE (symbol)) { @@ -558,7 +558,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, else fprintf_filtered (outfile, "%s ", symbol->print_name ()); - switch (SYMBOL_CLASS (symbol)) + switch (symbol->aclass ()) { case LOC_CONST: fprintf_filtered (outfile, "const %s (%s)", @@ -654,7 +654,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, default: fprintf_filtered (outfile, "botched symbol class %x", - SYMBOL_CLASS (symbol)); + symbol->aclass ()); break; } } diff --git a/gdb/symtab.c b/gdb/symtab.c index 30335ee55f8..9357b5b11ed 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1805,7 +1805,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) /* We should have an objfile by now. */ gdb_assert (objfile); - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { case LOC_STATIC: case LOC_LABEL: @@ -3086,7 +3086,7 @@ find_symbol_at_address (CORE_ADDR address) ALL_BLOCK_SYMBOLS (b, iter, sym) { - if (SYMBOL_CLASS (sym) == LOC_STATIC + if (sym->aclass () == LOC_STATIC && SYMBOL_VALUE_ADDRESS (sym) == addr) return sym; } @@ -4119,7 +4119,7 @@ find_function_alias_target (bound_minimal_symbol msymbol) symbol *sym = find_pc_function (func_addr); if (sym != NULL - && SYMBOL_CLASS (sym) == LOC_BLOCK + && sym->aclass () == LOC_BLOCK && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == func_addr) return sym; @@ -4828,25 +4828,25 @@ global_symbol_searcher::add_matching_symbols || preg->exec (sym->natural_name (), 0, NULL, 0) == 0) && ((kind == VARIABLES_DOMAIN - && SYMBOL_CLASS (sym) != LOC_TYPEDEF - && SYMBOL_CLASS (sym) != LOC_UNRESOLVED - && SYMBOL_CLASS (sym) != LOC_BLOCK + && sym->aclass () != LOC_TYPEDEF + && sym->aclass () != LOC_UNRESOLVED + && sym->aclass () != LOC_BLOCK /* LOC_CONST can be used for more than just enums, e.g., c++ static const members. We only want to skip enums here. */ - && !(SYMBOL_CLASS (sym) == LOC_CONST + && !(sym->aclass () == LOC_CONST && (SYMBOL_TYPE (sym)->code () == TYPE_CODE_ENUM)) && (!treg.has_value () || treg_matches_sym_type_name (*treg, sym))) || (kind == FUNCTIONS_DOMAIN - && SYMBOL_CLASS (sym) == LOC_BLOCK + && sym->aclass () == LOC_BLOCK && (!treg.has_value () || treg_matches_sym_type_name (*treg, sym))) || (kind == TYPES_DOMAIN - && SYMBOL_CLASS (sym) == LOC_TYPEDEF + && sym->aclass () == LOC_TYPEDEF && SYMBOL_DOMAIN (sym) != MODULE_DOMAIN) || (kind == MODULES_DOMAIN && SYMBOL_DOMAIN (sym) == MODULE_DOMAIN @@ -5056,7 +5056,7 @@ symbol_to_info_string (struct symbol *sym, int block, string_file tmp_stream; type_print (SYMBOL_TYPE (sym), - (SYMBOL_CLASS (sym) == LOC_TYPEDEF + (sym->aclass () == LOC_TYPEDEF ? "" : sym->print_name ()), &tmp_stream, 0); @@ -5526,7 +5526,7 @@ completion_list_add_symbol (completion_tracker &tracker, tracker. */ if (sym->language () == language_cplus && SYMBOL_DOMAIN (sym) == VAR_DOMAIN - && SYMBOL_CLASS (sym) == LOC_BLOCK) + && sym->aclass () == LOC_BLOCK) { /* The call to canonicalize returns the empty string if the input string is already in canonical form, thanks to this we don't @@ -5671,7 +5671,7 @@ completion_list_add_fields (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - if (SYMBOL_CLASS (sym) == LOC_TYPEDEF) + if (sym->aclass () == LOC_TYPEDEF) { struct type *t = SYMBOL_TYPE (sym); enum type_code c = t->code (); @@ -5723,7 +5723,7 @@ symbol_is_function_or_method (minimal_symbol *msymbol) bound_minimal_symbol find_gnu_ifunc (const symbol *sym) { - if (SYMBOL_CLASS (sym) != LOC_BLOCK) + if (sym->aclass () != LOC_BLOCK) return {}; lookup_name_info lookup_name (sym->search_name (), @@ -6572,7 +6572,7 @@ CORE_ADDR get_symbol_address (const struct symbol *sym) { gdb_assert (sym->maybe_copied); - gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC); + gdb_assert (sym->aclass () == LOC_STATIC); const char *linkage_name = sym->linkage_name (); diff --git a/gdb/symtab.h b/gdb/symtab.h index 3a22d3e19ee..a00b48f868e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1153,6 +1153,11 @@ struct symbol : public general_symbol_info, public allocate_on_obstack return symbol_impls[this->aclass_index ()]; } + address_class aclass () const + { + return this->impl ().aclass; + } + /* Data type of value */ struct type *type = nullptr; @@ -1256,7 +1261,6 @@ struct block_symbol "private". */ #define SYMBOL_DOMAIN(symbol) (symbol)->domain -#define SYMBOL_CLASS(symbol) ((symbol)->impl ().aclass) #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/tracepoint.c b/gdb/tracepoint.c index 506af3c527e..807f5a312ae 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -696,14 +696,14 @@ validate_actionline (const char *line, struct breakpoint *b) (exp->op.get ())); sym = vvop->get_symbol (); - if (SYMBOL_CLASS (sym) == LOC_CONST) + if (sym->aclass () == LOC_CONST) { error (_("constant `%s' (value %s) " "will not be collected."), sym->print_name (), plongest (SYMBOL_VALUE (sym))); } - else if (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT) + else if (sym->aclass () == LOC_OPTIMIZED_OUT) { error (_("`%s' is optimized away " "and cannot be collected."), @@ -928,11 +928,11 @@ collection_list::collect_symbol (struct symbol *sym, int treat_as_expr = 0; len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))); - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { default: printf_filtered ("%s: don't know symbol class %d\n", - sym->print_name (), SYMBOL_CLASS (sym)); + sym->print_name (), sym->aclass ()); break; case LOC_CONST: printf_filtered ("constant %s (value %s) will not be collected.\n", @@ -2550,12 +2550,12 @@ info_scope_command (const char *args_in, int from_tty) gdb_stdout); else { - switch (SYMBOL_CLASS (sym)) + switch (sym->aclass ()) { default: case LOC_UNDEF: /* Messed up symbol? */ printf_filtered ("a bogus symbol, class %d.\n", - SYMBOL_CLASS (sym)); + sym->aclass ()); count--; /* Don't count this one. */ continue; case LOC_CONST: diff --git a/gdb/typeprint.c b/gdb/typeprint.c index d68970b9d67..1de223ac5a1 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -255,7 +255,7 @@ typedef_hash_table::add_template_parameters (struct type *t) void **slot; /* We only want type-valued template parameters in the hash. */ - if (SYMBOL_CLASS (TYPE_TEMPLATE_ARGUMENT (t, i)) != LOC_TYPEDEF) + if (TYPE_TEMPLATE_ARGUMENT (t, i)->aclass () != LOC_TYPEDEF) continue; tf = XOBNEW (&m_storage, struct decl_field); diff --git a/gdb/valops.c b/gdb/valops.c index e091c445e79..9767b2c30e6 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -120,7 +120,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) sym = lookup_symbol (name, 0, VAR_DOMAIN, 0); if (sym.symbol != NULL) { - if (SYMBOL_CLASS (sym.symbol) != LOC_BLOCK) + if (sym.symbol->aclass () != LOC_BLOCK) { error (_("\"%s\" exists in this program but is not a function."), name); @@ -3779,7 +3779,7 @@ value_maybe_namespace_elt (const struct type *curtype, if (sym.symbol == NULL) return NULL; else if ((noside == EVAL_AVOID_SIDE_EFFECTS) - && (SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF)) + && (sym.symbol->aclass () == LOC_TYPEDEF)) result = allocate_value (SYMBOL_TYPE (sym.symbol)); else result = value_of_variable (sym.symbol, sym.block);