diff options
Diffstat (limited to 'gdb')
57 files changed, 342 insertions, 333 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 0cb4aac..916b8ef 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1332,10 +1332,10 @@ select_possible_type_sym (const std::vector<struct block_symbol> &syms) switch (syms[i].symbol->aclass ()) { case LOC_TYPEDEF: - if (ada_prefer_type (SYMBOL_TYPE (syms[i].symbol), preferred_type)) + if (ada_prefer_type (syms[i].symbol->type (), preferred_type)) { preferred_index = i; - preferred_type = SYMBOL_TYPE (syms[i].symbol); + preferred_type = syms[i].symbol->type (); } break; case LOC_REGISTER: @@ -1374,7 +1374,7 @@ find_primitive_type (struct parser_state *par_state, const char *name) strcat (expanded_name, name); sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN).symbol; if (sym != NULL && sym->aclass () == LOC_TYPEDEF) - type = SYMBOL_TYPE (sym); + type = sym->type (); } return type; @@ -1474,7 +1474,7 @@ get_symbol_field_type (struct symbol *sym, const char *encoded_field_name) { const char *field_name = encoded_field_name; const char *subfield_name; - struct type *type = SYMBOL_TYPE (sym); + struct type *type = sym->type (); int fieldno; if (type == NULL || field_name == NULL) @@ -1595,7 +1595,7 @@ write_var_or_type (struct parser_state *par_state, struct type *field_type; if (tail_index == name_len) - return SYMBOL_TYPE (type_sym); + return type_sym->type (); /* We have some extraneous characters after the type name. If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN", diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 636ae90..fbeb176 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3163,7 +3163,7 @@ static void ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym, const struct type_print_options *flags) { - struct type *type = SYMBOL_TYPE (sym); + struct type *type = sym->type (); fprintf_filtered (stream, "%s", sym->print_name ()); if (!print_signatures @@ -3348,8 +3348,8 @@ See set/show multiple-symbol.")); { int is_enumeral = (syms[i].symbol->aclass () == LOC_CONST - && SYMBOL_TYPE (syms[i].symbol) != NULL - && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM); + && syms[i].symbol->type () != NULL + && syms[i].symbol->type ()->code () == TYPE_CODE_ENUM); struct symtab *symtab = NULL; if (syms[i].symbol->is_objfile_owned ()) @@ -3365,10 +3365,10 @@ See set/show multiple-symbol.")); SYMBOL_LINE (syms[i].symbol)); } else if (is_enumeral - && SYMBOL_TYPE (syms[i].symbol)->name () != NULL) + && syms[i].symbol->type ()->name () != NULL) { printf_filtered (("[%d] "), i + first_choice); - ada_print_type (SYMBOL_TYPE (syms[i].symbol), NULL, + ada_print_type (syms[i].symbol->type (), NULL, gdb_stdout, -1, 0, &type_print_raw_options); printf_filtered (_("'(%s) (enumeral)\n"), syms[i].symbol->print_name ()); @@ -3467,7 +3467,7 @@ ada_resolve_enum (std::vector<struct block_symbol> &syms, { /* We already know the name matches, so we're just looking for an element of the correct enum type. */ - if (ada_check_typedef (SYMBOL_TYPE (syms[i].symbol)) == context_type) + if (ada_check_typedef (syms[i].symbol->type ()) == context_type) return i; } @@ -3626,7 +3626,7 @@ static int ada_args_match (struct symbol *func, struct value **actuals, int n_actuals) { int i; - struct type *func_type = SYMBOL_TYPE (func); + struct type *func_type = func->type (); if (func->aclass () == LOC_CONST && func_type->code () == TYPE_CODE_ENUM) @@ -3714,7 +3714,7 @@ ada_resolve_function (std::vector<struct block_symbol> &syms, { for (k = 0; k < syms.size (); k += 1) { - struct type *type = ada_check_typedef (SYMBOL_TYPE (syms[k].symbol)); + struct type *type = ada_check_typedef (syms[k].symbol->type ()); if (ada_args_match (syms[k].symbol, args, nargs) && (fallback || return_match (type, context_type))) @@ -4441,8 +4441,8 @@ static int is_nonfunction (const std::vector<struct block_symbol> &syms) { for (const block_symbol &sym : syms) - if (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_FUNC - && (SYMBOL_TYPE (sym.symbol)->code () != TYPE_CODE_ENUM + if (sym.symbol->type ()->code () != TYPE_CODE_FUNC + && (sym.symbol->type ()->code () != TYPE_CODE_ENUM || sym.symbol->aclass () != LOC_CONST)) return 1; @@ -4487,8 +4487,8 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) return 1; case LOC_TYPEDEF: { - struct type *type0 = SYMBOL_TYPE (sym0); - struct type *type1 = SYMBOL_TYPE (sym1); + struct type *type0 = sym0->type (); + struct type *type1 = sym1->type (); const char *name0 = sym0->linkage_name (); const char *name1 = sym1->linkage_name (); int len0 = strlen (name0); @@ -4501,7 +4501,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) } case LOC_CONST: return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1) - && equiv_types (SYMBOL_TYPE (sym0), SYMBOL_TYPE (sym1)); + && equiv_types (sym0->type (), sym1->type ()); case LOC_STATIC: { @@ -4675,7 +4675,7 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms) /* Quick check: All symbols should have an enum type. */ for (i = 0; i < syms.size (); i++) - if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM) + if (syms[i].symbol->type ()->code () != TYPE_CODE_ENUM) return 0; /* Quick check: They should all have the same value. */ @@ -4685,16 +4685,16 @@ symbols_are_identical_enums (const std::vector<struct block_symbol> &syms) /* Quick check: They should all have the same number of enumerals. */ for (i = 1; i < syms.size (); i++) - if (SYMBOL_TYPE (syms[i].symbol)->num_fields () - != SYMBOL_TYPE (syms[0].symbol)->num_fields ()) + if (syms[i].symbol->type ()->num_fields () + != syms[0].symbol->type ()->num_fields ()) return 0; /* All the sanity checks passed, so we might have a set of identical enumeration types. Perform a more complete comparison of the type of each symbol. */ for (i = 1; i < syms.size (); i++) - if (!ada_identical_enum_types_p (SYMBOL_TYPE (syms[i].symbol), - SYMBOL_TYPE (syms[0].symbol))) + if (!ada_identical_enum_types_p (syms[i].symbol->type (), + syms[0].symbol->type ())) return 0; return 1; @@ -4725,13 +4725,13 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms) /* If two symbols have the same name and one of them is a stub type, the get rid of the stub. */ - if (SYMBOL_TYPE ((*syms)[i].symbol)->is_stub () + if ((*syms)[i].symbol->type ()->is_stub () && (*syms)[i].symbol->linkage_name () != NULL) { for (j = 0; j < syms->size (); j++) { if (j != i - && !SYMBOL_TYPE ((*syms)[j].symbol)->is_stub () + && !(*syms)[j].symbol->type ()->is_stub () && (*syms)[j].symbol->linkage_name () != NULL && strcmp ((*syms)[i].symbol->linkage_name (), (*syms)[j].symbol->linkage_name ()) == 0) @@ -4744,7 +4744,7 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms) else if ((*syms)[i].symbol->linkage_name () != NULL && (*syms)[i].symbol->aclass () == LOC_STATIC - && is_nondebugging_type (SYMBOL_TYPE ((*syms)[i].symbol))) + && is_nondebugging_type ((*syms)[i].symbol->type ())) { for (j = 0; j < syms->size (); j += 1) { @@ -4848,7 +4848,7 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name) if (sym->aclass () != LOC_TYPEDEF) return 0; - std::string scope = xget_renaming_scope (SYMBOL_TYPE (sym)); + std::string scope = xget_renaming_scope (sym->type ()); /* If the rename has been defined in a package, then it is visible. */ if (is_package_name (scope.c_str ())) @@ -7231,7 +7231,7 @@ ada_find_any_type (const char *name) struct symbol *sym = ada_find_any_type_symbol (name); if (sym != NULL) - return SYMBOL_TYPE (sym); + return sym->type (); return NULL; } @@ -10420,7 +10420,7 @@ ada_var_value_operation::evaluate (struct type *expect_type, if (noside == EVAL_AVOID_SIDE_EFFECTS) { - struct type *type = static_unwrap_type (SYMBOL_TYPE (sym)); + struct type *type = static_unwrap_type (sym->type ()); /* Check to see if this is a tagged type. We also need to handle the case where the type is a reference to a tagged type, but we have to be careful to exclude pointers to tagged types. @@ -10511,7 +10511,7 @@ ada_var_value_operation::resolve (struct expression *exp, } if (deprocedure_p - && (SYMBOL_TYPE (std::get<0> (m_storage).symbol)->code () + && (std::get<0> (m_storage).symbol->type ()->code () == TYPE_CODE_FUNC)) return true; @@ -12418,7 +12418,7 @@ catch_assert_command (const char *arg_entry, int from_tty, static int ada_is_exception_sym (struct symbol *sym) { - const char *type_name = SYMBOL_TYPE (sym)->name (); + const char *type_name = sym->type ()->name (); return (sym->aclass () != LOC_TYPEDEF && sym->aclass () != LOC_BLOCK diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 5b602c4..6a41d5f 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -503,7 +503,7 @@ ada_get_tcb_types_info (void) lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN, language_c, NULL).symbol; - if (atcb_sym == NULL || atcb_sym->type == NULL) + if (atcb_sym == NULL || atcb_sym->type () == NULL) { /* In Ravenscar run-time libs, the ATCB does not have a dynamic size, so the symbol name differs. */ @@ -511,34 +511,34 @@ ada_get_tcb_types_info (void) STRUCT_DOMAIN, language_c, NULL).symbol; - if (atcb_sym == NULL || atcb_sym->type == NULL) + if (atcb_sym == NULL || atcb_sym->type () == NULL) return _("Cannot find Ada_Task_Control_Block type"); - type = atcb_sym->type; + type = atcb_sym->type (); } else { /* Get a static representation of the type record Ada_Task_Control_Block. */ - type = atcb_sym->type; + type = atcb_sym->type (); type = ada_template_to_fixed_record_type_1 (type, NULL, 0, NULL, 0); } - if (common_atcb_sym == NULL || common_atcb_sym->type == NULL) + if (common_atcb_sym == NULL || common_atcb_sym->type () == NULL) return _("Cannot find Common_ATCB type"); - if (private_data_sym == NULL || private_data_sym->type == NULL) + if (private_data_sym == NULL || private_data_sym->type ()== NULL) return _("Cannot find Private_Data type"); - if (entry_call_record_sym == NULL || entry_call_record_sym->type == NULL) + if (entry_call_record_sym == NULL || entry_call_record_sym->type () == NULL) return _("Cannot find Entry_Call_Record type"); /* Get the type for Ada_Task_Control_Block.Common. */ - common_type = common_atcb_sym->type; + common_type = common_atcb_sym->type (); /* Get the type for Ada_Task_Control_Bloc.Common.Call.LL. */ - ll_type = private_data_sym->type; + ll_type = private_data_sym->type (); /* Get the type for Common_ATCB.Call.all. */ - call_type = entry_call_record_sym->type; + call_type = entry_call_record_sym->type (); /* Get the field indices. */ fieldnos.common = ada_get_field_index (type, "common", 0); @@ -904,7 +904,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) if (sym != NULL) { /* Validate. */ - struct type *type = check_typedef (SYMBOL_TYPE (sym)); + struct type *type = check_typedef (sym->type ()); struct type *eltype = NULL; struct type *idxtype = NULL; @@ -950,7 +950,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) if (sym != NULL && SYMBOL_VALUE_ADDRESS (sym) != 0) { /* Validate. */ - struct type *type = check_typedef (SYMBOL_TYPE (sym)); + struct type *type = check_typedef (sym->type ()); if (type->code () == TYPE_CODE_PTR) { diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 7ba44c4..0b12dc3 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -510,7 +510,7 @@ static void gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) { /* Dereference any typedefs. */ - value->type = check_typedef (SYMBOL_TYPE (var)); + value->type = check_typedef (var->type ()); value->optimized_out = 0; if (SYMBOL_COMPUTED_OPS (var) != NULL) diff --git a/gdb/block.c b/gdb/block.c index 3d11ea6..3fe096d 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -857,7 +857,7 @@ block_find_symbol (const struct block *block, const char *name, int block_find_non_opaque_type (struct symbol *sym, void *data) { - return !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)); + return !TYPE_IS_OPAQUE (sym->type ()); } /* See block.h. */ @@ -867,7 +867,7 @@ block_find_non_opaque_type_preferred (struct symbol *sym, void *data) { struct symbol **best = (struct symbol **) data; - if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) + if (!TYPE_IS_OPAQUE (sym->type ())) return 1; *best = sym; return 0; diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 88595d4..50c464f 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -426,7 +426,7 @@ find_function_type (CORE_ADDR pc) struct symbol *sym = find_pc_function (pc); if (sym != NULL && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == pc) - return SYMBOL_TYPE (sym); + return sym->type (); return NULL; } diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 51764a6..999f632 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -249,7 +249,7 @@ buildsym_compunit::finish_block_internal if (symbol) { - struct type *ftype = SYMBOL_TYPE (symbol); + struct type *ftype = symbol->type (); struct mdict_iterator miter; SYMBOL_BLOCK_VALUE (symbol) = block; BLOCK_FUNCTION (block) = symbol; @@ -286,7 +286,7 @@ buildsym_compunit::finish_block_internal if (sym->is_argument ()) { - ftype->field (iparams).set_type (SYMBOL_TYPE (sym)); + ftype->field (iparams).set_type (sym->type ()); TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0; iparams++; } diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 6d4cb47..de29d2f 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -3090,7 +3090,7 @@ classify_name (struct parser_state *par_state, const struct block *block, &inner_is_a_field_of_this); if (bsym.symbol != NULL) { - yylval.tsym.type = SYMBOL_TYPE (bsym.symbol); + yylval.tsym.type = bsym.symbol->type (); return TYPENAME; } } @@ -3118,7 +3118,7 @@ classify_name (struct parser_state *par_state, const struct block *block, if (bsym.symbol && bsym.symbol->aclass () == LOC_TYPEDEF) { - yylval.tsym.type = SYMBOL_TYPE (bsym.symbol); + yylval.tsym.type = bsym.symbol->type (); return TYPENAME; } @@ -3135,7 +3135,7 @@ classify_name (struct parser_state *par_state, const struct block *block, sym = lookup_struct_typedef (copy.c_str (), par_state->expression_context_block, 1); if (sym) - yylval.theclass.type = SYMBOL_TYPE (sym); + yylval.theclass.type = sym->type (); return CLASSNAME; } } @@ -3231,7 +3231,7 @@ classify_inner_name (struct parser_state *par_state, return ERROR; case LOC_TYPEDEF: - yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol); + yylval.tsym.type = yylval.ssym.sym.symbol->type (); return TYPENAME; default: diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 14d671e..405ede8 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -207,10 +207,10 @@ c_print_typedef (struct type *type, type = check_typedef (type); fprintf_filtered (stream, "typedef "); type_print (type, "", stream, -1); - if ((SYMBOL_TYPE (new_symbol))->name () == 0 - || strcmp ((SYMBOL_TYPE (new_symbol))->name (), + if ((new_symbol->type ())->name () == 0 + || strcmp ((new_symbol->type ())->name (), new_symbol->linkage_name ()) != 0 - || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF) + || new_symbol->type ()->code () == TYPE_CODE_TYPEDEF) fprintf_filtered (stream, " %s", new_symbol->print_name ()); fprintf_filtered (stream, ";"); } @@ -899,7 +899,7 @@ c_type_print_template_args (const struct type_print_options *flags, fprintf_filtered (stream, "%s = ", sym->linkage_name ()); } - c_print_type (SYMBOL_TYPE (sym), "", stream, -1, 0, flags); + c_print_type (sym->type (), "", stream, -1, 0, flags); } if (!first) diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 4617630..fadbc5b 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -210,7 +210,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype, if (wsym) { - wtype = SYMBOL_TYPE (wsym); + wtype = wsym->type (); } else { diff --git a/gdb/coffread.c b/gdb/coffread.c index e4db4fd..3ff62bc 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1492,8 +1492,8 @@ patch_opaque_types (struct symtab *s) from different files with the same name. */ if (real_sym->aclass () == LOC_TYPEDEF && real_sym->domain () == VAR_DOMAIN - && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR - && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0) + && real_sym->type ()->code () == TYPE_CODE_PTR + && TYPE_LENGTH (TYPE_TARGET_TYPE (real_sym->type ())) != 0) { const char *name = real_sym->linkage_name (); int hash = hashname (name); @@ -1514,7 +1514,7 @@ patch_opaque_types (struct symtab *s) opaque_type_chain[hash] = SYMBOL_VALUE_CHAIN (sym); } - patch_type (SYMBOL_TYPE (sym), SYMBOL_TYPE (real_sym)); + patch_type (sym->type (), real_sym->type ()); if (prev) { @@ -1571,9 +1571,9 @@ process_coff_symbol (struct coff_symbol *cs, if (ISFCN (cs->c_type)) { SYMBOL_VALUE (sym) += objfile->text_section_offset (); - SYMBOL_TYPE (sym) = - lookup_function_type (decode_function_type (cs, cs->c_type, - aux, objfile)); + sym->set_type + (lookup_function_type (decode_function_type (cs, cs->c_type, + aux, objfile))); sym->set_aclass_index (LOC_BLOCK); if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT @@ -1585,7 +1585,7 @@ process_coff_symbol (struct coff_symbol *cs, } else { - SYMBOL_TYPE (sym) = decode_type (cs, cs->c_type, aux, objfile); + sym->set_type (decode_type (cs, cs->c_type, aux, objfile)); switch (cs->c_sclass) { case C_NULL: @@ -1656,10 +1656,10 @@ process_coff_symbol (struct coff_symbol *cs, sym->set_domain (VAR_DOMAIN); /* If type has no name, give it one. */ - if (SYMBOL_TYPE (sym)->name () == 0) + if (sym->type ()->name () == 0) { - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR - || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC) + if (sym->type ()->code () == TYPE_CODE_PTR + || sym->type ()->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we @@ -1682,7 +1682,7 @@ process_coff_symbol (struct coff_symbol *cs, ; } else - SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ())); + sym->type ()->set_name (xstrdup (sym->linkage_name ())); } /* Keep track of any type which points to empty structured @@ -1691,9 +1691,9 @@ process_coff_symbol (struct coff_symbol *cs, not an empty structured type, though; the forward references work themselves out via the magic of coff_lookup_type. */ - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR - && TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0 - && TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))->code () + if (sym->type ()->code () == TYPE_CODE_PTR + && TYPE_LENGTH (TYPE_TARGET_TYPE (sym->type ())) == 0 + && TYPE_TARGET_TYPE (sym->type ())->code () != TYPE_CODE_UNDEF) { int i = hashname (sym->linkage_name ()); @@ -1713,11 +1713,11 @@ process_coff_symbol (struct coff_symbol *cs, /* Some compilers try to be helpful by inventing "fake" names for anonymous enums, structures, and unions, like "~0fake" or ".0fake". Thanks, but no thanks... */ - if (SYMBOL_TYPE (sym)->name () == 0) + if (sym->type ()->name () == 0) if (sym->linkage_name () != NULL && *sym->linkage_name () != '~' && *sym->linkage_name () != '.') - SYMBOL_TYPE (sym)->set_name (xstrdup (sym->linkage_name ())); + sym->type ()->set_name (xstrdup (sym->linkage_name ())); add_symbol_to_list (sym, get_file_symbols ()); break; @@ -2143,7 +2143,7 @@ coff_read_enum_type (int index, int length, int lastsym, { struct symbol *xsym = syms->symbol[j]; - SYMBOL_TYPE (xsym) = type; + xsym->set_type (type); type->field (n).set_name (xsym->linkage_name ()); type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym)); if (SYMBOL_VALUE (xsym) < 0) diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 41746c2..4f7a5b2 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -65,7 +65,7 @@ convert_one_symbol (compile_c_instance *context, if (sym.symbol->aclass () == LOC_LABEL) sym_type = 0; else - sym_type = context->convert_type (SYMBOL_TYPE (sym.symbol)); + sym_type = context->convert_type (sym.symbol->type ()); if (sym.symbol->domain () == STRUCT_DOMAIN) { @@ -94,12 +94,12 @@ convert_one_symbol (compile_c_instance *context, case LOC_BLOCK: kind = GCC_C_SYMBOL_FUNCTION; addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol)); - if (is_global && SYMBOL_TYPE (sym.symbol)->is_gnu_ifunc ()) + if (is_global && sym.symbol->type ()->is_gnu_ifunc ()) addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr); break; case LOC_CONST: - if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM) + if (sym.symbol->type ()->code () == TYPE_CODE_ENUM) { /* Already handled by convert_enum. */ return; @@ -405,7 +405,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context, "gcc_symbol_address \"%s\": full symbol\n", identifier); result = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); - if (SYMBOL_TYPE (sym)->is_gnu_ifunc ()) + if (sym->type ()->is_gnu_ifunc ()) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; } @@ -548,14 +548,14 @@ generate_c_for_for_one_variable (compile_instance *compiler, try { - if (is_dynamic_type (SYMBOL_TYPE (sym))) + if (is_dynamic_type (sym->type ())) { /* We need to emit to a temporary buffer in case an error occurs in the middle. */ string_file local_file; generate_vla_size (compiler, &local_file, gdbarch, registers_used, pc, - SYMBOL_TYPE (sym), sym); + sym->type (), sym); stream->write (local_file.c_str (), local_file.size ()); } diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 3a24aa7..7cf5703 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -56,7 +56,7 @@ convert_one_symbol (compile_cplus_instance *instance, if (sym.symbol->aclass () == LOC_LABEL) sym_type = 0; else - sym_type = instance->convert_type (SYMBOL_TYPE (sym.symbol)); + sym_type = instance->convert_type (sym.symbol->type ()); if (sym.symbol->domain () == STRUCT_DOMAIN) { @@ -73,9 +73,9 @@ convert_one_symbol (compile_cplus_instance *instance, switch (sym.symbol->aclass ()) { case LOC_TYPEDEF: - if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF) + if (sym.symbol->type ()->code () == TYPE_CODE_TYPEDEF) kind = GCC_CP_SYMBOL_TYPEDEF; - else if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_NAMESPACE) + else if (sym.symbol->type ()->code () == TYPE_CODE_NAMESPACE) return; break; @@ -88,13 +88,13 @@ convert_one_symbol (compile_cplus_instance *instance, { kind = GCC_CP_SYMBOL_FUNCTION; addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol)); - if (is_global && SYMBOL_TYPE (sym.symbol)->is_gnu_ifunc ()) + if (is_global && sym.symbol->type ()->is_gnu_ifunc ()) addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr); } break; case LOC_CONST: - if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM) + if (sym.symbol->type ()->code () == TYPE_CODE_ENUM) { /* Already handled by convert_enum. */ return; @@ -190,7 +190,7 @@ convert_one_symbol (compile_cplus_instance *instance, { compile_scope scope = instance->new_scope (sym.symbol->natural_name (), - SYMBOL_TYPE (sym.symbol)); + sym.symbol->type ()); if (scope.nested_type () != GCC_TYPE_NONE) { /* We found a symbol for this type that was defined inside @@ -442,7 +442,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context, "gcc_symbol_address \"%s\": full symbol\n", identifier); result = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); - if (SYMBOL_TYPE (sym)->is_gnu_ifunc ()) + if (sym->type ()->is_gnu_ifunc ()) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; } diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index ce8b945..1987996 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -161,7 +161,7 @@ type_name_to_scope (const char *type_name, const struct block *block) scope.push_back (comp); - if (SYMBOL_TYPE (bsymbol.symbol)->code () != TYPE_CODE_NAMESPACE) + if (bsymbol.symbol->type ()->code () != TYPE_CODE_NAMESPACE) { /* We're done. */ break; @@ -271,7 +271,7 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope) (m_scopes.back ().begin (), m_scopes.back ().end () - 1, [this] (const scope_component &comp) { - gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code () + gdb_assert (comp.bsymbol.symbol->type ()->code () == TYPE_CODE_NAMESPACE); const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr @@ -313,7 +313,7 @@ compile_cplus_instance::leave_scope () std::for_each (current.begin (),current.end () - 1, [this] (const scope_component &comp) { - gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code () + gdb_assert (comp.bsymbol.symbol->type ()->code () == TYPE_CODE_NAMESPACE); this->plugin ().pop_binding_level (comp.name.c_str ()); }); @@ -345,14 +345,14 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type) unqualified name of the type to process. */ scope_component &comp = scope.back (); - if (!types_equal (type, SYMBOL_TYPE (comp.bsymbol.symbol)) + if (!types_equal (type, comp.bsymbol.symbol->type ()) && (m_scopes.empty () || (m_scopes.back ().back ().bsymbol.symbol != comp.bsymbol.symbol))) { /* The type is defined inside another class(es). Convert that type instead of defining this type. */ - convert_type (SYMBOL_TYPE (comp.bsymbol.symbol)); + convert_type (comp.bsymbol.symbol->type ()); /* If the original type (passed in to us) is defined in a nested class, the previous call will give us that type's gcc_type. diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 692e990..073f2fe 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -458,7 +458,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, if (block_loop == nblocks) error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_VAL); - gdb_type = SYMBOL_TYPE (gdb_val_sym); + gdb_type = gdb_val_sym->type (); gdb_type = check_typedef (gdb_type); gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE, @@ -466,7 +466,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, VAR_DOMAIN); if (gdb_ptr_type_sym == NULL) error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE); - gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym); + gdb_ptr_type = gdb_ptr_type_sym->type (); gdb_ptr_type = check_typedef (gdb_ptr_type); if (gdb_ptr_type->code () != TYPE_CODE_PTR) error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE); @@ -517,7 +517,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, static struct type * get_regs_type (struct symbol *func_sym, struct objfile *objfile) { - struct type *func_type = SYMBOL_TYPE (func_sym); + struct type *func_type = func_sym->type (); struct type *regsp_type, *regs_type; /* No register parameter present. */ @@ -656,7 +656,7 @@ compile_object_load (const compile_file_names &file_names, if (func_sym == NULL) error (_("Cannot find function \"%s\" in compiled module \"%s\"."), GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); - func_type = SYMBOL_TYPE (func_sym); + func_type = func_sym->type (); if (func_type->code () != TYPE_CODE_FUNC) error (_("Invalid type code %d of function \"%s\" in compiled " "module \"%s\"."), diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index b2e09ca..bce0f82 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -134,7 +134,7 @@ compile_object_run (compile_module_up &&module) try { - struct type *func_type = SYMBOL_TYPE (func_sym); + struct type *func_type = func_sym->type (); int current_arg = 0; struct value **vargs; diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 8fb2f71..18238db 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -220,7 +220,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef, return {}; - type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol))); + type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())); /* If TYPE_NAME is NULL, abandon trying to find this symbol. This can happen for lambda functions compiled with clang++, which outputs no name for the container class. */ @@ -274,7 +274,7 @@ cp_search_static_and_baseclasses (const char *name, if (scope_sym.symbol == NULL) return {}; - struct type *scope_type = SYMBOL_TYPE (scope_sym.symbol); + struct type *scope_type = scope_sym.symbol->type (); /* If the scope is a function/method, then look up NESTED as a local static variable. E.g., "print 'function()::static_var'". */ diff --git a/gdb/cp-support.c b/gdb/cp-support.c index f146183..0be1a04 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -166,7 +166,7 @@ inspect_type (struct demangle_parse_info *info, if (sym != NULL) { - struct type *otype = SYMBOL_TYPE (sym); + struct type *otype = sym->type (); if (finder != NULL) { @@ -512,7 +512,7 @@ replace_typedefs (struct demangle_parse_info *info, if (sym != NULL) { - struct type *otype = SYMBOL_TYPE (sym); + struct type *otype = sym->type (); const char *new_name = (*finder) (otype, data); if (new_name != NULL) @@ -1215,7 +1215,7 @@ overload_list_add_symbol (struct symbol *sym, { /* If there is no type information, we can't do anything, so skip. */ - if (SYMBOL_TYPE (sym) == NULL) + if (sym->type () == NULL) return; /* skip any symbols that we've already considered. */ @@ -1507,7 +1507,7 @@ cp_lookup_rtti_type (const char *name, const struct block *block) return NULL; } - rtti_type = check_typedef (SYMBOL_TYPE (rtti_sym)); + rtti_type = check_typedef (rtti_sym->type ()); switch (rtti_type->code ()) { diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 2f8c039..5d965bb 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -452,7 +452,7 @@ ctf_add_enum_member_cb (const char *name, int enum_value, void *arg) sym->compute_and_set_names (name, false, ccp->of->per_bfd); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); - SYMBOL_TYPE (sym) = fip->ptype; + sym->set_type (fip->ptype); add_symbol_to_list (sym, ccp->builder->get_global_symbols ()); } @@ -483,7 +483,7 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != nullptr) - SYMBOL_TYPE (sym) = type; + sym->set_type (type); uint32_t kind = ctf_type_kind (fp, tid); switch (kind) @@ -499,8 +499,8 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid) set_symbol_address (objfile, sym, sym->linkage_name ()); break; case CTF_K_CONST: - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID) - SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int; + if (sym->type ()->code () == TYPE_CODE_VOID) + sym->set_type (objfile_type (objfile)->builtin_int); break; case CTF_K_TYPEDEF: case CTF_K_INTEGER: @@ -1169,7 +1169,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; + sym->set_type (type); sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); sym->compute_and_set_names (name, false, ccp->of->per_bfd); @@ -1205,7 +1205,7 @@ add_stt_entries (struct ctf_context *ccp, int functions) continue; sym = new (&ccp->of->objfile_obstack) symbol; OBJSTAT (ccp->of, n_syms++); - SYMBOL_TYPE (sym) = type; + sym->set_type (type); sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_STATIC); sym->compute_and_set_names (tname, false, ccp->of->per_bfd); diff --git a/gdb/d-exp.y b/gdb/d-exp.y index 601659d..027a8fa 100644 --- a/gdb/d-exp.y +++ b/gdb/d-exp.y @@ -1343,7 +1343,7 @@ classify_name (struct parser_state *par_state, const struct block *block) sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this); if (sym.symbol && sym.symbol->aclass () == LOC_TYPEDEF) { - yylval.tsym.type = SYMBOL_TYPE (sym.symbol); + yylval.tsym.type = sym.symbol->type (); return TYPENAME; } else if (sym.symbol == NULL) @@ -1355,7 +1355,7 @@ classify_name (struct parser_state *par_state, const struct block *block) if (sym.symbol != NULL) { - yylval.tsym.type = SYMBOL_TYPE (sym.symbol); + yylval.tsym.type = sym.symbol->type (); return TYPENAME; } @@ -1390,7 +1390,7 @@ classify_inner_name (struct parser_state *par_state, if (yylval.ssym.sym.symbol->aclass () == LOC_TYPEDEF) { - yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol); + yylval.tsym.type = yylval.ssym.sym.symbol->type (); return TYPENAME; } diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c index eab99ce..07c22e0 100644 --- a/gdb/d-namespace.c +++ b/gdb/d-namespace.c @@ -130,7 +130,7 @@ d_lookup_symbol (const struct language_defn *langdef, if (lang_this.symbol == NULL) return {}; - type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (lang_this.symbol))); + type = check_typedef (TYPE_TARGET_TYPE (lang_this.symbol->type ())); classname = type->name (); nested = name; } @@ -151,7 +151,7 @@ d_lookup_symbol (const struct language_defn *langdef, return {}; /* Look for a symbol named NESTED in this class. */ - sym = d_lookup_nested_symbol (SYMBOL_TYPE (class_sym.symbol), + sym = d_lookup_nested_symbol (class_sym.symbol->type (), nested.c_str (), block); } diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index bf3cadb..badc7f8 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -744,7 +744,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr) "name for address %s"), paddress (gdbarch, addr)); - type = SYMBOL_TYPE (sym); + type = sym->type (); gdb_assert (type->code () == TYPE_CODE_FUNC); gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC); @@ -783,7 +783,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr) func_sym = func_addr_to_tail_call_list (gdbarch, addr); - for (call_site = TYPE_TAIL_CALL_LIST (SYMBOL_TYPE (func_sym)); + for (call_site = TYPE_TAIL_CALL_LIST (func_sym->type ()); call_site; call_site = call_site->tail_call_next) { CORE_ADDR target_addr; @@ -985,7 +985,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc, struct symbol *target_func; target_func = func_addr_to_tail_call_list (gdbarch, target_func_addr); - target_call_site = TYPE_TAIL_CALL_LIST (SYMBOL_TYPE (target_func)); + target_call_site = TYPE_TAIL_CALL_LIST (target_func->type ()); } do @@ -3019,7 +3019,7 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame) = (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol); struct value *val; - val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data, + val = dwarf2_evaluate_loc_desc (symbol->type (), frame, dlbaton->data, dlbaton->size, dlbaton->per_cu, dlbaton->per_objfile); @@ -3036,7 +3036,7 @@ locexpr_read_variable_at_entry (struct symbol *symbol, struct frame_info *frame) struct dwarf2_locexpr_baton *dlbaton = (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (symbol); - return value_of_dwarf_block_entry (SYMBOL_TYPE (symbol), frame, dlbaton->data, + return value_of_dwarf_block_entry (symbol->type (), frame, dlbaton->data, dlbaton->size); } @@ -3856,7 +3856,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame) CORE_ADDR pc = frame ? get_frame_address_in_block (frame) : 0; data = dwarf2_find_location_expression (dlbaton, &size, pc); - val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size, + val = dwarf2_evaluate_loc_desc (symbol->type (), frame, data, size, dlbaton->per_cu, dlbaton->per_objfile); return val; @@ -3880,13 +3880,13 @@ loclist_read_variable_at_entry (struct symbol *symbol, struct frame_info *frame) CORE_ADDR pc; if (frame == NULL || !get_frame_func_if_available (frame, &pc)) - return allocate_optimized_out_value (SYMBOL_TYPE (symbol)); + return allocate_optimized_out_value (symbol->type ()); data = dwarf2_find_location_expression (dlbaton, &size, pc); if (data == NULL) - return allocate_optimized_out_value (SYMBOL_TYPE (symbol)); + return allocate_optimized_out_value (symbol->type ()); - return value_of_dwarf_block_entry (SYMBOL_TYPE (symbol), frame, data, size); + return value_of_dwarf_block_entry (symbol->type (), frame, data, size); } /* Implementation of get_symbol_read_needs from diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 95d4d6f..3a22bcd 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -8918,7 +8918,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) e.g., "main" finds the "main" module and not C's main(). */ sym->set_domain (STRUCT_DOMAIN); sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_TYPE (sym) = type; + sym->set_type (type); add_symbol_to_list (sym, cu->get_builder ()->get_global_symbols ()); } @@ -21720,9 +21720,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, sym->set_domain (VAR_DOMAIN); sym->set_aclass_index (LOC_OPTIMIZED_OUT); if (type != NULL) - SYMBOL_TYPE (sym) = type; + sym->set_type (type); else - SYMBOL_TYPE (sym) = die_type (die, cu); + sym->set_type (die_type (die, cu)); attr = dwarf2_attr (die, inlined_func ? DW_AT_call_line : DW_AT_decl_line, cu); @@ -21764,7 +21764,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; + sym->set_type (objfile_type (objfile)->builtin_core_addr); sym->set_domain (LABEL_DOMAIN); add_symbol_to_list (sym, cu->list_in_scope); break; @@ -21806,8 +21806,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* Compilation with minimal debug info may result in variables with missing type entries. Change the misleading `void' type to something sensible. */ - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID) - SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int; + if (sym->type ()->code () == TYPE_CODE_VOID) + sym->set_type (objfile_type (objfile)->builtin_int); attr = dwarf2_attr (die, DW_AT_const_value, cu); /* In the case of DW_TAG_member, we should only be called for @@ -21994,8 +21994,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* The symbol's name is already allocated along with this objfile, so we don't need to duplicate it for the type. */ - if (SYMBOL_TYPE (sym)->name () == 0) - SYMBOL_TYPE (sym)->set_name (sym->search_name ()); + if (sym->type ()->name () == 0) + sym->type ()->set_name (sym->search_name ()); } } } @@ -22230,7 +22230,7 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym, const gdb_byte *bytes; struct dwarf2_locexpr_baton *baton; - dwarf2_const_value_attr (attr, SYMBOL_TYPE (sym), + dwarf2_const_value_attr (attr, sym->type (), sym->print_name (), &objfile->objfile_obstack, cu, &value, &bytes, &baton); @@ -564,7 +564,7 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var) if (noside != EVAL_AVOID_SIDE_EFFECTS) throw; - ret = value_zero (SYMBOL_TYPE (var), not_lval); + ret = value_zero (var->type (), not_lval); } return ret; @@ -580,7 +580,7 @@ var_value_operation::evaluate (struct type *expect_type, enum noside noside) { symbol *var = std::get<0> (m_storage).symbol; - if (SYMBOL_TYPE (var)->code () == TYPE_CODE_ERROR) + if (var->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (var->print_name ()); return evaluate_var_value (noside, std::get<0> (m_storage).block, var); } @@ -722,7 +722,7 @@ var_value_operation::evaluate_funcall (struct type *expect_type, NULL, std::get<0> (m_storage).symbol, NULL, &symp, NULL, 0, noside); - if (SYMBOL_TYPE (symp)->code () == TYPE_CODE_ERROR) + if (symp->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp->print_name ()); value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block, symp); @@ -1005,7 +1005,7 @@ eval_op_var_entry_value (struct type *expect_type, struct expression *exp, enum noside noside, symbol *sym) { if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (SYMBOL_TYPE (sym), not_lval); + return value_zero (sym->type (), not_lval); if (SYMBOL_COMPUTED_OPS (sym) == NULL || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) @@ -2261,7 +2261,7 @@ adl_func_operation::evaluate (struct type *expect_type, NON_METHOD, nullptr, nullptr, nullptr, &symp, nullptr, 0, noside); - if (SYMBOL_TYPE (symp)->code () == TYPE_CODE_ERROR) + if (symp->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp->print_name ()); value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp); return evaluate_subexp_do_call (exp, noside, callee, args, @@ -2582,12 +2582,12 @@ var_value_operation::evaluate_for_address (struct expression *exp, /* C++: The "address" of a reference should yield the address * of the object pointed to. Let value_addr() deal with it. */ - if (TYPE_IS_REFERENCE (SYMBOL_TYPE (var))) + if (TYPE_IS_REFERENCE (var->type ())) return operation::evaluate_for_address (exp, noside); if (noside == EVAL_AVOID_SIDE_EFFECTS) { - struct type *type = lookup_pointer_type (SYMBOL_TYPE (var)); + struct type *type = lookup_pointer_type (var->type ()); enum address_class sym_class = var->aclass (); if (sym_class == LOC_CONST @@ -2606,7 +2606,7 @@ var_value_operation::evaluate_with_coercion (struct expression *exp, enum noside noside) { struct symbol *var = std::get<0> (m_storage).symbol; - struct type *type = check_typedef (SYMBOL_TYPE (var)); + struct type *type = check_typedef (var->type ()); if (type->code () == TYPE_CODE_ARRAY && !type->is_vector () && CAST_IS_CONVERSION (exp->language_defn)) @@ -2735,7 +2735,7 @@ value * var_value_operation::evaluate_for_sizeof (struct expression *exp, enum noside noside) { - struct type *type = SYMBOL_TYPE (std::get<0> (m_storage).symbol); + struct type *type = std::get<0> (m_storage).symbol->type (); if (is_dynamic_type (type)) { value *val = evaluate (nullptr, exp, EVAL_NORMAL); diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 13f8c10..9cba30f 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1489,7 +1489,7 @@ yylex (void) domain, NULL); if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF) { - yylval.tsym.type = SYMBOL_TYPE (result.symbol); + yylval.tsym.type = result.symbol->type (); return TYPENAME; } diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index f5c880d..47c98ab 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1952,9 +1952,9 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data) language_c, NULL).symbol; if (obj_entry_sym == NULL) error (_("Unable to find Struct_Obj_Entry symbol")); - data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym), + data->off_linkmap = lookup_struct_elt (obj_entry_sym->type (), "linkmap", 0).offset / 8; - data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym), + data->off_tlsindex = lookup_struct_elt (obj_entry_sym->type (), "tlsindex", 0).offset / 8; data->rtld_offsets_valid = true; return; diff --git a/gdb/findvar.c b/gdb/findvar.c index fdfad59..1d22e64 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -593,7 +593,7 @@ language_defn::read_var_value (struct symbol *var, struct frame_info *frame) const { struct value *v; - struct type *type = SYMBOL_TYPE (var); + struct type *type = var->type (); CORE_ADDR addr; enum symbol_needs_kind sym_need; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 2e7f654..ff07086 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1691,7 +1691,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 && sym->aclass () == LOC_TYPEDEF) - return SYMBOL_TYPE (sym); + return sym->type (); if (noerr) return NULL; @@ -1738,12 +1738,12 @@ lookup_struct (const char *name, const struct block *block) { error (_("No struct type named %s."), name); } - if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) + if (sym->type ()->code () != TYPE_CODE_STRUCT) { error (_("This context has class, union or enum %s, not a struct."), name); } - return (SYMBOL_TYPE (sym)); + return (sym->type ()); } /* Lookup a union type named "union NAME", @@ -1760,7 +1760,7 @@ lookup_union (const char *name, const struct block *block) if (sym == NULL) error (_("No union type named %s."), name); - t = SYMBOL_TYPE (sym); + t = sym->type (); if (t->code () == TYPE_CODE_UNION) return t; @@ -1783,12 +1783,12 @@ lookup_enum (const char *name, const struct block *block) { error (_("No enum type named %s."), name); } - if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_ENUM) + if (sym->type ()->code () != TYPE_CODE_ENUM) { error (_("This context has class, struct or union %s, not an enum."), name); } - return (SYMBOL_TYPE (sym)); + return (sym->type ()); } /* Lookup a template type named "template NAME<TYPE>", @@ -1813,12 +1813,12 @@ lookup_template_type (const char *name, struct type *type, { error (_("No template type named %s."), name); } - if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) + if (sym->type ()->code () != TYPE_CODE_STRUCT) { error (_("This context has class, union or enum %s, not a struct."), name); } - return (SYMBOL_TYPE (sym)); + return (sym->type ()); } /* See gdbtypes.h. */ @@ -2906,7 +2906,7 @@ check_typedef (struct type *type) } sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol; if (sym) - TYPE_TARGET_TYPE (type) = SYMBOL_TYPE (sym); + TYPE_TARGET_TYPE (type) = sym->type (); else /* TYPE_CODE_UNDEF */ TYPE_TARGET_TYPE (type) = alloc_type_arch (type->arch ()); } @@ -3000,11 +3000,11 @@ check_typedef (struct type *type) /* Same as above for opaque types, we can replace the stub with the complete type only if they are in the same objfile. */ - if (SYMBOL_TYPE (sym)->objfile_owner () == type->objfile_owner ()) - type = make_qualified_type (SYMBOL_TYPE (sym), + if (sym->type ()->objfile_owner () == type->objfile_owner ()) + type = make_qualified_type (sym->type (), type->instance_flags (), type); else - type = SYMBOL_TYPE (sym); + type = sym->type (); } } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 270a8b4..0cbb8d0 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1071,7 +1071,7 @@ gnuv3_get_typeid_type (struct gdbarch *gdbarch) typeinfo_type = (struct type *) gdbarch_data (gdbarch, std_type_info_gdbarch_data); else - typeinfo_type = SYMBOL_TYPE (typeinfo); + typeinfo_type = typeinfo->type (); return typeinfo_type; } diff --git a/gdb/go-exp.y b/gdb/go-exp.y index fed7fe5..4569204 100644 --- a/gdb/go-exp.y +++ b/gdb/go-exp.y @@ -1339,7 +1339,7 @@ package_name_p (const char *name, const struct block *block) if (sym && sym->aclass () == LOC_TYPEDEF - && SYMBOL_TYPE (sym)->code () == TYPE_CODE_MODULE) + && sym->type ()->code () == TYPE_CODE_MODULE) return 1; return 0; diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 32ef336..4c28603 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -345,10 +345,10 @@ gdbscm_symbol_type (SCM self) = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct symbol *symbol = s_smob->symbol; - if (SYMBOL_TYPE (symbol) == NULL) + if (symbol->type () == NULL) return SCM_BOOL_F; - return tyscm_scm_from_type (SYMBOL_TYPE (symbol)); + return tyscm_scm_from_type (symbol->type ()); } /* (symbol-symtab <gdb:symbol>) -> <gdb:symtab> | #f diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b02040f..b9fb121 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1567,7 +1567,7 @@ finish_command_fsm::should_stop (struct thread_info *tp) /* We're done. */ set_finished (); - rv->type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); + rv->type = TYPE_TARGET_TYPE (function->type ()); if (rv->type == NULL) internal_error (__FILE__, __LINE__, _("finish_command: function has no target type")); @@ -1803,7 +1803,7 @@ finish_command (const char *arg, int from_tty) printf_filtered (_("Run back to call of ")); else { - if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type) + if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type ()) && !query (_("warning: Function %s does not return normally.\n" "Try to finish anyway? "), sm->function->print_name ())) @@ -562,7 +562,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) 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); + block_name->set_type (lookup_function_type (block_type)); SYMBOL_BLOCK_VALUE (block_name) = new_block; block_name->m_name = obstack_strdup (&objfile->objfile_obstack, diff --git a/gdb/language.c b/gdb/language.c index 1d4b1b3..69c73b0 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -975,7 +975,7 @@ language_arch_info::bool_type () const sym = lookup_symbol (m_bool_type_name, NULL, VAR_DOMAIN, NULL).symbol; if (sym != nullptr) { - struct type *type = SYMBOL_TYPE (sym); + struct type *type = sym->type (); if (type != nullptr && type->code () == TYPE_CODE_BOOL) return type; } @@ -1000,7 +1000,7 @@ language_arch_info::type_and_symbol::alloc_type_symbol symbol->owner.arch = gdbarch; symbol->set_is_objfile_owned (0); symbol->set_section_index (0); - SYMBOL_TYPE (symbol) = type; + symbol->set_type (type); symbol->set_domain (VAR_DOMAIN); symbol->set_aclass_index (LOC_TYPEDEF); return symbol; diff --git a/gdb/linespec.c b/gdb/linespec.c index 7c40367..a8ae594 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3494,7 +3494,7 @@ decode_compound_collector::operator () (block_symbol *bsym) if (sym->aclass () != LOC_TYPEDEF) return true; /* Continue iterating. */ - t = SYMBOL_TYPE (sym); + t = sym->type (); t = check_typedef (t); if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION @@ -3686,7 +3686,7 @@ find_method (struct linespec_state *self, pspace = symbol_symtab (sym)->pspace (); gdb_assert (!pspace->executing_startup); set_current_program_space (pspace); - t = check_typedef (SYMBOL_TYPE (sym)); + t = check_typedef (sym->type ()); find_methods (t, sym->language (), method_name, &result_names, &superclass_vec); diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index f3685f7..7607fd7 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -163,8 +163,8 @@ m2_language::print_typedef (struct type *type, struct symbol *new_symbol, { type = check_typedef (type); fprintf_filtered (stream, "TYPE "); - if (!SYMBOL_TYPE (new_symbol)->name () - || strcmp ((SYMBOL_TYPE (new_symbol))->name (), + if (!new_symbol->type ()->name () + || strcmp ((new_symbol->type ())->name (), new_symbol->linkage_name ()) != 0) fprintf_filtered (stream, "%s = ", new_symbol->print_name ()); else diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index a295878..8ede3d6 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -569,9 +569,9 @@ add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend, /* Type could be missing if file is compiled without debugging info. */ if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil || sh->index == indexNil) - SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol; + s->set_type (objfile_type (objfile)->nodebug_data_symbol); else - SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name); + s->set_type (parse_type (cur_fd, ax, sh->index, 0, bigend, name)); /* Value of a data symbol is its memory address. */ } @@ -697,7 +697,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, break; } SYMBOL_VALUE (s) = svalue; - SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name); + s->set_type (parse_type (cur_fd, ax, sh->index, 0, bigend, name)); add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; @@ -706,7 +706,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, 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; + s->set_type (objfile_type (objfile)->builtin_int); add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; @@ -787,12 +787,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, add_symbol (s, top_stack->cur_st, b); /* Make a type for the procedure itself. */ - SYMBOL_TYPE (s) = lookup_function_type (t); + s->set_type (lookup_function_type (t)); /* All functions in C++ have prototypes. For C we don't have enough information in the debug info. */ if (s->language () == language_cplus) - SYMBOL_TYPE (s)->set_is_prototyped (true); + s->type ()->set_is_prototyped (true); /* Create and enter a new lexical context. */ b = new_block (FUNCTION_BLOCK, s->language ()); @@ -809,7 +809,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, push_parse_stack (); top_stack->cur_block = b; top_stack->blocktype = sh->st; - top_stack->cur_type = SYMBOL_TYPE (s); + top_stack->cur_type = s->type (); top_stack->cur_field = -1; top_stack->procadr = sh->value; top_stack->numargs = 0; @@ -1066,7 +1066,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, (obstack_strdup (&mdebugread_objfile->objfile_obstack, f->name ())); enum_sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (enum_sym) = t; + enum_sym->set_type (t); enum_sym->set_domain (VAR_DOMAIN); SYMBOL_VALUE (enum_sym) = tsym.value; if (SYMBOL_VALUE (enum_sym) < 0) @@ -1100,7 +1100,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s->set_domain (STRUCT_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (s) = 0; - SYMBOL_TYPE (s) = t; + s->set_type (t); add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; @@ -1156,7 +1156,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->builtin_void; + s->set_type (objfile_type (mdebugread_objfile)->builtin_void); e = OBSTACK_ZALLOC (&mdebugread_objfile->objfile_obstack, mdebug_extra_func_info); SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; @@ -1204,7 +1204,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sym->is_argument ()) { - ftype->field (iparams).set_type (SYMBOL_TYPE (sym)); + ftype->field (iparams).set_type (sym->type ()); TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0; iparams++; } @@ -1298,17 +1298,17 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s->set_domain (VAR_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block; - SYMBOL_TYPE (s) = t; + s->set_type (t); add_symbol (s, top_stack->cur_st, top_stack->cur_block); /* Incomplete definitions of structs should not get a name. */ - if (SYMBOL_TYPE (s)->name () == NULL - && (SYMBOL_TYPE (s)->num_fields () != 0 - || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT - && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION))) + if (s->type ()->name () == NULL + && (s->type ()->num_fields () != 0 + || (s->type ()->code () != TYPE_CODE_STRUCT + && s->type ()->code () != TYPE_CODE_UNION))) { - if (SYMBOL_TYPE (s)->code () == TYPE_CODE_PTR - || SYMBOL_TYPE (s)->code () == TYPE_CODE_FUNC) + if (s->type ()->code () == TYPE_CODE_PTR + || s->type ()->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we better not set @@ -1330,7 +1330,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, for anything except pointers or functions. */ } else - SYMBOL_TYPE (s)->set_name (s->linkage_name ()); + s->type ()->set_name (s->linkage_name ()); } break; @@ -1990,7 +1990,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, s->set_domain (VAR_DOMAIN); SYMBOL_CLASS (s) = LOC_BLOCK; /* Don't know its type, hope int is ok. */ - SYMBOL_TYPE (s) + s->type () = lookup_function_type (objfile_type (pst->objfile)->builtin_int); add_symbol (s, top_stack->cur_st, top_stack->cur_block); /* Won't have symbols for this one. */ @@ -2044,8 +2044,8 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, if (processing_gcc_compilation == 0 && found_ecoff_debugging_info == 0 - && TYPE_TARGET_TYPE (SYMBOL_TYPE (s))->code () == TYPE_CODE_VOID) - SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol; + && TYPE_TARGET_TYPE (s->type ())->code () == TYPE_CODE_VOID) + s->set_type (objfile_type (mdebugread_objfile)->nodebug_text_symbol); } /* Parse the external symbol ES. Just call parse_symbol() after @@ -3989,7 +3989,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void; + s->set_type (objfile_type (objfile)->builtin_void); SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; e->pdr.framereg = -1; add_symbol_to_list (s, get_local_symbols ()); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index ed22f34..e63f170 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -525,8 +525,8 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, if (values == PRINT_SIMPLE_VALUES) { - check_typedef (arg->sym->type); - type_print (arg->sym->type, "", &stb, -1); + check_typedef (arg->sym->type ()); + type_print (arg->sym->type (), "", &stb, -1); uiout->field_stream ("type", stb); } @@ -648,7 +648,7 @@ list_args_or_locals (const frame_print_options &fp_opts, switch (values) { case PRINT_SIMPLE_VALUES: - type = check_typedef (sym2->type); + type = check_typedef (sym2->type ()); if (type->code () != TYPE_CODE_ARRAY && type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION) diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index a8edce3..6ed26d6 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -81,7 +81,7 @@ output_debug_symbol (ui_out *uiout, enum search_domain kind, if (kind == FUNCTIONS_DOMAIN || kind == VARIABLES_DOMAIN) { string_file tmp_stream; - type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1); + type_print (sym->type (), "", &tmp_stream, -1); uiout->field_string ("type", tmp_stream.string ()); std::string str = symbol_to_info_string (sym, block, kind); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 7247014..3bb9588 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -96,7 +96,7 @@ lookup_struct_typedef (const char *name, const struct block *block, int noerr) else error (_("No struct type named %s."), name); } - if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT) + if (sym->type ()->code () != TYPE_CODE_STRUCT) { if (noerr) return 0; @@ -210,7 +210,7 @@ value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len) if (sym == NULL) type = builtin_type (gdbarch)->builtin_data_ptr; else - type = lookup_pointer_type(SYMBOL_TYPE (sym)); + type = lookup_pointer_type(sym->type ()); deprecated_set_value_type (nsstringValue, type); return nsstringValue; diff --git a/gdb/p-exp.y b/gdb/p-exp.y index c7fa0dc..024a335 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -690,7 +690,7 @@ variable: name_not_typename pstate->block_tracker->update (sym); pstate->push_new<var_value_operation> (sym); - current_type = sym.symbol->type; } + current_type = sym.symbol->type (); } else if ($1.is_a_field_of_this) { struct value * this_val; @@ -1640,9 +1640,9 @@ yylex (void) break; } - yylval.tsym.type = SYMBOL_TYPE (best_sym); + yylval.tsym.type = best_sym->type (); #else /* not 0 */ - yylval.tsym.type = SYMBOL_TYPE (sym); + yylval.tsym.type = sym->type (); #endif /* not 0 */ free (uptokstart); return TYPENAME; diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index a88d6b9..8334ab9 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -255,7 +255,7 @@ pascal_language::value_print_inner (struct value *val, if (wsym) { - wtype = SYMBOL_TYPE (wsym); + wtype = wsym->type (); } else { diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 03bd493..77e19f6 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -250,7 +250,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) if (function != NULL) { struct type *ret_type = - check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function))); + check_typedef (TYPE_TARGET_TYPE (function->type ())); /* Remember only non-void return types. */ if (ret_type->code () != TYPE_CODE_VOID) diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index c756870..747da48 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -72,13 +72,13 @@ sympy_get_type (PyObject *self, void *closure) SYMPY_REQUIRE_VALID (self, symbol); - if (SYMBOL_TYPE (symbol) == NULL) + if (symbol->type () == NULL) { Py_INCREF (Py_None); return Py_None; } - return type_to_type_object (SYMBOL_TYPE (symbol)); + return type_to_type_object (symbol->type ()); } static PyObject * diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 6ab551a..9df667d 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -998,7 +998,7 @@ typy_template_argument (PyObject *self, PyObject *args) sym = TYPE_TEMPLATE_ARGUMENT (type, argno); if (sym->aclass () == LOC_TYPEDEF) - return type_to_type_object (SYMBOL_TYPE (sym)); + return type_to_type_object (sym->type ()); else if (sym->aclass () == LOC_OPTIMIZED_OUT) { PyErr_Format (PyExc_RuntimeError, diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index ec8cdef..7584d25 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1511,7 +1511,7 @@ rust_structop::evaluate_funcall (struct type *expect_type, if (sym.symbol == NULL) error (_("Could not find function named '%s'"), name.c_str ()); - struct type *fn_type = SYMBOL_TYPE (sym.symbol); + struct type *fn_type = sym.symbol->type (); if (fn_type->num_fields () == 0) error (_("Function '%s' takes no arguments"), name.c_str ()); diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c index 75f8a3c..1f75b42 100644 --- a/gdb/rust-parse.c +++ b/gdb/rust-parse.c @@ -458,7 +458,7 @@ rust_parser::rust_lookup_type (const char *name) if (result.symbol != NULL) { update_innermost_block (result); - return SYMBOL_TYPE (result.symbol); + return result.symbol->type (); } type = lookup_typename (language (), name, NULL, 1); @@ -1218,7 +1218,7 @@ rust_parser::name_to_operation (const std::string &name) if (sym.symbol != nullptr) { gdb_assert (sym.symbol->aclass () == LOC_TYPEDEF); - type = SYMBOL_TYPE (sym.symbol); + type = sym.symbol->type (); } if (type == nullptr) type = rust_lookup_type (name.c_str ()); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 90092e8..03242ed 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1234,7 +1234,7 @@ sparc_frame_cache (struct frame_info *this_frame, void **this_cache) static int sparc32_struct_return_from_sym (struct symbol *sym) { - struct type *type = check_typedef (SYMBOL_TYPE (sym)); + struct type *type = check_typedef (sym->type ()); enum type_code code = type->code (); if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 33fcc92..d3a1ae9 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -434,12 +434,12 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, /* I don't think the linker does this with functions, so as far as I know this is never executed. But it doesn't hurt to check. */ - SYMBOL_TYPE (sym) = - lookup_function_type (read_type (&pp, objfile)); + sym->set_type + (lookup_function_type (read_type (&pp, objfile))); } else { - SYMBOL_TYPE (sym) = read_type (&pp, objfile); + sym->set_type (read_type (&pp, objfile)); } add_symbol_to_list (sym, get_global_symbols ()); } @@ -448,12 +448,12 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, pp += 2; if (*(pp - 1) == 'F' || *(pp - 1) == 'f') { - SYMBOL_TYPE (sym) = - lookup_function_type (read_type (&pp, objfile)); + sym->set_type + (lookup_function_type (read_type (&pp, objfile))); } else { - SYMBOL_TYPE (sym) = read_type (&pp, objfile); + sym->set_type (read_type (&pp, objfile)); } } } @@ -784,7 +784,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (*p != '=') { sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; @@ -804,7 +804,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, target_float_from_string (dbl_valu, dbl_type, std::string (p)); - SYMBOL_TYPE (sym) = dbl_type; + sym->set_type (dbl_type); SYMBOL_VALUE_BYTES (sym) = dbl_valu; sym->set_aclass_index (LOC_CONST_BYTES); } @@ -818,7 +818,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, types; other languages probably should have at least unsigned as well as signed constants. */ - SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_long; + sym->set_type (objfile_type (objfile)->builtin_long); SYMBOL_VALUE (sym) = atoi (p); sym->set_aclass_index (LOC_CONST); } @@ -826,7 +826,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'c': { - SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_char; + sym->set_type (objfile_type (objfile)->builtin_char); SYMBOL_VALUE (sym) = atoi (p); sym->set_aclass_index (LOC_CONST); } @@ -843,7 +843,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (quote != '\'' && quote != '"') { sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; @@ -868,7 +868,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (*p != quote) { sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); return sym; @@ -880,9 +880,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, = create_static_range_type (NULL, objfile_type (objfile)->builtin_int, 0, ind); - SYMBOL_TYPE (sym) = create_array_type (NULL, - objfile_type (objfile)->builtin_char, - range_type); + sym->set_type + (create_array_type (NULL, objfile_type (objfile)->builtin_char, + range_type)); string_value = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1); memcpy (string_value, string_local, ind + 1); @@ -900,11 +900,11 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */ { sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); if (*p != ',') { - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); break; } ++p; @@ -921,7 +921,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, default: { sym->set_aclass_index (LOC_CONST); - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); } } sym->set_domain (VAR_DOMAIN); @@ -930,7 +930,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LABEL); sym->set_domain (VAR_DOMAIN); SET_SYMBOL_VALUE_ADDRESS (sym, valu); @@ -939,7 +939,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_BLOCK); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); @@ -949,8 +949,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Function result types are described as the result type in stabs. We need to convert this to the function-returning-type-X type in GDB. E.g. "int" is converted to "function returning int". */ - if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_FUNC) - SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym)); + if (sym->type ()->code () != TYPE_CODE_FUNC) + sym->set_type (lookup_function_type (sym->type ())); /* All functions in C++ have prototypes. Stabs does not offer an explicit way to identify prototyped or unprototyped functions, @@ -958,7 +958,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, than the "declared-as" type for unprototyped functions, so we treat all functions as if they were prototyped. This is used primarily for promotion when calling the function from GDB. */ - SYMBOL_TYPE (sym)->set_is_prototyped (true); + sym->type ()->set_is_prototyped (true); /* fall into process_prototype_types. */ @@ -966,7 +966,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Sun acc puts declared types of arguments here. */ if (*p == ';') { - struct type *ftype = SYMBOL_TYPE (sym); + struct type *ftype = sym->type (); int nsemi = 0; int nparams = 0; const char *p1 = p; @@ -1011,7 +1011,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_BLOCK); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_global_symbols ()); @@ -1022,7 +1022,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, value is not correct. It is necessary to search for the corresponding linker definition to find the value. These definitions appear at the end of the namelist. */ - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_STATIC); sym->set_domain (VAR_DOMAIN); /* Don't add symbol references to global_sym_chain. @@ -1043,7 +1043,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, Dbx data never actually contains 'l'. */ case 's': case 'l': - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; sym->set_domain (VAR_DOMAIN); @@ -1057,12 +1057,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, Translate it into a pointer-to-function type. */ { p++; - SYMBOL_TYPE (sym) - = lookup_pointer_type - (lookup_function_type (read_type (&p, objfile))); + sym->set_type + (lookup_pointer_type + (lookup_function_type (read_type (&p, objfile)))); } else - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_ARG); SYMBOL_VALUE (sym) = valu; @@ -1086,12 +1086,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, { /* If PCC says a parameter is a short or a char, it is really an int. */ - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) + if (TYPE_LENGTH (sym->type ()) < gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT - && SYMBOL_TYPE (sym)->code () == TYPE_CODE_INT) + && sym->type ()->code () == TYPE_CODE_INT) { - SYMBOL_TYPE (sym) = - (SYMBOL_TYPE (sym)->is_unsigned () + sym->set_type + (sym->type ()->is_unsigned () ? objfile_type (objfile)->builtin_unsigned_int : objfile_type (objfile)->builtin_int); } @@ -1105,14 +1105,14 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, with this extra information. FIXME, it ought to. */ if (type == N_FUN) { - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); goto process_prototype_types; } /*FALLTHROUGH */ case 'R': /* Parameter which is in a register. */ - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_register_index); sym->set_is_argument (1); SYMBOL_VALUE (sym) = valu; @@ -1122,7 +1122,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_register_index); SYMBOL_VALUE (sym) = valu; sym->set_domain (VAR_DOMAIN); @@ -1150,7 +1150,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct pending *local_symbols = *get_local_symbols (); if (local_symbols && local_symbols->nsyms > 0 - && gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym))) + && gdbarch_stabs_argument_has_addr (gdbarch, sym->type ())) { struct symbol *prev_sym; @@ -1163,7 +1163,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, 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); + prev_sym->set_type (sym->type ()); SYMBOL_VALUE (prev_sym) = SYMBOL_VALUE (sym); sym = prev_sym; break; @@ -1177,7 +1177,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); sym->set_domain (VAR_DOMAIN); @@ -1202,7 +1202,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, synonym = (sym->language () == language_ada && p[-2] != 'T'); /* Typedef */ - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); /* For a nameless type, we don't want a create a symbol, thus we did not use `sym'. Return without further processing. */ @@ -1216,24 +1216,24 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, a base type which did not have its name defined when the derived class was output. We fill in the derived class's base part member's name here in that case. */ - if (SYMBOL_TYPE (sym)->name () != NULL) - if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT - || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION) - && TYPE_N_BASECLASSES (SYMBOL_TYPE (sym))) + if (sym->type ()->name () != NULL) + if ((sym->type ()->code () == TYPE_CODE_STRUCT + || sym->type ()->code () == TYPE_CODE_UNION) + && TYPE_N_BASECLASSES (sym->type ())) { int j; - for (j = TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)) - 1; j >= 0; j--) - if (TYPE_BASECLASS_NAME (SYMBOL_TYPE (sym), j) == 0) - SYMBOL_TYPE (sym)->field (j).set_name - (TYPE_BASECLASS (SYMBOL_TYPE (sym), j)->name ()); + for (j = TYPE_N_BASECLASSES (sym->type ()) - 1; j >= 0; j--) + if (TYPE_BASECLASS_NAME (sym->type (), j) == 0) + sym->type ()->field (j).set_name + (TYPE_BASECLASS (sym->type (), j)->name ()); } - if (SYMBOL_TYPE (sym)->name () == NULL) + if (sym->type ()->name () == NULL) { - if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR + if ((sym->type ()->code () == TYPE_CODE_PTR && strcmp (sym->linkage_name (), vtbl_ptr_name)) - || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC) + || sym->type ()->code () == TYPE_CODE_FUNC) { /* If we are giving a name to a type such as "pointer to foo" or "function returning foo", we better not set @@ -1272,10 +1272,10 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Pascal accepts names for pointer types. */ if (get_current_subfile ()->language == language_pascal) - SYMBOL_TYPE (sym)->set_name (sym->linkage_name ()); + sym->type ()->set_name (sym->linkage_name ()); } else - SYMBOL_TYPE (sym)->set_name (sym->linkage_name ()); + sym->type ()->set_name (sym->linkage_name ()); } add_symbol_to_list (sym, get_file_symbols ()); @@ -1289,8 +1289,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, struct_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (struct_sym) = valu; struct_sym->set_domain (STRUCT_DOMAIN); - if (SYMBOL_TYPE (sym)->name () == 0) - SYMBOL_TYPE (sym)->set_name + if (sym->type ()->name () == 0) + sym->type ()->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL)); add_symbol_to_list (struct_sym, get_file_symbols ()); @@ -1306,7 +1306,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (synonym) p++; - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); /* For a nameless type, we don't want a create a symbol, thus we did not use `sym'. Return without further processing. */ @@ -1316,8 +1316,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (sym) = valu; sym->set_domain (STRUCT_DOMAIN); - if (SYMBOL_TYPE (sym)->name () == 0) - SYMBOL_TYPE (sym)->set_name + if (sym->type ()->name () == 0) + sym->type ()->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL)); add_symbol_to_list (sym, get_file_symbols ()); @@ -1331,8 +1331,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, typedef_sym->set_aclass_index (LOC_TYPEDEF); SYMBOL_VALUE (typedef_sym) = valu; typedef_sym->set_domain (VAR_DOMAIN); - if (SYMBOL_TYPE (sym)->name () == 0) - SYMBOL_TYPE (sym)->set_name + if (sym->type ()->name () == 0) + sym->type ()->set_name (obconcat (&objfile->objfile_obstack, sym->linkage_name (), (char *) NULL)); add_symbol_to_list (typedef_sym, get_file_symbols ()); @@ -1341,7 +1341,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_STATIC); SET_SYMBOL_VALUE_ADDRESS (sym, valu); sym->set_domain (VAR_DOMAIN); @@ -1350,7 +1350,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'v': /* Reference parameter */ - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_REF_ARG); sym->set_is_argument (1); SYMBOL_VALUE (sym) = valu; @@ -1360,7 +1360,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); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_regparm_index); sym->set_is_argument (1); SYMBOL_VALUE (sym) = valu; @@ -1373,7 +1373,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, Sun claims ("dbx and dbxtool interfaces", 2nd ed) that Pascal uses it too, but when I tried it Pascal used "x:3" (local symbol) instead. */ - SYMBOL_TYPE (sym) = read_type (&p, objfile); + sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LOCAL); SYMBOL_VALUE (sym) = valu; sym->set_domain (VAR_DOMAIN); @@ -1381,7 +1381,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, break; default: - SYMBOL_TYPE (sym) = error_type (&p, objfile); + sym->set_type (error_type (&p, objfile)); sym->set_aclass_index (LOC_CONST); SYMBOL_VALUE (sym) = 0; sym->set_domain (VAR_DOMAIN); @@ -1393,7 +1393,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, of by value, i.e. they will pass the address of a structure (in a register or on the stack) instead of the structure itself. */ - if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)) + if (gdbarch_stabs_argument_has_addr (gdbarch, sym->type ()) && sym->is_argument ()) { /* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for @@ -1630,11 +1630,11 @@ again: if (sym->aclass () == LOC_TYPEDEF && sym->domain () == STRUCT_DOMAIN - && (SYMBOL_TYPE (sym)->code () == code) + && (sym->type ()->code () == code) && strcmp (sym->linkage_name (), type_name) == 0) { obstack_free (&objfile->objfile_obstack, type_name); - type = SYMBOL_TYPE (sym); + type = sym->type (); if (typenums[0] != -1) *dbx_lookup_type (typenums, objfile) = type; return type; @@ -3635,7 +3635,7 @@ read_enum_type (const char **pp, struct type *type, { struct symbol *xsym = syms->symbol[j]; - SYMBOL_TYPE (xsym) = type; + xsym->set_type (type); type->field (n).set_name (xsym->linkage_name ()); type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym)); TYPE_FIELD_BITSIZE (type, n) = 0; @@ -4281,7 +4281,7 @@ common_block_end (struct objfile *objfile) for (j = common_block_i; j < common_block->nsyms; j++) add_symbol_to_list (common_block->symbol[j], &newobj); - SYMBOL_TYPE (sym) = (struct type *) newobj; + sym->set_type ((struct type *) newobj); /* Should we be putting local_symbols back to what it was? Does it matter? */ @@ -4299,7 +4299,7 @@ common_block_end (struct objfile *objfile) static void fix_common_block (struct symbol *sym, CORE_ADDR valu) { - struct pending *next = (struct pending *) SYMBOL_TYPE (sym); + struct pending *next = (struct pending *) sym->type (); for (; next; next = next->next) { @@ -4468,11 +4468,11 @@ cleanup_undefined_types_1 (void) if (sym->aclass () == LOC_TYPEDEF && sym->domain () == STRUCT_DOMAIN - && (SYMBOL_TYPE (sym)->code () == (*type)->code ()) + && (sym->type ()->code () == (*type)->code ()) && ((*type)->instance_flags () - == SYMBOL_TYPE (sym)->instance_flags ()) + == sym->type ()->instance_flags ()) && strcmp (sym->linkage_name (), type_name) == 0) - replace_type (*type, SYMBOL_TYPE (sym)); + replace_type (*type, sym->type ()); } } } diff --git a/gdb/stack.c b/gdb/stack.c index 834e016..b1bbf7d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -674,7 +674,7 @@ read_frame_arg (const frame_print_options &fp_opts, || (fp_opts.print_entry_values == print_entry_values_preferred && (!val || value_optimized_out (val)))) { - entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym)); + entryval = allocate_optimized_out_value (sym->type ()); entryval_error = NULL; } } @@ -779,7 +779,7 @@ print_frame_args (const frame_print_options &fp_opts, case LOC_REF_ARG: { long current_offset = SYMBOL_VALUE (sym); - int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); + int arg_size = TYPE_LENGTH (sym->type ()); /* Compute address of next argument by adding the size of this argument and rounding to an int boundary. */ @@ -2762,7 +2762,7 @@ return_command (const char *retval_exp, int from_tty) /* Cast return value to the return type of the function. Should the cast fail, this call throws an error. */ if (thisfun != NULL) - return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun)); + return_type = TYPE_TARGET_TYPE (thisfun->type ()); if (return_type == NULL) { if (retval_expr->first_opcode () != UNOP_CAST @@ -2818,7 +2818,7 @@ return_command (const char *retval_exp, int from_tty) query_prefix); else { - if (TYPE_NO_RETURN (thisfun->type)) + if (TYPE_NO_RETURN (thisfun->type ())) warning (_("Function does not return normally to caller.")); confirmed = query (_("%sMake %s return now? "), query_prefix, thisfun->print_name ()); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 328230a..160278b 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -523,20 +523,20 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, if (symbol->domain () == STRUCT_DOMAIN) { - if (SYMBOL_TYPE (symbol)->name ()) + if (symbol->type ()->name ()) { - LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth, + LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth, &type_print_raw_options); } else { fprintf_filtered (outfile, "%s %s = ", - (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_ENUM + (symbol->type ()->code () == TYPE_CODE_ENUM ? "enum" - : (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_STRUCT + : (symbol->type ()->code () == TYPE_CODE_STRUCT ? "struct" : "union")), symbol->linkage_name ()); - LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth, + LA_PRINT_TYPE (symbol->type (), "", outfile, 1, depth, &type_print_raw_options); } fprintf_filtered (outfile, ";\n"); @@ -545,12 +545,12 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, { if (symbol->aclass () == LOC_TYPEDEF) fprintf_filtered (outfile, "typedef "); - if (SYMBOL_TYPE (symbol)) + if (symbol->type ()) { /* Print details of types, except for enums where it's clutter. */ - LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (), + LA_PRINT_TYPE (symbol->type (), symbol->print_name (), outfile, - SYMBOL_TYPE (symbol)->code () != TYPE_CODE_ENUM, + symbol->type ()->code () != TYPE_CODE_ENUM, depth, &type_print_raw_options); fprintf_filtered (outfile, "; "); @@ -569,7 +569,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_CONST_BYTES: { unsigned i; - struct type *type = check_typedef (SYMBOL_TYPE (symbol)); + struct type *type = check_typedef (symbol->type ()); fprintf_filtered (outfile, "const %s hex bytes:", pulongest (TYPE_LENGTH (type))); diff --git a/gdb/symtab.c b/gdb/symtab.c index 8bdc6ca..8da86b6 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2130,7 +2130,7 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type, if (result.symbol) { - struct type *t = result.symbol->type; + struct type *t = result.symbol->type (); /* I'm not really sure that type of this can ever be typedefed; just be safe. */ @@ -2806,8 +2806,8 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, block_find_non_opaque_type, NULL); if (sym == NULL) error_in_psymtab_expansion (block_index, name, cust); - gdb_assert (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))); - return SYMBOL_TYPE (sym); + gdb_assert (!TYPE_IS_OPAQUE (sym->type ())); + return sym->type (); } /* Subroutine of basic_lookup_transparent_type to simplify it. @@ -2831,8 +2831,8 @@ basic_lookup_transparent_type_1 (struct objfile *objfile, block_find_non_opaque_type, NULL); if (sym != NULL) { - gdb_assert (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))); - return SYMBOL_TYPE (sym); + gdb_assert (!TYPE_IS_OPAQUE (sym->type ())); + return sym->type (); } } @@ -4657,7 +4657,7 @@ treg_matches_sym_type_name (const compiled_regex &treg, sym->natural_name ()); } - sym_type = SYMBOL_TYPE (sym); + sym_type = sym->type (); if (sym_type == NULL) return false; @@ -4836,7 +4836,7 @@ global_symbol_searcher::add_matching_symbols members. We only want to skip enums here. */ && !(sym->aclass () == LOC_CONST - && (SYMBOL_TYPE (sym)->code () + && (sym->type ()->code () == TYPE_CODE_ENUM)) && (!treg.has_value () || treg_matches_sym_type_name (*treg, sym))) @@ -5042,10 +5042,10 @@ symbol_to_info_string (struct symbol *sym, int block, For the struct printing case below, things are worse, we force printing of the ";" in this function, which is going to be wrong for languages that don't require a ";" between statements. */ - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_TYPEDEF) - typedef_print (SYMBOL_TYPE (sym), sym, &tmp_stream); + if (sym->type ()->code () == TYPE_CODE_TYPEDEF) + typedef_print (sym->type (), sym, &tmp_stream); else - type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1); + type_print (sym->type (), "", &tmp_stream, -1); str += tmp_stream.string (); } /* variable, func, or typedef-that-is-c++-class. */ @@ -5055,7 +5055,7 @@ symbol_to_info_string (struct symbol *sym, int block, { string_file tmp_stream; - type_print (SYMBOL_TYPE (sym), + type_print (sym->type (), (sym->aclass () == LOC_TYPEDEF ? "" : sym->print_name ()), &tmp_stream, 0); @@ -5673,7 +5673,7 @@ completion_list_add_fields (completion_tracker &tracker, { if (sym->aclass () == LOC_TYPEDEF) { - struct type *t = SYMBOL_TYPE (sym); + struct type *t = sym->type (); enum type_code c = t->code (); int j; @@ -5691,7 +5691,7 @@ completion_list_add_fields (completion_tracker &tracker, bool symbol_is_function_or_method (symbol *sym) { - switch (SYMBOL_TYPE (sym)->code ()) + switch (sym->type ()->code ()) { case TYPE_CODE_FUNC: case TYPE_CODE_METHOD: @@ -5789,7 +5789,7 @@ add_symtab_completions (struct compunit_symtab *cust, if (code == TYPE_CODE_UNDEF || (sym->domain () == STRUCT_DOMAIN - && SYMBOL_TYPE (sym)->code () == code)) + && sym->type ()->code () == code)) completion_list_add_symbol (tracker, sym, lookup_name, text, word); @@ -5942,7 +5942,7 @@ default_collect_symbol_completion_matches_break_on sym_text, word); } else if (sym->domain () == STRUCT_DOMAIN - && SYMBOL_TYPE (sym)->code () == code) + && sym->type ()->code () == code) completion_list_add_symbol (tracker, sym, lookup_name, sym_text, word); } diff --git a/gdb/symtab.h b/gdb/symtab.h index a861451..3486803 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1203,9 +1203,19 @@ struct symbol : public general_symbol_info, public allocate_on_obstack return this->subclass == SYMBOL_TEMPLATE; } + struct type *type () const + { + return m_type; + } + + void set_type (struct type *type) + { + m_type = type; + } + /* Data type of value */ - struct type *type = nullptr; + struct type *m_type = nullptr; /* The owner of this symbol. Which one to use is defined by symbol.is_objfile_owned. */ @@ -1305,7 +1315,6 @@ struct block_symbol /* Note: There is no accessor macro for symbol.owner because it is "private". */ -#define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_COMPUTED_OPS(symbol) ((symbol)->impl ().ops_computed) #define SYMBOL_BLOCK_OPS(symbol) ((symbol)->impl ().ops_block) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index d8577dc..73ebc38 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -927,7 +927,7 @@ collection_list::collect_symbol (struct symbol *sym, bfd_signed_vma offset; int treat_as_expr = 0; - len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))); + len = TYPE_LENGTH (check_typedef (sym->type ())); switch (sym->aclass ()) { default: @@ -948,7 +948,7 @@ collection_list::collect_symbol (struct symbol *sym, } /* A struct may be a C++ class with static fields, go to general expression handling. */ - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT) + if (sym->type ()->code () == TYPE_CODE_STRUCT) treat_as_expr = 1; else add_memrange (gdbarch, memrange_absolute, offset, len, scope); @@ -960,7 +960,7 @@ collection_list::collect_symbol (struct symbol *sym, add_local_register (gdbarch, reg, scope); /* Check for doubles stored in two registers. */ /* FIXME: how about larger types stored in 3 or more regs? */ - if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_FLT && + if (sym->type ()->code () == TYPE_CODE_FLT && len > register_size (gdbarch, reg)) add_local_register (gdbarch, reg + 1, scope); break; @@ -2565,8 +2565,8 @@ info_scope_command (const char *args_in, int from_tty) break; case LOC_CONST_BYTES: printf_filtered ("constant bytes: "); - if (SYMBOL_TYPE (sym)) - for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++) + if (sym->type ()) + for (j = 0; j < TYPE_LENGTH (sym->type ()); j++) printf_filtered (" %02x", (unsigned) SYMBOL_VALUE_BYTES (sym)[j]); break; @@ -2645,9 +2645,9 @@ info_scope_command (const char *args_in, int from_tty) gdb_assert_not_reached ("LOC_COMPUTED variable missing a method"); } } - if (SYMBOL_TYPE (sym)) + if (sym->type ()) { - struct type *t = check_typedef (SYMBOL_TYPE (sym)); + struct type *t = check_typedef (sym->type ()); printf_filtered (", length %s.\n", pulongest (TYPE_LENGTH (t))); } diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 1de223a..f7a2eba 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -260,7 +260,7 @@ typedef_hash_table::add_template_parameters (struct type *t) tf = XOBNEW (&m_storage, struct decl_field); tf->name = TYPE_TEMPLATE_ARGUMENT (t, i)->linkage_name (); - tf->type = SYMBOL_TYPE (TYPE_TEMPLATE_ARGUMENT (t, i)); + tf->type = TYPE_TEMPLATE_ARGUMENT (t, i)->type (); slot = htab_find_slot (m_table.get (), tf, INSERT); if (*slot == NULL) diff --git a/gdb/valops.c b/gdb/valops.c index 9767b2c..3a59512 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1387,7 +1387,7 @@ value_of_variable (struct symbol *var, const struct block *b) struct value * address_of_variable (struct symbol *var, const struct block *b) { - struct type *type = SYMBOL_TYPE (var); + struct type *type = var->type (); struct value *val; /* Evaluate it first; if the result is a memory address, we're fine. @@ -2833,7 +2833,7 @@ find_overload_match (gdb::array_view<value *> args, the function part. Do not try this for non-functions (e.g. function pointers). */ if (qualified_name - && (check_typedef (SYMBOL_TYPE (fsym))->code () + && (check_typedef (fsym->type ())->code () == TYPE_CODE_FUNC)) { temp_func = cp_func_name (qualified_name); @@ -3187,14 +3187,14 @@ find_oload_champ (gdb::array_view<value *> args, static_offset = oload_method_static_p (methods, ix); } else - nparms = SYMBOL_TYPE (functions[ix])->num_fields (); + nparms = functions[ix]->type ()->num_fields (); parm_types.reserve (nparms); for (jj = 0; jj < nparms; jj++) { type *t = (methods != NULL ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ()) - : SYMBOL_TYPE (functions[ix])->field (jj).type ()); + : functions[ix]->type ()->field (jj).type ()); parm_types.push_back (t); } } @@ -3780,7 +3780,7 @@ value_maybe_namespace_elt (const struct type *curtype, return NULL; else if ((noside == EVAL_AVOID_SIDE_EFFECTS) && (sym.symbol->aclass () == LOC_TYPEDEF)) - result = allocate_value (SYMBOL_TYPE (sym.symbol)); + result = allocate_value (sym.symbol->type ()); else result = value_of_variable (sym.symbol, sym.block); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index bdfbdbf..d3e9ade 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1572,7 +1572,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) patch_block_stabs (), unless the file was compiled without -g. */ sym->set_linkage_name (SYMNAME_ALLOC (name, symname_alloced)); - SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol; + sym->set_type (objfile_type (objfile)->nodebug_text_symbol); sym->set_aclass_index (LOC_BLOCK); sym2 = new (&objfile->objfile_obstack) symbol (*sym); @@ -1585,7 +1585,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) else { /* In case we can't figure out the type, provide default. */ - SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_data_symbol; + sym->set_type (objfile_type (objfile)->nodebug_data_symbol); switch (cs->c_sclass) { |