From 4aeddc50d7a06294cc124dfd8f43992ffa0b7382 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 28 Jan 2022 08:09:50 -0500 Subject: [PATCH] gdb: remove symbol value macros Remove all macros related to getting and setting some symbol value: #define SYMBOL_VALUE(symbol) (symbol)->value.ivalue #define SYMBOL_VALUE_ADDRESS(symbol) \ #define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain #define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue #define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0) #define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \ #define BMSYMBOL_VALUE_ADDRESS(symbol) \ #define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block Replace them with equivalent methods on the appropriate objects. Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50 --- gdb/ada-exp.y | 2 +- gdb/ada-lang.c | 18 ++-- gdb/ada-tasks.c | 8 +- gdb/aix-thread.c | 4 +- gdb/alpha-mdebug-tdep.c | 2 +- gdb/arc-linux-tdep.c | 4 +- gdb/arm-tdep.c | 6 +- gdb/auxv.c | 2 +- gdb/avr-tdep.c | 2 +- gdb/ax-gdb.c | 12 +-- gdb/blockframe.c | 14 +-- gdb/breakpoint.c | 11 +-- gdb/bsd-uthread.c | 2 +- gdb/buildsym.c | 2 +- gdb/c-exp.y | 6 +- gdb/c-valprint.c | 2 +- gdb/coff-pe-read.c | 2 +- gdb/coffread.c | 49 ++++------ gdb/compile/compile-c-symbols.c | 14 +-- gdb/compile/compile-cplus-symbols.c | 14 +-- gdb/compile/compile-cplus-types.c | 4 +- gdb/compile/compile-object-load.c | 4 +- gdb/compile/compile-object-run.c | 2 +- gdb/cp-namespace.c | 2 +- gdb/ctfread.c | 2 +- gdb/dbxread.c | 8 +- gdb/dwarf2/loc.c | 6 +- gdb/dwarf2/read.c | 35 ++++--- gdb/elfread.c | 4 +- gdb/f-valprint.c | 2 +- gdb/fbsd-tdep.c | 4 +- gdb/findvar.c | 27 +++--- gdb/frame.c | 4 +- gdb/frv-tdep.c | 2 +- gdb/ft32-tdep.c | 2 +- gdb/glibc-tdep.c | 2 +- gdb/gnu-v3-abi.c | 4 +- gdb/hppa-tdep.c | 4 +- gdb/infcmd.c | 6 +- gdb/infrun.c | 2 +- gdb/inline-frame.c | 4 +- gdb/jit.c | 12 +-- gdb/linespec.c | 14 +-- gdb/linux-thread-db.c | 2 +- gdb/m2-exp.y | 2 +- gdb/m32c-tdep.c | 8 +- gdb/m32r-tdep.c | 2 +- gdb/m68hc11-tdep.c | 2 +- gdb/machoread.c | 2 +- gdb/maint.c | 2 +- gdb/mdebugread.c | 32 +++---- gdb/mi/mi-symbol-cmds.c | 2 +- gdb/minsyms.c | 55 ++++++----- gdb/minsyms.h | 7 ++ gdb/mips-fbsd-tdep.c | 2 +- gdb/mips-linux-tdep.c | 2 +- gdb/mips-tdep.c | 8 +- gdb/netbsd-tdep.c | 2 +- gdb/objc-lang.c | 2 +- gdb/objfiles.c | 7 +- gdb/obsd-tdep.c | 2 +- gdb/p-exp.y | 4 +- gdb/p-valprint.c | 2 +- gdb/parse.c | 6 +- gdb/ppc-linux-tdep.c | 6 +- gdb/ppc-sysv-tdep.c | 2 +- gdb/printcmd.c | 22 ++--- gdb/proc-service.c | 2 +- gdb/psympriv.h | 6 +- gdb/psymtab.c | 12 +-- gdb/ravenscar-thread.c | 2 +- gdb/remote.c | 2 +- gdb/sol-thread.c | 2 +- gdb/sol2-tdep.c | 2 +- gdb/solib-dsbt.c | 2 +- gdb/solib-frv.c | 4 +- gdb/solib-svr4.c | 10 +- gdb/solib.c | 4 +- gdb/stabsread.c | 83 ++++++++--------- gdb/stack.c | 6 +- gdb/symfile.c | 6 +- gdb/symmisc.c | 34 ++++--- gdb/symtab.c | 61 +++++++----- gdb/symtab.h | 140 ++++++++++++++++++++-------- gdb/tracepoint.c | 37 ++++---- gdb/tui/tui-disasm.c | 6 +- gdb/valops.c | 2 +- gdb/value.c | 6 +- gdb/xcoffread.c | 7 +- gdb/z80-tdep.c | 13 ++- 90 files changed, 503 insertions(+), 461 deletions(-) diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index a2755d7501e..60a7c1bf91f 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1382,7 +1382,7 @@ block_lookup (const struct block *context, const char *raw_name) { if (syms.size () > 1) warning (_("Function name \"%s\" ambiguous here"), raw_name); - result = SYMBOL_BLOCK_VALUE (syms[0].symbol); + result = syms[0].symbol->value_block (); } return result; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d819038e63b..29f2a4b255a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -819,7 +819,7 @@ ada_main_name (void) if (msym.minsym != NULL) { - CORE_ADDR main_program_name_addr = BMSYMBOL_VALUE_ADDRESS (msym); + CORE_ADDR main_program_name_addr = msym.value_address (); if (main_program_name_addr == 0) error (_("Invalid address for Ada main program name.")); @@ -4825,7 +4825,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) && startswith (name1 + len0, "___XV"))); } case LOC_CONST: - return SYMBOL_VALUE (sym0) == SYMBOL_VALUE (sym1) + return sym0->value_longest () == sym1->value_longest () && equiv_types (sym0->type (), sym1->type ()); case LOC_STATIC: @@ -4833,7 +4833,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) const char *name0 = sym0->linkage_name (); const char *name1 = sym1->linkage_name (); return (strcmp (name0, name1) == 0 - && SYMBOL_VALUE_ADDRESS (sym0) == SYMBOL_VALUE_ADDRESS (sym1)); + && sym0->value_address () == sym1->value_address ()); } default: @@ -5003,7 +5003,7 @@ symbols_are_identical_enums (const std::vector &syms) /* Quick check: They should all have the same value. */ for (i = 1; i < syms.size (); i++) - if (SYMBOL_VALUE (syms[i].symbol) != SYMBOL_VALUE (syms[0].symbol)) + if (syms[i].symbol->value_longest () != syms[0].symbol->value_longest ()) return 0; /* Quick check: They should all have the same number of enumerals. */ @@ -5077,8 +5077,8 @@ remove_extra_symbols (std::vector *syms) (*syms)[j].symbol->linkage_name ()) == 0 && ((*syms)[i].symbol->aclass () == (*syms)[j].symbol->aclass ()) - && SYMBOL_VALUE_ADDRESS ((*syms)[i].symbol) - == SYMBOL_VALUE_ADDRESS ((*syms)[j].symbol)) + && (*syms)[i].symbol->value_address () + == (*syms)[j].symbol->value_address ()) remove_p = 1; } } @@ -12987,7 +12987,7 @@ ada_add_standard_exceptions (compiled_regex *preg, if (msymbol.minsym != NULL) { struct ada_exc_info info - = {name, BMSYMBOL_VALUE_ADDRESS (msymbol)}; + = {name, msymbol.value_address ()}; exceptions->push_back (info); } @@ -13029,7 +13029,7 @@ ada_add_exceptions_from_frame (compiled_regex *preg, if (ada_is_exception_sym (sym)) { struct ada_exc_info info = {sym->print_name (), - SYMBOL_VALUE_ADDRESS (sym)}; + sym->value_address ()}; exceptions->push_back (info); } @@ -13105,7 +13105,7 @@ ada_add_global_exceptions (compiled_regex *preg, && name_matches_regex (sym->natural_name (), preg)) { struct ada_exc_info info - = {sym->print_name (), SYMBOL_VALUE_ADDRESS (sym)}; + = {sym->print_name (), sym->value_address ()}; exceptions->push_back (info); } diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 5622772b013..0043f2999d9 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -574,7 +574,7 @@ ada_get_tcb_types_info (void) unsigned int first_id = 0; if (first_id_sym.minsym != nullptr) { - CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (first_id_sym); + CORE_ADDR addr = first_id_sym.value_address (); /* This symbol always has type uint32_t. */ struct type *u32type = builtin_type (target_gdbarch ())->builtin_uint32; first_id = value_as_long (value_at (u32type, addr)); @@ -896,7 +896,7 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) if (msym.minsym != NULL) { data->known_tasks_kind = ADA_TASKS_ARRAY; - data->known_tasks_addr = BMSYMBOL_VALUE_ADDRESS (msym); + data->known_tasks_addr = msym.value_address (); /* Try to get pointer type and array length from the symtab. */ sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN, @@ -942,12 +942,12 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) if (msym.minsym != NULL) { data->known_tasks_kind = ADA_TASKS_LIST; - data->known_tasks_addr = BMSYMBOL_VALUE_ADDRESS (msym); + data->known_tasks_addr = msym.value_address (); data->known_tasks_length = 1; sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN, language_c, NULL).symbol; - if (sym != NULL && SYMBOL_VALUE_ADDRESS (sym) != 0) + if (sym != NULL && sym->value_address () != 0) { /* Validate. */ struct type *type = check_typedef (sym->type ()); diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 85be4c15f1c..4e41cde6694 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -360,7 +360,7 @@ pdc_symbol_addrs (pthdb_user_t user, pthdb_symbol_t *symbols, int count) gdb_printf (gdb_stdlog, " returning PDC_FAILURE\n"); return PDC_FAILURE; } - symbols[i].addr = BMSYMBOL_VALUE_ADDRESS (ms); + symbols[i].addr = ms->value_address (); } if (debug_aix_thread) gdb_printf (gdb_stdlog, " symbols[%d].addr = %s\n", @@ -969,7 +969,7 @@ pd_enable (void) ms = lookup_minimal_symbol (stub_name, NULL, NULL); if (ms.minsym == NULL) return; - pd_brk_addr = BMSYMBOL_VALUE_ADDRESS (ms); + pd_brk_addr = ms->value_address (); if (!create_thread_event_breakpoint (target_gdbarch (), pd_brk_addr)) return; diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c index ec11bc45423..a8b4bcbea4a 100644 --- a/gdb/alpha-mdebug-tdep.c +++ b/gdb/alpha-mdebug-tdep.c @@ -114,7 +114,7 @@ find_proc_desc (CORE_ADDR pc) if (sym) { - proc_desc = (struct mdebug_extra_func_info *) SYMBOL_VALUE_BYTES (sym); + proc_desc = (struct mdebug_extra_func_info *) sym->value_bytes (); /* Correct incorrect setjmp procedure descriptor from the library to make backtrace through setjmp work. */ diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c index 1744b7544cd..13595f2e8e9 100644 --- a/gdb/arc-linux-tdep.c +++ b/gdb/arc-linux-tdep.c @@ -509,7 +509,7 @@ arc_linux_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { if (resolver.minsym != nullptr) { - CORE_ADDR res_addr = BMSYMBOL_VALUE_ADDRESS (resolver); + CORE_ADDR res_addr = resolver.value_address (); arc_linux_debug_printf ("pc = %s, resolver at %s", print_core_address (gdbarch, pc), print_core_address (gdbarch, res_addr)); @@ -519,7 +519,7 @@ arc_linux_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) print_core_address (gdbarch, pc)); } - if (resolver.minsym != nullptr && BMSYMBOL_VALUE_ADDRESS (resolver) == pc) + if (resolver.minsym != nullptr && resolver.value_address () == pc) { /* Find the return address. */ return frame_unwind_caller_pc (get_current_frame ()); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index fbc0a38bff3..7002bcaa279 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -600,7 +600,7 @@ skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb) msym = lookup_minimal_symbol_by_pc (pc); if (msym.minsym != NULL - && BMSYMBOL_VALUE_ADDRESS (msym) == pc + && msym.value_address () == pc && msym.minsym->linkage_name () != NULL) { const char *name = msym.minsym->linkage_name (); @@ -8521,7 +8521,7 @@ arm_skip_cmse_entry (CORE_ADDR pc, const char *name, struct objfile *objfile) = lookup_minimal_symbol (target_name, NULL, objfile); if (minsym.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (minsym); + return minsym.value_address (); return 0; } @@ -8610,7 +8610,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc) objfile = (sec == NULL) ? NULL : sec->objfile; minsym = lookup_minimal_symbol (target_name, NULL, objfile); if (minsym.minsym != NULL) - return BMSYMBOL_VALUE_ADDRESS (minsym); + return minsym.value_address (); else return 0; } diff --git a/gdb/auxv.c b/gdb/auxv.c index 840db0257af..190cd69d6bd 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -101,7 +101,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf, resides. DATA_ADDRESS is the inferior value present in `_dl_auxv', therefore the real inferior AUXV address. */ - pointer_address = BMSYMBOL_VALUE_ADDRESS (msym); + pointer_address = msym.value_address (); /* The location of the _dl_auxv symbol may no longer be correct if ld.so runs at a different address than the one present in the diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 310c8cf9ca2..9e73c507b2e 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -664,7 +664,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, /* Resolve offset (in words) from __prologue_saves__ symbol. Which is a pushes count in `-mcall-prologues' mode */ - num_pushes = AVR_MAX_PUSHES - (i - BMSYMBOL_VALUE_ADDRESS (msymbol)) / 2; + num_pushes = AVR_MAX_PUSHES - (i - msymbol.value_address ()) / 2; if (num_pushes > AVR_MAX_PUSHES) { diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index be2063f2366..e2e311f9d74 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -499,7 +499,7 @@ gen_offset (struct agent_expr *ax, int offset) static void gen_sym_offset (struct agent_expr *ax, struct symbol *var) { - gen_offset (ax, SYMBOL_VALUE (var)); + gen_offset (ax, var->value_longest ()); } @@ -523,12 +523,12 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) switch (var->aclass ()) { case LOC_CONST: /* A constant, like an enum value. */ - ax_const_l (ax, (LONGEST) SYMBOL_VALUE (var)); + ax_const_l (ax, (LONGEST) var->value_longest ()); value->kind = axs_rvalue; break; case LOC_LABEL: /* A goto label, being used as a value. */ - ax_const_l (ax, (LONGEST) SYMBOL_VALUE_ADDRESS (var)); + ax_const_l (ax, (LONGEST) var->value_address ()); value->kind = axs_rvalue; break; @@ -540,7 +540,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) /* Variable at a fixed location in memory. Easy. */ case LOC_STATIC: /* Push the address of the variable. */ - ax_const_l (ax, SYMBOL_VALUE_ADDRESS (var)); + ax_const_l (ax, var->value_address ()); value->kind = axs_lvalue_memory; break; @@ -571,7 +571,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) break; case LOC_BLOCK: - ax_const_l (ax, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var))); + ax_const_l (ax, BLOCK_ENTRY_PC (var->value_block ())); value->kind = axs_rvalue; break; @@ -603,7 +603,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) error (_("Couldn't resolve symbol `%s'."), var->print_name ()); /* Push the address of the variable. */ - ax_const_l (ax, BMSYMBOL_VALUE_ADDRESS (msym)); + ax_const_l (ax, msym.value_address ()); value->kind = axs_lvalue_memory; } break; diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 50c464f44a2..df03901b6e7 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -95,7 +95,7 @@ get_pc_function_start (CORE_ADDR pc) if (symbol) { - bl = SYMBOL_BLOCK_VALUE (symbol); + bl = symbol->value_block (); return BLOCK_ENTRY_PC (bl); } } @@ -103,7 +103,7 @@ get_pc_function_start (CORE_ADDR pc) msymbol = lookup_minimal_symbol_by_pc (pc); if (msymbol.minsym) { - CORE_ADDR fstart = BMSYMBOL_VALUE_ADDRESS (msymbol); + CORE_ADDR fstart = msymbol.value_address (); if (find_pc_section (fstart)) return fstart; @@ -254,10 +254,10 @@ find_pc_partial_function_sym (CORE_ADDR pc, f = find_pc_sect_function (mapped_pc, section); if (f != NULL && (msymbol.minsym == NULL - || (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (f)) - >= BMSYMBOL_VALUE_ADDRESS (msymbol)))) + || (BLOCK_ENTRY_PC (f->value_block ()) + >= msymbol.value_address ()))) { - const struct block *b = SYMBOL_BLOCK_VALUE (f); + const struct block *b = f->value_block (); cache_pc_function_sym = f; cache_pc_function_section = section; @@ -326,7 +326,7 @@ find_pc_partial_function_sym (CORE_ADDR pc, return false; } - cache_pc_function_low = BMSYMBOL_VALUE_ADDRESS (msymbol); + cache_pc_function_low = msymbol.value_address (); cache_pc_function_sym = msymbol.minsym; cache_pc_function_section = section; cache_pc_function_high = minimal_symbol_upper_bound (msymbol); @@ -425,7 +425,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) + if (sym != NULL && BLOCK_ENTRY_PC (sym->value_block ()) == pc) return sym->type (); return NULL; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b21d83d8019..af7eb6cc113 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3256,7 +3256,7 @@ create_overlay_event_breakpoint (void) bp_objfile_data->overlay_msym = m; } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->overlay_msym); + addr = bp_objfile_data->overlay_msym.value_address (); b = create_internal_breakpoint (objfile->arch (), addr, bp_overlay_event, &internal_breakpoint_ops); @@ -3366,7 +3366,7 @@ create_longjmp_master_breakpoint_names (objfile *objfile) bp_objfile_data->longjmp_msym[i] = m; } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]); + addr = bp_objfile_data->longjmp_msym[i].value_address (); b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master, &internal_breakpoint_ops); initialize_explicit_location (&explicit_loc); @@ -3449,7 +3449,7 @@ create_std_terminate_master_breakpoint (void) bp_objfile_data->terminate_msym = m; } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); + addr = bp_objfile_data->terminate_msym.value_address (); b = create_internal_breakpoint (objfile->arch (), addr, bp_std_terminate_master, &internal_breakpoint_ops); @@ -3547,7 +3547,7 @@ create_exception_master_breakpoint_hook (objfile *objfile) bp_objfile_data->exception_msym = debug_hook; } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->exception_msym); + addr = bp_objfile_data->exception_msym.value_address (); addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, current_inferior ()->top_target ()); b = create_internal_breakpoint (gdbarch, addr, bp_exception_master, @@ -4913,8 +4913,7 @@ watchpoint_check (bpstat *bs) function = get_frame_function (fr); if (function == NULL - || !contained_in (b->exp_valid_block, - SYMBOL_BLOCK_VALUE (function))) + || !contained_in (b->exp_valid_block, function->value_block ())) within_current_scope = 0; } diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index d0d9e89e93c..759b562cdd0 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -163,7 +163,7 @@ bsd_uthread_lookup_address (const char *name, struct objfile *objfile) sym = lookup_minimal_symbol (name, NULL, objfile); if (sym.minsym) - return BMSYMBOL_VALUE_ADDRESS (sym); + return sym.value_address (); return 0; } diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 9a9d3cf74d9..0df355151f4 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -251,7 +251,7 @@ buildsym_compunit::finish_block_internal { struct type *ftype = symbol->type (); struct mdict_iterator miter; - SYMBOL_BLOCK_VALUE (symbol) = block; + symbol->set_value_block (block); BLOCK_FUNCTION (block) = symbol; if (ftype->num_fields () <= 0) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 4ed661e587b..4fa3f8d2fc4 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1075,7 +1075,7 @@ exp : FALSEKEYWORD block : BLOCKNAME { if ($1.sym.symbol) - $$ = SYMBOL_BLOCK_VALUE ($1.sym.symbol); + $$ = $1.sym.symbol->value_block (); else error (_("No file or function \"%s\"."), copy_name ($1.stoken).c_str ()); @@ -1096,7 +1096,7 @@ block : block COLONCOLON name if (!tem || tem->aclass () != LOC_BLOCK) error (_("No function \"%s\" in specified context."), copy.c_str ()); - $$ = SYMBOL_BLOCK_VALUE (tem); } + $$ = tem->value_block (); } ; variable: name_not_typename ENTRY @@ -1239,7 +1239,7 @@ variable: name_not_typename if (alias_target != NULL) { block_symbol bsym { alias_target, - SYMBOL_BLOCK_VALUE (alias_target) }; + alias_target->value_block () }; pstate->push_new (bsym); } else diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 93e7cfd4254..bd445588ca0 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -182,7 +182,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype, /* If 'symbol_print' is set, we did the work above. */ if (!options->symbol_print && (msymbol.minsym != NULL) - && (vt_address == BMSYMBOL_VALUE_ADDRESS (msymbol))) + && (vt_address == msymbol.value_address ())) { if (want_space) gdb_puts (" ", stream); diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 16c1e044794..1f11606cdff 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -244,7 +244,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, " \"%s\" in dll \"%s\", pointing to \"%s\"\n"), sym_name, dll_name, forward_qualified_name); - vma = BMSYMBOL_VALUE_ADDRESS (msymbol); + vma = msymbol.value_address (); msymtype = MSYMBOL_TYPE (msymbol.minsym); section = msymbol.minsym->section_index (); diff --git a/gdb/coffread.c b/gdb/coffread.c index 253ba9c095f..24dd9b96011 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1026,7 +1026,7 @@ coff_symtab_read (minimal_symbol_reader &reader, sym = process_coff_symbol (cs, &main_aux, objfile); - SYMBOL_VALUE (sym) = tmpaddr + offset; + sym->set_value_longest (tmpaddr + offset); sym->set_section_index (sec); } } @@ -1506,29 +1506,21 @@ patch_opaque_types (struct symtab *s) && strcmp (name + 1, sym->linkage_name () + 1) == 0) { if (prev) - { - SYMBOL_VALUE_CHAIN (prev) = SYMBOL_VALUE_CHAIN (sym); - } + prev->set_value_chain (sym->value_chain ()); else - { - opaque_type_chain[hash] = SYMBOL_VALUE_CHAIN (sym); - } + opaque_type_chain[hash] = sym->value_chain (); patch_type (sym->type (), real_sym->type ()); if (prev) - { - sym = SYMBOL_VALUE_CHAIN (prev); - } + sym = prev->value_chain (); else - { - sym = opaque_type_chain[hash]; - } + sym = opaque_type_chain[hash]; } else { prev = sym; - sym = SYMBOL_VALUE_CHAIN (sym); + sym->set_value_chain (sym); } } } @@ -1538,7 +1530,7 @@ patch_opaque_types (struct symtab *s) static int coff_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) { - return gdbarch_sdb_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym)); + return gdbarch_sdb_reg_to_regnum (gdbarch, sym->value_longest ()); } static const struct symbol_register_ops coff_register_funcs = { @@ -1564,13 +1556,14 @@ process_coff_symbol (struct coff_symbol *cs, sym->compute_and_set_names (name, true, objfile->per_bfd); /* default assumptions */ - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); sym->set_domain (VAR_DOMAIN); sym->set_section_index (cs_to_section (cs, objfile)); if (ISFCN (cs->c_type)) { - SYMBOL_VALUE (sym) += objfile->text_section_offset (); + sym->set_value_longest + (sym->value_longest () + objfile->text_section_offset ()); sym->set_type (lookup_function_type (decode_function_type (cs, cs->c_type, aux, objfile))); @@ -1600,9 +1593,8 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBEXTFUNC: case C_EXT: sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, - (CORE_ADDR) cs->c_value - + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); + sym->set_value_address ((CORE_ADDR) cs->c_value + + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); add_symbol_to_list (sym, get_global_symbols ()); break; @@ -1610,9 +1602,8 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBSTATFUNC: case C_STAT: sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, - (CORE_ADDR) cs->c_value - + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); + sym->set_value_address ((CORE_ADDR) cs->c_value + + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); if (within_function) { /* Static symbol of local scope. */ @@ -1630,7 +1621,7 @@ process_coff_symbol (struct coff_symbol *cs, #endif case C_REG: sym->set_aclass_index (coff_register_index); - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1647,7 +1638,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_REGPARM: sym->set_aclass_index (coff_register_index); sym->set_is_argument (1); - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1698,7 +1689,7 @@ process_coff_symbol (struct coff_symbol *cs, { int i = hashname (sym->linkage_name ()); - SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i]; + sym->set_value_chain (opaque_type_chain[i]); opaque_type_chain[i] = sym; } add_symbol_to_list (sym, get_file_symbols ()); @@ -2100,7 +2091,7 @@ coff_read_enum_type (int index, int length, int lastsym, sym->set_linkage_name (name); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); - SYMBOL_VALUE (sym) = ms->c_value; + sym->set_value_longest (ms->c_value); add_symbol_to_list (sym, symlist); nsyms++; break; @@ -2145,8 +2136,8 @@ coff_read_enum_type (int index, int length, int lastsym, 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) + type->field (n).set_loc_enumval (xsym->value_longest ()); + if (xsym->value_longest () < 0) unsigned_enum = 0; TYPE_FIELD_BITSIZE (type, n) = 0; } diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index d422c466b5f..a50e84d117a 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -88,12 +88,12 @@ convert_one_symbol (compile_c_instance *context, case LOC_LABEL: kind = GCC_C_SYMBOL_LABEL; - addr = SYMBOL_VALUE_ADDRESS (sym.symbol); + addr = sym.symbol->value_address (); break; case LOC_BLOCK: kind = GCC_C_SYMBOL_FUNCTION; - addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol)); + addr = BLOCK_ENTRY_PC (sym.symbol->value_block ()); if (is_global && sym.symbol->type ()->is_gnu_ifunc ()) addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr); break; @@ -106,7 +106,7 @@ convert_one_symbol (compile_c_instance *context, } context->plugin ().build_constant (sym_type, sym.symbol->natural_name (), - SYMBOL_VALUE (sym.symbol), + sym.symbol->value_longest (), filename, line); return; @@ -179,7 +179,7 @@ convert_one_symbol (compile_c_instance *context, case LOC_STATIC: kind = GCC_C_SYMBOL_VARIABLE; - addr = SYMBOL_VALUE_ADDRESS (sym.symbol); + addr = sym.symbol->value_address (); break; case LOC_FINAL_VALUE: @@ -270,7 +270,7 @@ convert_symbol_bmsym (compile_c_instance *context, gcc_decl decl; CORE_ADDR addr; - addr = MSYMBOL_VALUE_ADDRESS (objfile, msym); + addr = msym->value_address (objfile); /* Conversion copied from write_exp_msymbol. */ switch (MSYMBOL_TYPE (msym)) @@ -404,7 +404,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context, gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": full symbol\n", identifier); - result = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + result = BLOCK_ENTRY_PC (sym->value_block ()); if (sym->type ()->is_gnu_ifunc ()) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; @@ -421,7 +421,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context, "gcc_symbol_address \"%s\": minimal " "symbol\n", identifier); - result = BMSYMBOL_VALUE_ADDRESS (msym); + result = msym.value_address (); if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 3657c8453e1..b68184c55f9 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -81,13 +81,13 @@ convert_one_symbol (compile_cplus_instance *instance, case LOC_LABEL: kind = GCC_CP_SYMBOL_LABEL; - addr = SYMBOL_VALUE_ADDRESS (sym.symbol); + addr = sym.symbol->value_address (); break; case LOC_BLOCK: { kind = GCC_CP_SYMBOL_FUNCTION; - addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol)); + addr = BLOCK_START (sym.symbol->value_block ()); if (is_global && sym.symbol->type ()->is_gnu_ifunc ()) addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr); } @@ -101,7 +101,7 @@ convert_one_symbol (compile_cplus_instance *instance, } instance->plugin ().build_constant (sym_type, sym.symbol->natural_name (), - SYMBOL_VALUE (sym.symbol), filename, line); + sym.symbol->value_longest (), filename, line); return; case LOC_CONST_BYTES: @@ -173,7 +173,7 @@ convert_one_symbol (compile_cplus_instance *instance, case LOC_STATIC: kind = GCC_CP_SYMBOL_VARIABLE; - addr = SYMBOL_VALUE_ADDRESS (sym.symbol); + addr = sym.symbol->value_address (); break; case LOC_FINAL_VALUE: @@ -281,7 +281,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance, gcc_type sym_type; CORE_ADDR addr; - addr = MSYMBOL_VALUE_ADDRESS (objfile, msym); + addr = msym->value_address (objfile); /* Conversion copied from write_exp_msymbol. */ switch (MSYMBOL_TYPE (msym)) @@ -441,7 +441,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context, gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": full symbol\n", identifier); - result = BLOCK_START (SYMBOL_BLOCK_VALUE (sym)); + result = BLOCK_START (sym->value_block ()); if (sym->type ()->is_gnu_ifunc ()) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; @@ -458,7 +458,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context, "gcc_symbol_address \"%s\": minimal " "symbol\n", identifier); - result = BMSYMBOL_VALUE_ADDRESS (msym); + result = msym.value_address (); if (MSYMBOL_TYPE (msym.minsym) == mst_text_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 616f2c23980..cea30304aa2 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -628,7 +628,7 @@ compile_cplus_convert_struct_or_union_members const char *filename = symbol_symtab (sym.symbol)->filename; unsigned int line = sym.symbol->line (); - physaddr = SYMBOL_VALUE_ADDRESS (sym.symbol); + physaddr = sym.symbol->value_address (); instance->plugin ().build_decl ("field physname", field_name, (GCC_CP_SYMBOL_VARIABLE| get_field_access_flag (type, i)), @@ -766,7 +766,7 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance, const char *filename = symbol_symtab (sym.symbol)->filename; unsigned int line = sym.symbol->line (); - CORE_ADDR address = BLOCK_START (SYMBOL_BLOCK_VALUE (sym.symbol)); + CORE_ADDR address = BLOCK_START (sym.symbol->value_block ()); const char *kind; if (TYPE_FN_FIELD_STATIC_P (methods, j)) diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 7364a4ae8b2..bfb40c9625c 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -771,7 +771,7 @@ compile_object_load (const compile_file_names &file_names, case mst_text: case mst_bss: case mst_data: - sym->value = BMSYMBOL_VALUE_ADDRESS (bmsym); + sym->value = bmsym.value_address (); if (compile_debug) gdb_printf (gdb_stdlog, "ELF mst_text symbol \"%s\" relocated to %s\n", @@ -780,7 +780,7 @@ compile_object_load (const compile_file_names &file_names, break; case mst_text_gnu_ifunc: sym->value = gnu_ifunc_resolve_addr (target_gdbarch (), - BMSYMBOL_VALUE_ADDRESS (bmsym)); + bmsym.value_address ()); if (compile_debug) gdb_printf (gdb_stdlog, "ELF mst_text_gnu_ifunc symbol \"%s\" " diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c index bce0f82a1ee..d5742a5880d 100644 --- a/gdb/compile/compile-object-run.c +++ b/gdb/compile/compile-object-run.c @@ -145,7 +145,7 @@ compile_object_run (compile_module_up &&module) gdb_assert (func_type->code () == TYPE_CODE_FUNC); func_val = value_from_pointer (lookup_pointer_type (func_type), - BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym))); + BLOCK_ENTRY_PC (func_sym->value_block ())); vargs = XALLOCAVEC (struct value *, func_type->num_fields ()); if (func_type->num_fields () >= 1) diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 3ac19fa001d..b0fa33705ee 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -281,7 +281,7 @@ cp_search_static_and_baseclasses (const char *name, if ((scope_type->code () == TYPE_CODE_FUNC || scope_type->code () == TYPE_CODE_METHOD) && domain == VAR_DOMAIN) - return lookup_symbol (nested, SYMBOL_BLOCK_VALUE (scope_sym.symbol), + return lookup_symbol (nested, scope_sym.symbol->value_block (), VAR_DOMAIN, NULL); /* Look for a symbol named NESTED in this class/namespace. diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 87147a16bdf..828f300d29d 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -329,7 +329,7 @@ set_symbol_address (struct objfile *of, struct symbol *sym, const char *name) msym = lookup_minimal_symbol (name, nullptr, of); if (msym.minsym != NULL) { - SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym)); + sym->set_value_address (msym.value_address ()); sym->set_aclass_index (LOC_STATIC); sym->set_section_index (msym.minsym->section_index ()); } diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 49bcebd2a81..a536a087c7f 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1655,7 +1655,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, pst ? pst->filename : NULL, objfile); if (minsym.minsym != NULL) - nlist.n_value = MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym); + nlist.n_value = minsym.minsym->value_raw_address (); } if (pst && textlow_not_set && gdbarch_sofun_address_maybe_missing (gdbarch)) @@ -1711,7 +1711,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, pst ? pst->filename : NULL, objfile); if (minsym.minsym != NULL) - nlist.n_value = MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym); + nlist.n_value = minsym.minsym->value_raw_address (); } if (pst && textlow_not_set && gdbarch_sofun_address_maybe_missing (gdbarch)) @@ -2024,7 +2024,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs, } if (minsym.minsym) - pst->set_text_high (MSYMBOL_VALUE_RAW_ADDRESS (minsym.minsym) + pst->set_text_high (minsym.minsym->value_raw_address () + MSYMBOL_SIZE (minsym.minsym)); last_function_name = NULL; @@ -2791,7 +2791,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, = find_stab_function (name, get_last_source_file (), objfile); if (minsym.minsym != NULL) - valu = BMSYMBOL_VALUE_ADDRESS (minsym); + valu = minsym.value_address (); } /* These addresses are absolute. */ diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index bb9778d9edd..ea45475810e 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -453,7 +453,7 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton, if (pc_block) pc_func = block_linkage_function (pc_block); - if (pc_func && pc == BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (pc_func))) + if (pc_func && pc == BLOCK_ENTRY_PC (pc_func->value_block ())) { *locexpr_length = length; return loc_ptr; @@ -711,7 +711,7 @@ call_site_target::iterate_over_addresses : msym.minsym->print_name ())); } - callback (BMSYMBOL_VALUE_ADDRESS (msym)); + callback (msym.value_address ()); } break; @@ -753,7 +753,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr) struct symbol *sym = find_pc_function (addr); struct type *type; - if (sym == NULL || BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) != addr) + if (sym == NULL || BLOCK_ENTRY_PC (sym->value_block ()) != addr) throw_error (NO_ENTRY_VALUE_ERROR, _("DW_TAG_call_site resolving failed to find function " "name for address %s"), diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d8268de8031..ac5408f2573 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7951,7 +7951,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) psymbol.domain = VAR_DOMAIN; psymbol.aclass = LOC_BLOCK; psymbol.ginfo.set_section_index (SECT_OFF_TEXT (objfile)); - psymbol.ginfo.value.address = addr; + psymbol.ginfo.set_value_address (addr); if (pdi->main_subprogram && actual_name != NULL) set_objfile_main_name (objfile, actual_name, cu->per_cu->lang); @@ -7996,7 +7996,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) psymbol.domain = VAR_DOMAIN; psymbol.aclass = LOC_STATIC; psymbol.ginfo.set_section_index (SECT_OFF_TEXT (objfile)); - psymbol.ginfo.value.address = addr; + psymbol.ginfo.set_value_address (addr); where = psymbol_placement::GLOBAL; } } @@ -8013,7 +8013,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) psymbol.aclass = LOC_STATIC; psymbol.ginfo.set_section_index (SECT_OFF_TEXT (objfile)); if (has_loc) - psymbol.ginfo.value.address = addr; + psymbol.ginfo.set_value_address (addr); where = psymbol_placement::STATIC; } break; @@ -17025,7 +17025,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) } sym = new_symbol (die, objfile_type (objfile)->builtin_void, cu); - SYMBOL_VALUE_COMMON_BLOCK (sym) = common_block; + sym->set_value_common_block (common_block); } } @@ -21706,19 +21706,16 @@ var_decode_location (struct attribute *attr, struct symbol *sym, unsigned int dummy; if (block->data[0] == DW_OP_addr) - SET_SYMBOL_VALUE_ADDRESS - (sym, cu->header.read_address (objfile->obfd, - block->data + 1, - &dummy)); + sym->set_value_address + (cu->header.read_address (objfile->obfd, block->data + 1, + &dummy)); else - SET_SYMBOL_VALUE_ADDRESS - (sym, read_addr_index_from_leb128 (cu, block->data + 1, - &dummy)); + sym->set_value_address + (read_addr_index_from_leb128 (cu, block->data + 1, &dummy)); sym->set_aclass_index (LOC_STATIC); fixup_symbol_section (sym, objfile); - SET_SYMBOL_VALUE_ADDRESS - (sym, - SYMBOL_VALUE_ADDRESS (sym) + sym->set_value_address + (sym->value_address () + objfile->section_offsets[sym->section_index ()]); return; } @@ -21841,7 +21838,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, addr = attr->as_address (); addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr + baseaddr); - SET_SYMBOL_VALUE_ADDRESS (sym, addr); + sym->set_value_address (addr); sym->set_aclass_index (LOC_LABEL); } else @@ -21927,7 +21924,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, attr2 = NULL; if (sym->aclass () == LOC_STATIC - && SYMBOL_VALUE_ADDRESS (sym) == 0 + && sym->value_address () == 0 && !per_objfile->per_bfd->has_section_at_zero) { /* When a static variable is eliminated by the linker, @@ -22332,13 +22329,13 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym, sym->set_aclass_index (dwarf2_locexpr_index); } else if (bytes != NULL) - { - SYMBOL_VALUE_BYTES (sym) = bytes; + { + sym->set_value_bytes (bytes); sym->set_aclass_index (LOC_CONST_BYTES); } else { - SYMBOL_VALUE (sym) = value; + sym->set_value_longest (value); sym->set_aclass_index (LOC_CONST); } } diff --git a/gdb/elfread.c b/gdb/elfread.c index fb40032c505..3f1f87650f2 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -703,7 +703,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr) msym = lookup_minimal_symbol_by_pc (addr); if (msym.minsym == NULL) return 0; - if (BMSYMBOL_VALUE_ADDRESS (msym) != addr) + if (msym.value_address () != addr) return 0; objfile = msym.objfile; @@ -830,7 +830,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p) continue; if (MSYMBOL_TYPE (msym.minsym) != mst_slot_got_plt) continue; - pointer_address = BMSYMBOL_VALUE_ADDRESS (msym); + pointer_address = msym.value_address (); plt = bfd_get_section_by_name (obfd, ".plt"); if (plt == NULL) diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index aea01bb7dbc..4f95b224d73 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -611,7 +611,7 @@ info_common_command_for_block (const struct block *block, const char *comname, ALL_BLOCK_SYMBOLS (block, iter, sym) if (sym->domain () == COMMON_BLOCK_DOMAIN) { - const struct common_block *common = SYMBOL_VALUE_COMMON_BLOCK (sym); + const struct common_block *common = sym->value_common_block (); size_t index; gdb_assert (sym->aclass () == LOC_COMMON_BLOCK); diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 1b7e36ef8cc..b241e855bd6 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1939,7 +1939,7 @@ fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name) error (_("Unable to resolve symbol '%s'"), name); gdb_byte buf[4]; - if (target_read_memory (BMSYMBOL_VALUE_ADDRESS (ms), buf, sizeof buf) != 0) + if (target_read_memory (ms.value_address (), buf, sizeof buf) != 0) error (_("Unable to read value of '%s'"), name); return extract_signed_integer (buf, gdbarch_byte_order (gdbarch)); @@ -2048,7 +2048,7 @@ CORE_ADDR fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { struct bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_rtld_bind"); - if (msym.minsym != nullptr && BMSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym != nullptr && msym.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); return 0; diff --git a/gdb/findvar.c b/gdb/findvar.c index 6660b006795..ec21c82532b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -627,8 +627,7 @@ language_defn::read_var_value (struct symbol *var, /* Put the constant back in target format. */ v = allocate_value (type); store_signed_integer (value_contents_raw (v).data (), TYPE_LENGTH (type), - type_byte_order (type), - (LONGEST) SYMBOL_VALUE (var)); + type_byte_order (type), var->value_longest ()); VALUE_LVAL (v) = not_lval; return v; @@ -638,13 +637,13 @@ language_defn::read_var_value (struct symbol *var, if (overlay_debugging) { struct objfile *var_objfile = symbol_objfile (var); - addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), + addr = symbol_overlayed_address (var->value_address (), var->obj_section (var_objfile)); store_typed_address (value_contents_raw (v).data (), type, addr); } else store_typed_address (value_contents_raw (v).data (), type, - SYMBOL_VALUE_ADDRESS (var)); + var->value_address ()); VALUE_LVAL (v) = not_lval; return v; @@ -655,7 +654,7 @@ language_defn::read_var_value (struct symbol *var, type = resolve_dynamic_type (type, {}, /* Unused address. */ 0); } v = allocate_value (type); - memcpy (value_contents_raw (v).data (), SYMBOL_VALUE_BYTES (var), + memcpy (value_contents_raw (v).data (), var->value_bytes (), TYPE_LENGTH (type)); VALUE_LVAL (v) = not_lval; return v; @@ -663,10 +662,10 @@ language_defn::read_var_value (struct symbol *var, case LOC_STATIC: if (overlay_debugging) addr - = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), + = symbol_overlayed_address (var->value_address (), var->obj_section (symbol_objfile (var))); else - addr = SYMBOL_VALUE_ADDRESS (var); + addr = var->value_address (); break; case LOC_ARG: @@ -674,7 +673,7 @@ language_defn::read_var_value (struct symbol *var, if (!addr) error (_("Unknown argument list address for `%s'."), var->print_name ()); - addr += SYMBOL_VALUE (var); + addr += var->value_longest (); break; case LOC_REF_ARG: @@ -686,7 +685,7 @@ language_defn::read_var_value (struct symbol *var, if (!argref) error (_("Unknown argument list address for `%s'."), var->print_name ()); - argref += SYMBOL_VALUE (var); + argref += var->value_longest (); ref = value_at (lookup_pointer_type (type), argref); addr = value_as_address (ref); break; @@ -694,7 +693,7 @@ language_defn::read_var_value (struct symbol *var, case LOC_LOCAL: addr = get_frame_locals_address (frame); - addr += SYMBOL_VALUE (var); + addr += var->value_longest (); break; case LOC_TYPEDEF: @@ -705,10 +704,10 @@ language_defn::read_var_value (struct symbol *var, case LOC_BLOCK: if (overlay_debugging) addr = symbol_overlayed_address - (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)), + (BLOCK_ENTRY_PC (var->value_block ()), var->obj_section (symbol_objfile (var))); else - addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)); + addr = BLOCK_ENTRY_PC (var->value_block ()); break; case LOC_REGISTER: @@ -778,9 +777,9 @@ language_defn::read_var_value (struct symbol *var, a TLS variable. */ if (obj_section == NULL || (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) - addr = MSYMBOL_VALUE_RAW_ADDRESS (msym); + addr = msym->value_raw_address (); else - addr = BMSYMBOL_VALUE_ADDRESS (lookup_data.result); + addr = lookup_data.result.value_address (); if (overlay_debugging) addr = symbol_overlayed_address (addr, obj_section); /* Determine address of TLS variable. */ diff --git a/gdb/frame.c b/gdb/frame.c index 2b296ed6b96..2e574a2f009 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2430,12 +2430,12 @@ inside_main_func (frame_info *this_frame) if (bs.symbol == nullptr) return false; - const struct block *block = SYMBOL_BLOCK_VALUE (bs.symbol); + const struct block *block = bs.symbol->value_block (); gdb_assert (block != nullptr); sym_addr = BLOCK_START (block); } else - sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); + sym_addr = msymbol.value_address (); /* Convert any function descriptor addresses into the actual function code address. */ diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 1f291d9117d..2328791a540 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1384,7 +1384,7 @@ frv_frame_this_id (struct frame_info *this_frame, /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); - if (msym_stack.minsym && info->base == BMSYMBOL_VALUE_ADDRESS (msym_stack)) + if (msym_stack.minsym && info->base == msym_stack.value_address ()) return; /* Hopefully the prologue analysis either correctly determined the diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index 34703cc3e12..f77e313e0dd 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -200,7 +200,7 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr, regnum); msymbol = lookup_minimal_symbol (prolog_symbol, NULL, NULL); if (msymbol.minsym) - prologs[regnum] = BMSYMBOL_VALUE_ADDRESS (msymbol); + prologs[regnum] = msymbol.value_address (); else prologs[regnum] = 0; } diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c index 19b69fb94dc..7f6c12bc402 100644 --- a/gdb/glibc-tdep.c +++ b/gdb/glibc-tdep.c @@ -66,7 +66,7 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) if (! fixup.minsym) fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile); - if (fixup.minsym && BMSYMBOL_VALUE_ADDRESS (fixup) == pc) + if (fixup.minsym && fixup.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index baf015b9813..7aac0ca4f9c 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1146,7 +1146,7 @@ gnuv3_get_typeid (struct value *value) if (minsym.minsym == NULL) error (_("could not find typeinfo symbol for '%s'"), name); - result = value_at_lazy (typeinfo_type, BMSYMBOL_VALUE_ADDRESS (minsym)); + result = value_at_lazy (typeinfo_type, minsym.value_address ()); } return result; @@ -1235,7 +1235,7 @@ gnuv3_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) if (fn_sym.minsym == NULL) return 0; - method_stop_pc = BMSYMBOL_VALUE_ADDRESS (fn_sym); + method_stop_pc = fn_sym.value_address (); /* Some targets have minimal symbols pointing to function descriptors (powerpc 64 for example). Make sure to retrieve the address diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 576678ae9b2..f9ececbb04f 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -197,7 +197,7 @@ hppa_symbol_address(const char *sym) minsym = lookup_minimal_symbol (sym, NULL, NULL); if (minsym.minsym) - return BMSYMBOL_VALUE_ADDRESS (minsym); + return minsym.value_address (); else return (CORE_ADDR)-1; } @@ -2528,7 +2528,7 @@ hppa_lookup_stub_minimal_symbol (const char *name, { struct unwind_table_entry *u; - u = find_unwind_entry (MSYMBOL_VALUE (msym)); + u = find_unwind_entry (msym->value_longest ()); if (u != NULL && u->stub_unwind.stub_type == stub_type) { result.objfile = objfile; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 719bd6888a8..84eb6e5d79b 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -979,7 +979,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) symbol *sym = inline_skipped_symbol (tp); if (sym->aclass () == LOC_BLOCK) { - const block *block = SYMBOL_BLOCK_VALUE (sym); + const block *block = sym->value_block (); if (BLOCK_END (block) < tp->control.step_range_end) tp->control.step_range_end = BLOCK_END (block); } @@ -1336,7 +1336,7 @@ until_next_command (int from_tty) if (msymbol.minsym == NULL) error (_("Execution is not within a known function.")); - tp->control.step_range_start = BMSYMBOL_VALUE_ADDRESS (msymbol); + tp->control.step_range_start = msymbol.value_address (); /* The upper-bound of step_range is exclusive. In order to make PC within the range, set the step_range_end with PC + 1. */ tp->control.step_range_end = pc + 1; @@ -1345,7 +1345,7 @@ until_next_command (int from_tty) { sal = find_pc_line (pc, 0); - tp->control.step_range_start = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func)); + tp->control.step_range_start = BLOCK_ENTRY_PC (func->value_block ()); tp->control.step_range_end = sal.end; /* By setting the step_range_end based on the current pc, we are diff --git a/gdb/infrun.c b/gdb/infrun.c index 0b88eb8cfdf..c311240b78c 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8090,7 +8090,7 @@ check_exception_resume (struct execution_control_state *ecs, cases such as throwing an exception from inside a signal handler. */ - b = SYMBOL_BLOCK_VALUE (func); + b = func->value_block (); ALL_BLOCK_SYMBOLS (b, iter, sym) { if (!sym->is_argument ()) diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index a9006a6c8a3..bcdf36cd067 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -181,7 +181,7 @@ inline_frame_this_id (struct frame_info *this_frame, in the frame ID (and eventually, to set breakpoints). */ func = get_frame_function (this_frame); gdb_assert (func != NULL); - (*this_id).code_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func)); + (*this_id).code_addr = BLOCK_ENTRY_PC (func->value_block ()); (*this_id).artificial_depth++; } @@ -329,7 +329,7 @@ stopped_by_user_bp_inline_frame (const block *frame_block, bpstat *stop_chain) to presenting the stop at the innermost inline function. */ if (loc->symbol == nullptr - || frame_block == SYMBOL_BLOCK_VALUE (loc->symbol)) + || frame_block == loc->symbol->value_block ()) return true; } } diff --git a/gdb/jit.c b/gdb/jit.c index 342b0d07114..ae679a1f043 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -265,7 +265,7 @@ jit_read_descriptor (gdbarch *gdbarch, jiter_objfile_data *objf_data = jiter->jiter_data.get (); gdb_assert (objf_data != nullptr); - CORE_ADDR addr = MSYMBOL_VALUE_ADDRESS (jiter, objf_data->descriptor); + CORE_ADDR addr = objf_data->descriptor->value_address (jiter); jit_debug_printf ("descriptor_addr = %s", paddress (gdbarch, addr)); @@ -591,7 +591,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) block_name->set_aclass_index (LOC_BLOCK); symbol_set_symtab (block_name, filetab); block_name->set_type (lookup_function_type (block_type)); - SYMBOL_BLOCK_VALUE (block_name) = new_block; + block_name->set_value_block (new_block); block_name->m_name = obstack_strdup (&objfile->objfile_obstack, gdb_block_iter.name.get ()); @@ -887,7 +887,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) bound_minimal_symbol reg_symbol = lookup_minimal_symbol (jit_break_name, nullptr, the_objfile); if (reg_symbol.minsym == NULL - || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0) + || reg_symbol.value_address () == 0) { /* No need to repeat the lookup the next time. */ the_objfile->skip_jit_symbol_lookup = true; @@ -897,7 +897,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) bound_minimal_symbol desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL, the_objfile); if (desc_symbol.minsym == NULL - || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0) + || desc_symbol.value_address () == 0) { /* No need to repeat the lookup the next time. */ the_objfile->skip_jit_symbol_lookup = true; @@ -909,9 +909,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace) objf_data->register_code = reg_symbol.minsym; objf_data->descriptor = desc_symbol.minsym; - CORE_ADDR addr = MSYMBOL_VALUE_ADDRESS (the_objfile, - objf_data->register_code); - + CORE_ADDR addr = objf_data->register_code->value_address (the_objfile); jit_debug_printf ("breakpoint_addr = %s", paddress (gdbarch, addr)); /* Check if we need to re-create the breakpoint. */ diff --git a/gdb/linespec.c b/gdb/linespec.c index 9d4707cbb4e..3c176bea94e 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2224,14 +2224,14 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) && sym.symbol->aclass () == LOC_BLOCK) { const CORE_ADDR addr - = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym.symbol)); + = BLOCK_ENTRY_PC (sym.symbol->value_block ()); for (const auto &elem : ls->minimal_symbols) { if (MSYMBOL_TYPE (elem.minsym) == mst_text_gnu_ifunc || MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc) { - CORE_ADDR msym_addr = BMSYMBOL_VALUE_ADDRESS (elem); + CORE_ADDR msym_addr = elem.value_address (); if (MSYMBOL_TYPE (elem.minsym) == mst_data_gnu_ifunc) { struct gdbarch *gdbarch @@ -3986,7 +3986,7 @@ find_label_symbols (struct linespec_state *self, fn_sym = elt.symbol; set_current_program_space (symbol_symtab (fn_sym)->compunit ()->objfile ()->pspace); - block = SYMBOL_BLOCK_VALUE (fn_sym); + block = fn_sym->value_block (); find_label_symbols_in_block (block, name, fn_sym, completion_mode, &result, label_funcs_ret); @@ -4166,7 +4166,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile, if (is_function) sal.pc = func_addr; else - sal.pc = MSYMBOL_VALUE_ADDRESS (objfile, msymbol); + sal.pc = msymbol->value_address (objfile); sal.pspace = current_program_space; } @@ -4377,13 +4377,13 @@ symbol_to_sal (struct symtab_and_line *result, } else { - if (sym->aclass () == LOC_LABEL && SYMBOL_VALUE_ADDRESS (sym) != 0) + if (sym->aclass () == LOC_LABEL && sym->value_address () != 0) { *result = {}; result->symtab = symbol_symtab (sym); result->symbol = sym; result->line = sym->line (); - result->pc = SYMBOL_VALUE_ADDRESS (sym); + result->pc = sym->value_address (); result->pspace = result->symtab->compunit ()->objfile ()->pspace; result->explicit_pc = 1; return 1; @@ -4399,7 +4399,7 @@ symbol_to_sal (struct symtab_and_line *result, result->symtab = symbol_symtab (sym); result->symbol = sym; result->line = sym->line (); - result->pc = SYMBOL_VALUE_ADDRESS (sym); + result->pc = sym->value_address (); result->pspace = result->symtab->compunit ()->objfile ()->pspace; return 1; } diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 2837233ac6a..11da82a1abc 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -474,7 +474,7 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min) if (version_msym.minsym == NULL) return 0; - version_addr = BMSYMBOL_VALUE_ADDRESS (version_msym); + version_addr = version_msym.value_address (); gdb::unique_xmalloc_ptr version = target_read_string (version_addr, 32, &got); if (version != nullptr diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 02e3cf1b4e7..85bac11b8fb 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -490,7 +490,7 @@ exp : STRING /* This will be used for extensions later. Like adding modules. */ block : fblock - { $$ = SYMBOL_BLOCK_VALUE($1); } + { $$ = $1->value_block (); } ; fblock : BLOCKNAME diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 55ef5a551f8..4971be796cd 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -2216,7 +2216,7 @@ m32c_return_value (struct gdbarch *gdbarch, error (_("The return value is stored in memory at 'mem0', " "but GDB cannot find\n" "its address.")); - read_memory (BMSYMBOL_VALUE_ADDRESS (mem0), readbuf, valtype_len); + read_memory (mem0.value_address (), readbuf, valtype_len); } } @@ -2248,7 +2248,7 @@ m32c_return_value (struct gdbarch *gdbarch, error (_("The return value is stored in memory at 'mem0', " "but GDB cannot find\n" " its address.")); - write_memory (BMSYMBOL_VALUE_ADDRESS (mem0), writebuf, valtype_len); + write_memory (mem0.value_address (), writebuf, valtype_len); } } @@ -2473,7 +2473,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, else { /* The trampoline's address is our pointer. */ - addr = BMSYMBOL_VALUE_ADDRESS (tramp_msym); + addr = tramp_msym.value_address (); } } @@ -2525,7 +2525,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, /* If we do have such a symbol, return its value as the function's true address. */ if (func_msym.minsym) - ptr = BMSYMBOL_VALUE_ADDRESS (func_msym); + ptr = func_msym.value_address (); } } else diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 9c276fb7593..3ad4c8de6bf 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -811,7 +811,7 @@ m32r_frame_this_id (struct frame_info *this_frame, /* Check if the stack is empty. */ msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL); - if (msym_stack.minsym && info->base == BMSYMBOL_VALUE_ADDRESS (msym_stack)) + if (msym_stack.minsym && info->base == msym_stack.value_address ()) return; /* Hopefully the prologue analysis either correctly determined the diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 5c1f20415c8..e82b18a848f 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -215,7 +215,7 @@ m68hc11_get_register_info (struct m68hc11_soft_reg *reg, const char *name) msymbol = lookup_minimal_symbol (name, NULL, NULL); if (msymbol.minsym) { - reg->addr = BMSYMBOL_VALUE_ADDRESS (msymbol); + reg->addr = msymbol.value_address (); reg->name = xstrdup (name); /* Keep track of the address range for soft registers. */ diff --git a/gdb/machoread.c b/gdb/machoread.c index 14a7428a979..90f25b3c191 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -404,7 +404,7 @@ macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym) return 0; } else - return BMSYMBOL_VALUE_ADDRESS (msym); + return msym.value_address (); } /* Add oso file OSO/ABFD as a symbol file. */ diff --git a/gdb/maint.c b/gdb/maint.c index 8cebd6ab5af..3f3dad5bd79 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -588,7 +588,7 @@ maintenance_translate_address (const char *arg, int from_tty) { const char *symbol_name = sym.minsym->print_name (); const char *symbol_offset - = pulongest (address - BMSYMBOL_VALUE_ADDRESS (sym)); + = pulongest (address - sym.value_address ()); sect = sym.obj_section (); if (sect != NULL) diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 67630b79332..6dcac13d2c5 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -533,7 +533,7 @@ reg_value_complaint (int regnum, int num_regs, const char *sym) static int mdebug_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) { - int regno = gdbarch_ecoff_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym)); + int regno = gdbarch_ecoff_reg_to_regnum (gdbarch, sym->value_longest ()); if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch)) { @@ -631,7 +631,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, b = BLOCKVECTOR_BLOCK (top_stack->cur_st->compunit ()->blockvector (), GLOBAL_BLOCK); s = new_symbol (name); - SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); + s->set_value_address (sh->value); add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name); break; @@ -644,18 +644,18 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, address is not in the symbol; we need to fix it later in scan_file_globals. */ int bucket = hashname (s->linkage_name ()); - SYMBOL_VALUE_CHAIN (s) = global_sym_chain[bucket]; + s->set_value_chain (global_sym_chain[bucket]); global_sym_chain[bucket] = s; } else - SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); + s->set_value_address (sh->value); add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name); break; case stLocal: /* Local variable, goes into current block. */ b = top_stack->cur_block; s = new_symbol (name); - SYMBOL_VALUE (s) = svalue; + s->set_value_longest (svalue); if (sh->sc == scRegister) add_data_symbol (sh, ax, bigend, s, mdebug_register_index, b, objfile, name); @@ -696,7 +696,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s->set_aclass_index (LOC_ARG); break; } - SYMBOL_VALUE (s) = svalue; + s->set_value_longest (svalue); 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; @@ -705,7 +705,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); 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); + s->set_value_address (sh->value); s->set_type (objfile_type (objfile)->builtin_int); add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; @@ -796,7 +796,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* Create and enter a new lexical context. */ b = new_block (FUNCTION_BLOCK, s->language ()); - SYMBOL_BLOCK_VALUE (s) = b; + s->set_value_block (b); BLOCK_FUNCTION (b) = s; BLOCK_START (b) = BLOCK_END (b) = sh->value; BLOCK_SUPERBLOCK (b) = top_stack->cur_block; @@ -1068,8 +1068,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, enum_sym->set_aclass_index (LOC_CONST); enum_sym->set_type (t); enum_sym->set_domain (VAR_DOMAIN); - SYMBOL_VALUE (enum_sym) = tsym.value; - if (SYMBOL_VALUE (enum_sym) < 0) + enum_sym->set_value_longest (tsym.value); + if (enum_sym->value_longest () < 0) unsigned_enum = 0; add_symbol (enum_sym, top_stack->cur_st, top_stack->cur_block); @@ -1099,7 +1099,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); s->set_domain (STRUCT_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); - SYMBOL_VALUE (s) = 0; + s->set_value_longest (0); s->set_type (t); add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; @@ -1159,7 +1159,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, 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; + s->set_value_bytes ((gdb_byte *) e); e->numargs = top_stack->numargs; e->pdr.framereg = -1; add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -1297,7 +1297,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); s->set_domain (VAR_DOMAIN); s->set_aclass_index (LOC_TYPEDEF); - SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block; + s->set_value_block (top_stack->cur_block); s->set_type (t); add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -1977,7 +1977,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, if (s != 0) { - b = SYMBOL_BLOCK_VALUE (s); + b = s->value_block (); } else { @@ -2012,7 +2012,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, { struct mdebug_extra_func_info *e; - e = (struct mdebug_extra_func_info *) SYMBOL_VALUE_BYTES (i); + e = (struct mdebug_extra_func_info *) i->value_bytes (); e->pdr = *pr; /* GDB expects the absolute function start address for the @@ -3990,7 +3990,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) s->set_domain (LABEL_DOMAIN); s->set_aclass_index (LOC_CONST); s->set_type (objfile_type (objfile)->builtin_void); - SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; + s->set_value_bytes ((gdb_byte *) e); e->pdr.framereg = -1; add_symbol_to_list (s, get_local_symbols ()); } diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c index 5d6d3412929..60321f76796 100644 --- a/gdb/mi/mi-symbol-cmds.c +++ b/gdb/mi/mi-symbol-cmds.c @@ -100,7 +100,7 @@ output_nondebug_symbol (ui_out *uiout, ui_out_emit_tuple tuple_emitter (uiout, NULL); uiout->field_core_addr ("address", gdbarch, - BMSYMBOL_VALUE_ADDRESS (msymbol)); + msymbol.value_address ()); uiout->field_string ("name", msymbol.minsym->print_name ()); } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index a24930ba942..e93cbed8621 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -113,7 +113,7 @@ bool msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym, CORE_ADDR *func_address_p) { - CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym); + CORE_ADDR msym_addr = minsym->value_address (objfile); switch (minsym->type) { @@ -498,7 +498,7 @@ find_minimal_symbol_address (const char *name, CORE_ADDR *addr, = lookup_minimal_symbol (name, NULL, objfile); if (sym.minsym != NULL) - *addr = BMSYMBOL_VALUE_ADDRESS (sym); + *addr = sym.value_address (); return sym.minsym == NULL; } @@ -665,7 +665,7 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name, msymbol != NULL; msymbol = msymbol->hash_next) { - if (MSYMBOL_VALUE_ADDRESS (objfile, msymbol) == pc + if (msymbol->value_address (objfile) == pc && strcmp (msymbol->linkage_name (), name) == 0) return msymbol; } @@ -799,14 +799,14 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio Warning: this code is trickier than it would appear at first. */ if (frob_address (objfile, &pc) - && pc >= MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[lo])) + && pc >= msymbol[lo].value_raw_address ()) { - while (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) > pc) + while (msymbol[hi].value_raw_address () > pc) { /* pc is still strictly less than highest address. */ /* Note "new" will always be >= lo. */ newobj = (lo + hi) / 2; - if ((MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[newobj]) >= pc) + if ((msymbol[newobj].value_raw_address () >= pc) || (lo == newobj)) { hi = newobj; @@ -821,8 +821,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio hi to point to the last one. That way we can find the right symbol if it has an index greater than hi. */ while (hi < objfile->per_bfd->minimal_symbol_count - 1 - && (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) - == MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi + 1]))) + && (msymbol[hi].value_raw_address () + == msymbol[hi + 1].value_raw_address ())) hi++; /* Skip various undesirable symbols. */ @@ -870,8 +870,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio && MSYMBOL_TYPE (&msymbol[hi - 1]) == want_type && (MSYMBOL_SIZE (&msymbol[hi]) == MSYMBOL_SIZE (&msymbol[hi - 1])) - && (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) - == MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi - 1])) + && (msymbol[hi].value_raw_address () + == msymbol[hi - 1].value_raw_address ()) && (msymbol[hi].obj_section (objfile) == msymbol[hi - 1].obj_section (objfile))) { @@ -900,9 +900,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio the cancellable variants, but both have sizes. */ if (hi > 0 && MSYMBOL_SIZE (&msymbol[hi]) != 0 - && pc >= (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) + && pc >= (msymbol[hi].value_raw_address () + MSYMBOL_SIZE (&msymbol[hi])) - && pc < (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi - 1]) + && pc < (msymbol[hi - 1].value_raw_address () + MSYMBOL_SIZE (&msymbol[hi - 1]))) { hi--; @@ -932,7 +932,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio if (hi >= 0 && MSYMBOL_SIZE (&msymbol[hi]) != 0 - && pc >= (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) + && pc >= (msymbol[hi].value_raw_address () + MSYMBOL_SIZE (&msymbol[hi]))) { if (best_zero_sized != -1) @@ -944,9 +944,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio if (previous != nullptr) { if (previous->minsym == nullptr - || (MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi]) - > MSYMBOL_VALUE_RAW_ADDRESS - (previous->minsym))) + || (msymbol[hi].value_raw_address () + > previous->minsym->value_raw_address ())) { previous->minsym = &msymbol[hi]; previous->objfile = objfile; @@ -963,8 +962,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio if (hi >= 0 && ((best_symbol == NULL) || - (MSYMBOL_VALUE_RAW_ADDRESS (best_symbol) < - MSYMBOL_VALUE_RAW_ADDRESS (&msymbol[hi])))) + (best_symbol->value_raw_address () < + msymbol[hi].value_raw_address ()))) { best_symbol = &msymbol[hi]; best_objfile = objfile; @@ -1209,7 +1208,7 @@ minimal_symbol_reader::record_full (gdb::string_view name, else msymbol->m_name = name.data (); - SET_MSYMBOL_VALUE_ADDRESS (msymbol, address); + msymbol->set_value_address (address); msymbol->set_section_index (section); MSYMBOL_TYPE (msymbol) = ms_type; @@ -1233,11 +1232,11 @@ static inline bool minimal_symbol_is_less_than (const minimal_symbol &fn1, const minimal_symbol &fn2) { - if (MSYMBOL_VALUE_RAW_ADDRESS (&fn1) < MSYMBOL_VALUE_RAW_ADDRESS (&fn2)) + if ((&fn1)->value_raw_address () < (&fn2)->value_raw_address ()) { return true; /* addr 1 is less than addr 2. */ } - else if (MSYMBOL_VALUE_RAW_ADDRESS (&fn1) > MSYMBOL_VALUE_RAW_ADDRESS (&fn2)) + else if ((&fn1)->value_raw_address () > (&fn2)->value_raw_address ()) { return false; /* addr 1 is greater than addr 2. */ } @@ -1297,8 +1296,8 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount, copyfrom = copyto = msymbol; while (copyfrom < msymbol + mcount - 1) { - if (MSYMBOL_VALUE_RAW_ADDRESS (copyfrom) - == MSYMBOL_VALUE_RAW_ADDRESS ((copyfrom + 1)) + if (copyfrom->value_raw_address () + == (copyfrom + 1)->value_raw_address () && (copyfrom->section_index () == (copyfrom + 1)->section_index ()) && strcmp (copyfrom->linkage_name (), @@ -1596,7 +1595,7 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym) of the section, as the end of the function. */ if (MSYMBOL_SIZE (minsym.minsym) != 0) - return BMSYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym.minsym); + return minsym.value_address () + MSYMBOL_SIZE (minsym.minsym); /* Step over other symbols at this same address, and symbols in other sections, to find the next symbol in this section with a @@ -1609,17 +1608,17 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym) section = msymbol->section_index (); for (iter = msymbol + 1; iter != past_the_end; ++iter) { - if ((MSYMBOL_VALUE_RAW_ADDRESS (iter) - != MSYMBOL_VALUE_RAW_ADDRESS (msymbol)) + if ((iter->value_raw_address () + != msymbol->value_raw_address ()) && iter->section_index () == section) break; } obj_section = minsym.obj_section (); if (iter != past_the_end - && (MSYMBOL_VALUE_ADDRESS (minsym.objfile, iter) + && (iter->value_address (minsym.objfile) < obj_section->endaddr ())) - result = MSYMBOL_VALUE_ADDRESS (minsym.objfile, iter); + result = iter->value_address (minsym.objfile); else /* We got the start address from the last msymbol in the objfile. So the end address is the end of the section. */ diff --git a/gdb/minsyms.h b/gdb/minsyms.h index 519702494ed..296b8cde1ba 100644 --- a/gdb/minsyms.h +++ b/gdb/minsyms.h @@ -36,6 +36,13 @@ struct bound_minimal_symbol bound_minimal_symbol () = default; + /* Return the address of the minimal symbol in the context of the objfile. */ + + CORE_ADDR value_address () const + { + return this->minsym->value_address (this->objfile); + } + /* The minimal symbol that was found, or NULL if no minimal symbol was found. */ diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c index e7eeecb2174..05043d93e74 100644 --- a/gdb/mips-fbsd-tdep.c +++ b/gdb/mips-fbsd-tdep.c @@ -470,7 +470,7 @@ mips_fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) { struct bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_mips_rtld_bind"); - if (msym.minsym != nullptr && BMSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym != nullptr && msym.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); return fbsd_skip_solib_resolver (gdbarch, pc); diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 3f4c1b321b3..d8f90ccf881 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -701,7 +701,7 @@ mips_linux_skip_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) resolver = lookup_minimal_symbol ("__dl_runtime_resolve", NULL, NULL); - if (resolver.minsym && BMSYMBOL_VALUE_ADDRESS (resolver) == pc) + if (resolver.minsym && resolver.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); return glibc_skip_solib_resolver (gdbarch, pc); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 9157e9fa143..78e7f5ccf87 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -436,12 +436,12 @@ mips_elf_make_msymbol_special (asymbol * sym, struct minimal_symbol *msym) if (ELF_ST_IS_MICROMIPS (st_other)) { MSYMBOL_TARGET_FLAG_MICROMIPS (msym) = 1; - SET_MSYMBOL_VALUE_ADDRESS (msym, MSYMBOL_VALUE_RAW_ADDRESS (msym) | 1); + msym->set_value_address (msym->value_raw_address () | 1); } else if (ELF_ST_IS_MIPS16 (st_other)) { MSYMBOL_TARGET_FLAG_MIPS16 (msym) = 1; - SET_MSYMBOL_VALUE_ADDRESS (msym, MSYMBOL_VALUE_RAW_ADDRESS (msym) | 1); + msym->set_value_address (msym->value_raw_address () | 1); } } @@ -486,7 +486,7 @@ mips_make_symbol_special (struct symbol *sym, struct objfile *objfile) if (sym->aclass () == LOC_BLOCK) { /* We are in symbol reading so it is OK to cast away constness. */ - struct block *block = (struct block *) SYMBOL_BLOCK_VALUE (sym); + struct block *block = (struct block *) sym->value_block (); CORE_ADDR compact_block_start; struct bound_minimal_symbol msym; @@ -7830,7 +7830,7 @@ mips_skip_pic_trampoline_code (struct frame_info *frame, CORE_ADDR pc) which jumps to foo. */ msym = lookup_minimal_symbol_by_pc (pc); if (msym.minsym == NULL - || BMSYMBOL_VALUE_ADDRESS (msym) != pc + || msym.value_address () != pc || msym.minsym->linkage_name () == NULL || !startswith (msym.minsym->linkage_name (), ".pic.")) return 0; diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c index 38b8a195358..fbedb77f46e 100644 --- a/gdb/netbsd-tdep.c +++ b/gdb/netbsd-tdep.c @@ -367,7 +367,7 @@ nbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) struct bound_minimal_symbol msym; msym = lookup_minimal_symbol ("_rtld_bind_start", NULL, NULL); - if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym && msym.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); else return find_solib_trampoline_target (get_current_frame (), pc); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index ed13097f7a8..00c362c5c9c 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -1249,7 +1249,7 @@ find_objc_msgsend (void) continue; } - methcalls[i].begin = BMSYMBOL_VALUE_ADDRESS (func); + methcalls[i].begin = func.value_address (); methcalls[i].end = minimal_symbol_upper_bound (func); } } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ddd94da42a6..0c71e0bd6a9 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -619,11 +619,8 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile, if ((sym->aclass () == LOC_LABEL || sym->aclass () == LOC_STATIC) && sym->section_index () >= 0) - { - SET_SYMBOL_VALUE_ADDRESS (sym, - SYMBOL_VALUE_ADDRESS (sym) - + delta[sym->section_index ()]); - } + sym->set_value_address (sym->value_address () + + delta[sym->section_index ()]); } /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c index f9b967ac47d..eed327bf7a9 100644 --- a/gdb/obsd-tdep.c +++ b/gdb/obsd-tdep.c @@ -31,7 +31,7 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) struct bound_minimal_symbol msym; msym = lookup_minimal_symbol("_dl_bind", NULL, NULL); - if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym && msym.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); else return find_solib_trampoline_target (get_current_frame (), pc); diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 3d1ea722d81..ffa82f6e42c 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -612,7 +612,7 @@ exp : THIS block : BLOCKNAME { if ($1.sym.symbol != 0) - $$ = SYMBOL_BLOCK_VALUE ($1.sym.symbol); + $$ = $1.sym.symbol->value_block (); else { std::string copy = copy_name ($1.stoken); @@ -639,7 +639,7 @@ block : block COLONCOLON name if (!tem || tem->aclass () != LOC_BLOCK) error (_("No function \"%s\" in specified context."), copy.c_str ()); - $$ = SYMBOL_BLOCK_VALUE (tem); } + $$ = tem->value_block (); } ; variable: block COLONCOLON name diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 427520fa6a0..43c286d6472 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -228,7 +228,7 @@ pascal_language::value_print_inner (struct value *val, /* If 'symbol_print' is set, we did the work above. */ if (!options->symbol_print && (msymbol.minsym != NULL) - && (vt_address == BMSYMBOL_VALUE_ADDRESS (msymbol))) + && (vt_address == msymbol.value_address ())) { if (want_space) gdb_puts (" ", stream); diff --git a/gdb/parse.c b/gdb/parse.c index 6d1b3d9d923..2389dbf0b0f 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -115,11 +115,11 @@ find_minsym_type_and_address (minimal_symbol *msymbol, { /* Addresses of TLS symbols are really offsets into a per-objfile/per-thread storage block. */ - addr = MSYMBOL_VALUE_RAW_ADDRESS (bound_msym.minsym); + addr = bound_msym.minsym->value_raw_address (); } else if (msymbol_is_function (objfile, msymbol, &addr)) { - if (addr != BMSYMBOL_VALUE_ADDRESS (bound_msym)) + if (addr != bound_msym.value_address ()) { /* This means we resolved a function descriptor, and we now have an address for a code/text symbol instead of a data @@ -132,7 +132,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol, } } else - addr = BMSYMBOL_VALUE_ADDRESS (bound_msym); + addr = bound_msym.value_address (); if (overlay_debugging) addr = symbol_overlayed_address (addr, section); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index ece7e763923..a11f3672393 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1662,9 +1662,9 @@ ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc) if (MSYMBOL_TARGET_FLAG_1 (fun.minsym)) local_entry_offset = 8; - if (BMSYMBOL_VALUE_ADDRESS (fun) <= pc - && pc < BMSYMBOL_VALUE_ADDRESS (fun) + local_entry_offset) - return BMSYMBOL_VALUE_ADDRESS (fun) + local_entry_offset; + if (fun.value_address () <= pc + && pc < fun.value_address () + local_entry_offset) + return fun.value_address () + local_entry_offset; return pc; } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 9a3b02f028d..6c2fd1bfc99 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1059,7 +1059,7 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) if (fn.minsym == NULL) return 0; /* Found a descriptor. */ - (*desc_addr) = BMSYMBOL_VALUE_ADDRESS (fn); + (*desc_addr) = fn.value_address (); return 1; } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3c78edf7cce..e870b35cf38 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -645,7 +645,7 @@ build_address_symbolic (struct gdbarch *gdbarch, pointer is . This matches the ISA behavior. */ addr = gdbarch_addr_bits_remove (gdbarch, addr); - name_location = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (symbol)); + name_location = BLOCK_ENTRY_PC (symbol->value_block ()); if (do_demangle || asm_demangle) name_temp = symbol->print_name (); else @@ -673,7 +673,7 @@ build_address_symbolic (struct gdbarch *gdbarch, under consideration. */ if (symbol == NULL || (!prefer_sym_over_minsym - && BMSYMBOL_VALUE_ADDRESS (msymbol) == addr + && msymbol.value_address () == addr && name_location != addr)) { /* If this is a function (i.e. a code address), strip out any @@ -688,7 +688,7 @@ build_address_symbolic (struct gdbarch *gdbarch, addr = gdbarch_addr_bits_remove (gdbarch, addr); symbol = 0; - name_location = BMSYMBOL_VALUE_ADDRESS (msymbol); + name_location = msymbol.value_address (); if (do_demangle || asm_demangle) name_temp = msymbol.minsym->print_name (); else @@ -1551,7 +1551,7 @@ info_symbol_command (const char *arg, int from_tty) const char *loc_string; matches = 1; - offset = sect_addr - MSYMBOL_VALUE_ADDRESS (objfile, msymbol); + offset = sect_addr - msymbol->value_address (objfile); mapped = section_is_mapped (osect) ? _("mapped") : _("unmapped"); sec_name = osect->the_bfd_section->name; msym_name = msymbol->print_name (); @@ -1649,7 +1649,7 @@ info_address_command (const char *exp, int from_tty) struct objfile *objfile = msymbol.objfile; gdbarch = objfile->arch (); - load_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); + load_addr = msymbol.value_address (); gdb_printf ("Symbol \""); fprintf_symbol (gdb_stdout, exp, @@ -1679,7 +1679,7 @@ info_address_command (const char *exp, int from_tty) gdb_printf ("Symbol \""); gdb_puts (sym->print_name ()); gdb_printf ("\" is "); - val = SYMBOL_VALUE (sym); + val = sym->value_longest (); if (sym->is_objfile_owned ()) section = sym->obj_section (symbol_objfile (sym)); else @@ -1703,7 +1703,7 @@ info_address_command (const char *exp, int from_tty) case LOC_LABEL: gdb_printf ("a label at address "); - load_addr = SYMBOL_VALUE_ADDRESS (sym); + load_addr = sym->value_address (); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); if (section_is_overlay (section)) @@ -1739,7 +1739,7 @@ info_address_command (const char *exp, int from_tty) case LOC_STATIC: gdb_printf (_("static storage at address ")); - load_addr = SYMBOL_VALUE_ADDRESS (sym); + load_addr = sym->value_address (); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); if (section_is_overlay (section)) @@ -1778,7 +1778,7 @@ info_address_command (const char *exp, int from_tty) case LOC_BLOCK: gdb_printf (_("a function at address ")); - load_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + load_addr = BLOCK_ENTRY_PC (sym->value_block ()); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); if (section_is_overlay (section)) @@ -1806,7 +1806,7 @@ info_address_command (const char *exp, int from_tty) if (section && (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) { - load_addr = MSYMBOL_VALUE_RAW_ADDRESS (msym.minsym); + load_addr = msym.minsym->value_raw_address (); gdb_printf (_("a thread-local variable at offset %s " "in the thread-local storage for `%s'"), paddress (gdbarch, load_addr), @@ -1814,7 +1814,7 @@ info_address_command (const char *exp, int from_tty) } else { - load_addr = BMSYMBOL_VALUE_ADDRESS (msym); + load_addr = msym.value_address (); gdb_printf (_("static storage at address ")); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); diff --git a/gdb/proc-service.c b/gdb/proc-service.c index e21ea05872a..dd3d7c9201e 100644 --- a/gdb/proc-service.c +++ b/gdb/proc-service.c @@ -111,7 +111,7 @@ ps_pglobal_lookup (struct ps_prochandle *ph, const char *obj, if (ms.minsym == NULL) return PS_NOSYM; - *sym_addr = core_addr_to_ps_addr (BMSYMBOL_VALUE_ADDRESS (ms)); + *sym_addr = core_addr_to_ps_addr (ms.value_address ()); return PS_OK; } diff --git a/gdb/psympriv.h b/gdb/psympriv.h index eeaf076bf13..9964c102403 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -46,14 +46,14 @@ struct partial_symbol /* Return the unrelocated address of this partial symbol. */ CORE_ADDR unrelocated_address () const { - return ginfo.value.address; + return ginfo.value_address (); } /* Return the address of this partial symbol, relocated according to the offsets provided in OBJFILE. */ CORE_ADDR address (const struct objfile *objfile) const { - return (ginfo.value.address + return (ginfo.value_address () + objfile->section_offsets[ginfo.section_index ()]); } @@ -61,7 +61,7 @@ struct partial_symbol unrelocated. */ void set_unrelocated_address (CORE_ADDR addr) { - ginfo.value.address = addr; + ginfo.set_value_address (addr); } /* Note that partial_symbol does not derive from general_symbol_info diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a26ecd0b4e5..5d9949bca1d 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -134,7 +134,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile, object's symbol table. */ p = find_pc_sect_psymbol (objfile, tpst, pc, section); if (p != NULL - && (p->address (objfile) == BMSYMBOL_VALUE_ADDRESS (msymbol))) + && (p->address (objfile) == msymbol.value_address ())) return tpst; /* Also accept the textlow value of a psymtab as a @@ -211,7 +211,7 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile, p = find_pc_sect_psymbol (objfile, pst, pc, section); if (p == NULL || (p->address (objfile) - != BMSYMBOL_VALUE_ADDRESS (msymbol))) + != msymbol.value_address ())) goto next; } @@ -1287,7 +1287,7 @@ psymbol_bcache::hash (const void *addr, int length) unsigned int domain = psymbol->domain; unsigned int theclass = psymbol->aclass; - h = fast_hash (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h); + h = fast_hash (&psymbol->ginfo.m_value, sizeof (psymbol->ginfo.m_value), h); h = fast_hash (&lang, sizeof (unsigned int), h); h = fast_hash (&domain, sizeof (unsigned int), h); h = fast_hash (&theclass, sizeof (unsigned int), h); @@ -1306,8 +1306,8 @@ psymbol_bcache::compare (const void *addr1, const void *addr2, int length) struct partial_symbol *sym1 = (struct partial_symbol *) addr1; struct partial_symbol *sym2 = (struct partial_symbol *) addr2; - return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value, - sizeof (sym1->ginfo.value)) == 0 + return (memcmp (&sym1->ginfo.m_value, &sym2->ginfo.m_value, + sizeof (sym1->ginfo.m_value)) == 0 && sym1->ginfo.language () == sym2->ginfo.language () && sym1->domain == sym2->domain && sym1->aclass == sym2->aclass @@ -1804,7 +1804,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) /* Skip symbols for inlined functions without address. These may or may not have a match in the full symtab. */ if (psym->aclass == LOC_BLOCK - && psym->ginfo.value.address == 0) + && psym->ginfo.value_address () == 0) continue; sym = block_lookup_symbol (b, psym->ginfo.search_name (), diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index cbc3508756e..aae6e397327 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -361,7 +361,7 @@ get_running_thread_id (int cpu) return 0; object_size = TYPE_LENGTH (builtin_type_void_data_ptr); - object_addr = (BMSYMBOL_VALUE_ADDRESS (object_msym) + object_addr = (object_msym.value_address () + (cpu - 1) * object_size); buf_size = object_size; buf = (gdb_byte *) alloca (buf_size); diff --git a/gdb/remote.c b/gdb/remote.c index b002f041734..75d6bf3919d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5155,7 +5155,7 @@ remote_target::remote_check_symbols () else { int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8; - CORE_ADDR sym_addr = BMSYMBOL_VALUE_ADDRESS (sym); + CORE_ADDR sym_addr = sym.value_address (); /* If this is a function address, return the start of code instead of any data function descriptor. */ diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 2a05026f3d7..18754f4f93b 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -767,7 +767,7 @@ ps_pglobal_lookup (struct ps_prochandle *ph, const char *ld_object_name, if (!ms.minsym) return PS_NOSYM; - *ld_symbol_addr = BMSYMBOL_VALUE_ADDRESS (ms); + *ld_symbol_addr = ms.value_address (); return PS_OK; } diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c index e456c6c9a41..a7bf8836269 100644 --- a/gdb/sol2-tdep.c +++ b/gdb/sol2-tdep.c @@ -67,7 +67,7 @@ sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) struct bound_minimal_symbol msym; msym = lookup_minimal_symbol("elf_bndr", NULL, NULL); - if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc) + if (msym.minsym && msym.value_address () == pc) return frame_unwind_caller_pc (get_current_frame ()); return 0; diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index a0735eafcc6..0b03f944608 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -459,7 +459,7 @@ lm_base (void) if (got_sym.minsym != 0) { - addr = BMSYMBOL_VALUE_ADDRESS (got_sym); + addr = got_sym.value_address (); if (solib_dsbt_debug) gdb_printf (gdb_stdlog, "lm_base: get addr %x by _GLOBAL_OFFSET_TABLE_.\n", diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 925ec717c8e..a6d6fe07088 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -296,7 +296,7 @@ lm_base (void) return 0; } - addr = BMSYMBOL_VALUE_ADDRESS (got_sym) + 8; + addr = got_sym.value_address () + 8; if (solib_frv_debug) gdb_printf (gdb_stdlog, @@ -900,7 +900,7 @@ main_got (void) if (got_sym.minsym == 0) return 0; - return BMSYMBOL_VALUE_ADDRESS (got_sym); + return got_sym.value_address (); } /* Find the global pointer for the given function address ADDR. */ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index ca98a812f36..2f3e79d200f 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -713,7 +713,7 @@ elf_locate_base (void) msymbol = lookup_minimal_symbol ("_r_debug", NULL, current_program_space->symfile_object_file); if (msymbol.minsym != NULL) - return BMSYMBOL_VALUE_ADDRESS (msymbol); + return msymbol.value_address (); /* DT_DEBUG entry not found. */ return 0; @@ -2369,9 +2369,9 @@ enable_break (struct svr4_info *info, int from_tty) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf); if ((msymbol.minsym != NULL) - && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) + && (msymbol.value_address () != 0)) { - sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); + sym_addr = msymbol.value_address (); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, current_inferior ()->top_target ()); svr4_create_solib_event_breakpoints (info, target_gdbarch (), @@ -2386,9 +2386,9 @@ enable_break (struct svr4_info *info, int from_tty) { msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf); if ((msymbol.minsym != NULL) - && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) + && (msymbol.value_address () != 0)) { - sym_addr = BMSYMBOL_VALUE_ADDRESS (msymbol); + sym_addr = msymbol.value_address (); sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr, current_inferior ()->top_target ()); diff --git a/gdb/solib.c b/gdb/solib.c index c64ef8c23b7..0fbf5bc988d 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1551,9 +1551,9 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd, { struct minimal_symbol msym {}; - SET_MSYMBOL_VALUE_ADDRESS (&msym, symaddr); + msym.set_value_address (symaddr); gdbarch_elf_make_msymbol_special (gdbarch, sym, &msym); - symaddr = MSYMBOL_VALUE_RAW_ADDRESS (&msym); + symaddr = msym.value_raw_address (); } /* BFD symbols are section relative. */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 5e85c34303c..3f173da71d5 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -623,7 +623,7 @@ symbol_reference_defined (const char **string) static int stab_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) { - int regno = gdbarch_stab_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym)); + int regno = gdbarch_stab_reg_to_regnum (gdbarch, sym->value_longest ()); if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch)) { @@ -805,7 +805,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, target_float_from_string (dbl_valu, dbl_type, std::string (p)); sym->set_type (dbl_type); - SYMBOL_VALUE_BYTES (sym) = dbl_valu; + sym->set_value_bytes (dbl_valu); sym->set_aclass_index (LOC_CONST_BYTES); } break; @@ -819,7 +819,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, unsigned as well as signed constants. */ sym->set_type (objfile_type (objfile)->builtin_long); - SYMBOL_VALUE (sym) = atoi (p); + sym->set_value_longest (atoi (p)); sym->set_aclass_index (LOC_CONST); } break; @@ -827,7 +827,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'c': { sym->set_type (objfile_type (objfile)->builtin_char); - SYMBOL_VALUE (sym) = atoi (p); + sym->set_value_longest (atoi (p)); sym->set_aclass_index (LOC_CONST); } break; @@ -888,7 +888,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, memcpy (string_value, string_local, ind + 1); p++; - SYMBOL_VALUE_BYTES (sym) = string_value; + sym->set_value_bytes (string_value); sym->set_aclass_index (LOC_CONST_BYTES); } break; @@ -915,7 +915,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, correct. Ideally, we should be using whatever we have available for parsing unsigned and long long values, however. */ - SYMBOL_VALUE (sym) = atoi (p); + sym->set_value_longest (atoi (p)); } break; default: @@ -933,7 +933,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LABEL); sym->set_domain (VAR_DOMAIN); - SET_SYMBOL_VALUE_ADDRESS (sym, valu); + sym->set_value_address (valu); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1032,7 +1032,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, if (sym->linkage_name () && sym->linkage_name ()[0] != '#') { i = hashname (sym->linkage_name ()); - SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; + sym->set_value_chain (global_sym_chain[i]); global_sym_chain[i] = sym; } add_symbol_to_list (sym, get_global_symbols ()); @@ -1045,7 +1045,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, case 'l': sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LOCAL); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1065,7 +1065,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_ARG); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); sym->set_is_argument (1); add_symbol_to_list (sym, get_local_symbols ()); @@ -1115,7 +1115,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_register_index); sym->set_is_argument (1); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1124,7 +1124,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Register variable (either global or local). */ sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_register_index); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); if (within_function) { @@ -1164,7 +1164,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Use the type from the LOC_REGISTER; that is the type that is actually in that register. */ prev_sym->set_type (sym->type ()); - SYMBOL_VALUE (prev_sym) = SYMBOL_VALUE (sym); + prev_sym->set_value_longest (sym->value_longest ()); sym = prev_sym; break; } @@ -1179,7 +1179,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Static symbol at top level of file. */ sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, valu); + sym->set_value_address (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); break; @@ -1210,7 +1210,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, return NULL; sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); /* C++ vagaries: we may have a type which is derived from a base type which did not have its name defined when the @@ -1287,7 +1287,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, *struct_sym = *sym; struct_sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_VALUE (struct_sym) = valu; + struct_sym->set_value_longest (valu); struct_sym->set_domain (STRUCT_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name @@ -1314,7 +1314,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, return NULL; sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (STRUCT_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name @@ -1329,7 +1329,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, *typedef_sym = *sym; typedef_sym->set_aclass_index (LOC_TYPEDEF); - SYMBOL_VALUE (typedef_sym) = valu; + typedef_sym->set_value_longest (valu); typedef_sym->set_domain (VAR_DOMAIN); if (sym->type ()->name () == 0) sym->type ()->set_name @@ -1343,7 +1343,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Static symbol of local scope. */ sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, valu); + sym->set_value_address (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1353,7 +1353,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_REF_ARG); sym->set_is_argument (1); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1363,7 +1363,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (stab_regparm_index); sym->set_is_argument (1); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1375,7 +1375,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, "x:3" (local symbol) instead. */ sym->set_type (read_type (&p, objfile)); sym->set_aclass_index (LOC_LOCAL); - SYMBOL_VALUE (sym) = valu; + sym->set_value_longest (valu); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1383,7 +1383,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, default: sym->set_type (error_type (&p, objfile)); sym->set_aclass_index (LOC_CONST); - SYMBOL_VALUE (sym) = 0; + sym->set_value_longest (0); sym->set_domain (VAR_DOMAIN); add_symbol_to_list (sym, get_file_symbols ()); break; @@ -3594,7 +3594,7 @@ read_enum_type (const char **pp, struct type *type, &objfile->objfile_obstack); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); - SYMBOL_VALUE (sym) = n; + sym->set_value_longest (n); if (n < 0) unsigned_enum = 0; add_symbol_to_list (sym, symlist); @@ -3637,7 +3637,7 @@ read_enum_type (const char **pp, struct type *type, xsym->set_type (type); type->field (n).set_name (xsym->linkage_name ()); - type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym)); + type->field (n).set_loc_enumval (xsym->value_longest ()); TYPE_FIELD_BITSIZE (type, n) = 0; } if (syms == osyms) @@ -4287,7 +4287,7 @@ common_block_end (struct objfile *objfile) Does it matter? */ i = hashname (sym->linkage_name ()); - SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i]; + sym->set_value_chain (global_sym_chain[i]); global_sym_chain[i] = sym; common_block_name = NULL; } @@ -4306,9 +4306,8 @@ fix_common_block (struct symbol *sym, CORE_ADDR valu) int j; for (j = next->nsyms - 1; j >= 0; j--) - SET_SYMBOL_VALUE_ADDRESS (next->symbol[j], - SYMBOL_VALUE_ADDRESS (next->symbol[j]) - + valu); + next->symbol[j]->set_value_address + (next->symbol[j]->value_address () + valu); } } @@ -4564,11 +4563,11 @@ scan_file_globals (struct objfile *objfile) assign the value we have to it. */ if (prev) { - SYMBOL_VALUE_CHAIN (prev) = SYMBOL_VALUE_CHAIN (sym); + prev->set_value_chain (sym->value_chain ()); } else { - global_sym_chain[hash] = SYMBOL_VALUE_CHAIN (sym); + global_sym_chain[hash] = sym->value_chain (); } /* Check to see whether we need to fix up a common block. */ @@ -4577,23 +4576,17 @@ scan_file_globals (struct objfile *objfile) if (sym) { if (sym->aclass () == LOC_BLOCK) - { - fix_common_block (sym, - MSYMBOL_VALUE_ADDRESS (resolve_objfile, - msymbol)); - } + fix_common_block + (sym, msymbol->value_address (resolve_objfile)); else - { - SET_SYMBOL_VALUE_ADDRESS - (sym, MSYMBOL_VALUE_ADDRESS (resolve_objfile, - msymbol)); - } + sym->set_value_address + (msymbol->value_address (resolve_objfile)); sym->set_section_index (msymbol->section_index ()); } if (prev) { - sym = SYMBOL_VALUE_CHAIN (prev); + sym = prev->value_chain (); } else { @@ -4603,7 +4596,7 @@ scan_file_globals (struct objfile *objfile) else { prev = sym; - sym = SYMBOL_VALUE_CHAIN (sym); + sym = sym->value_chain (); } } } @@ -4620,11 +4613,11 @@ scan_file_globals (struct objfile *objfile) while (sym) { prev = sym; - sym = SYMBOL_VALUE_CHAIN (sym); + sym = sym->value_chain (); /* Change the symbol address from the misleading chain value to address zero. */ - SET_SYMBOL_VALUE_ADDRESS (prev, 0); + prev->set_value_address (0); /* Complain about unresolved common block symbols. */ if (prev->aclass () == LOC_STATIC) diff --git a/gdb/stack.c b/gdb/stack.c index 1ccad83a2dd..1229ee6b492 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -750,7 +750,7 @@ print_frame_args (const frame_print_options &fp_opts, if (func) { - const struct block *b = SYMBOL_BLOCK_VALUE (func); + const struct block *b = func->value_block (); struct block_iterator iter; struct symbol *sym; @@ -778,7 +778,7 @@ print_frame_args (const frame_print_options &fp_opts, case LOC_ARG: case LOC_REF_ARG: { - long current_offset = SYMBOL_VALUE (sym); + long current_offset = sym->value_longest (); int arg_size = TYPE_LENGTH (sym->type ()); /* Compute address of next argument by adding the size of @@ -2554,7 +2554,7 @@ print_frame_arg_vars (struct frame_info *frame, cb_data.stream = stream; cb_data.values_printed = 0; - iterate_over_block_arg_vars (SYMBOL_BLOCK_VALUE (func), cb_data); + iterate_over_block_arg_vars (func->value_block (), cb_data); /* do_print_variable_and_value invalidates FRAME. */ frame = NULL; diff --git a/gdb/symfile.c b/gdb/symfile.c index dcd217c0a51..6f546f5b059 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3450,11 +3450,11 @@ simple_read_overlay_table (void) word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; byte_order = gdbarch_byte_order (gdbarch); - cache_novlys = read_memory_integer (BMSYMBOL_VALUE_ADDRESS (novlys_msym), + cache_novlys = read_memory_integer (novlys_msym.value_address (), 4, byte_order); cache_ovly_table = (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table)); - cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym); + cache_ovly_table_base = ovly_table_msym.value_address (); read_target_long_array (cache_ovly_table_base, (unsigned int *) cache_ovly_table, cache_novlys * 4, word_size, byte_order); @@ -3524,7 +3524,7 @@ simple_overlay_update (struct obj_section *osect) "find `_ovly_table' array\n" "in inferior. Use `overlay manual' mode.")); - if (cache_ovly_table_base == BMSYMBOL_VALUE_ADDRESS (minsym)) + if (cache_ovly_table_base == minsym.value_address ()) /* Then go ahead and try to look up this single section in the cache. */ if (simple_overlay_update_1 (osect)) diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 1779816348f..1bc5f9f0bd9 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -201,7 +201,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) /* Use the relocated address as shown in the symbol here -- do not try to respect copy relocations. */ - CORE_ADDR addr = (msymbol->value.address + CORE_ADDR addr = (msymbol->value_raw_address () + objfile->section_offsets[msymbol->section_index ()]); gdb_puts (paddress (gdbarch, addr), outfile); gdb_printf (outfile, " %s", msymbol->linkage_name ()); @@ -511,7 +511,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, if (symbol->domain () == LABEL_DOMAIN) { gdb_printf (outfile, "label %s at ", symbol->print_name ()); - gdb_puts (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), + gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile); if (section) gdb_printf (outfile, " section %s\n", @@ -562,8 +562,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, { case LOC_CONST: gdb_printf (outfile, "const %s (%s)", - plongest (SYMBOL_VALUE (symbol)), - hex_string (SYMBOL_VALUE (symbol))); + plongest (symbol->value_longest ()), + hex_string (symbol->value_longest ())); break; case LOC_CONST_BYTES: @@ -575,14 +575,13 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, pulongest (TYPE_LENGTH (type))); for (i = 0; i < TYPE_LENGTH (type); i++) gdb_printf (outfile, " %02x", - (unsigned) SYMBOL_VALUE_BYTES (symbol)[i]); + (unsigned) symbol->value_bytes ()[i]); } break; case LOC_STATIC: gdb_printf (outfile, "static at "); - gdb_puts (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), - outfile); + gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); @@ -591,30 +590,30 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_REGISTER: if (symbol->is_argument ()) gdb_printf (outfile, "parameter register %s", - plongest (SYMBOL_VALUE (symbol))); + plongest (symbol->value_longest ())); else gdb_printf (outfile, "register %s", - plongest (SYMBOL_VALUE (symbol))); + plongest (symbol->value_longest ())); break; case LOC_ARG: gdb_printf (outfile, "arg at offset %s", - hex_string (SYMBOL_VALUE (symbol))); + hex_string (symbol->value_longest ())); break; case LOC_REF_ARG: gdb_printf (outfile, "reference arg at %s", - hex_string (SYMBOL_VALUE (symbol))); + hex_string (symbol->value_longest ())); break; case LOC_REGPARM_ADDR: gdb_printf (outfile, "address parameter register %s", - plongest (SYMBOL_VALUE (symbol))); + plongest (symbol->value_longest ())); break; case LOC_LOCAL: gdb_printf (outfile, "local at offset %s", - hex_string (SYMBOL_VALUE (symbol))); + hex_string (symbol->value_longest ())); break; case LOC_TYPEDEF: @@ -622,8 +621,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_LABEL: gdb_printf (outfile, "label at "); - gdb_puts (paddress (gdbarch, SYMBOL_VALUE_ADDRESS (symbol)), - outfile); + gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); @@ -632,9 +630,9 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_BLOCK: gdb_printf (outfile, "block object %s, %s..%s", - host_address_to_string (SYMBOL_BLOCK_VALUE (symbol)), - paddress (gdbarch, BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))), - paddress (gdbarch, BLOCK_END (SYMBOL_BLOCK_VALUE (symbol)))); + host_address_to_string (symbol->value_block ()), + paddress (gdbarch, BLOCK_START (symbol->value_block ())), + paddress (gdbarch, BLOCK_END (symbol->value_block ()))); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); diff --git a/gdb/symtab.c b/gdb/symtab.c index 3cc2d4f8648..d15eec8b6b4 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -414,6 +414,19 @@ compunit_language (const struct compunit_symtab *cust) return symtab->language (); } +/* The relocated address of the minimal symbol, using the section + offsets from OBJFILE. */ + +CORE_ADDR +minimal_symbol::value_address (objfile *objfile) const +{ + if (this->maybe_copied) + return get_msymbol_address (objfile, this); + else + return (this->value_raw_address () + + objfile->section_offsets[this->section_index ()]); +} + /* See symtab.h. */ bool @@ -1805,10 +1818,10 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile) { case LOC_STATIC: case LOC_LABEL: - addr = SYMBOL_VALUE_ADDRESS (sym); + addr = sym->value_address (); break; case LOC_BLOCK: - addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + addr = BLOCK_ENTRY_PC (sym->value_block ()); break; default: @@ -3083,7 +3096,7 @@ find_symbol_at_address (CORE_ADDR address) ALL_BLOCK_SYMBOLS (b, iter, sym) { if (sym->aclass () == LOC_STATIC - && SYMBOL_VALUE_ADDRESS (sym) == addr) + && sym->value_address () == addr) return sym; } } @@ -3245,8 +3258,8 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) msymbol->linkage_name ()); */ ; /* fall through */ - else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) - == BMSYMBOL_VALUE_ADDRESS (msymbol)) + else if (mfunsym.value_address () + == msymbol.value_address ()) /* Avoid infinite recursion */ /* See above comment about why warning is commented out. */ /* warning ("In stub for %s; unable to find real function/line info", @@ -3258,12 +3271,12 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) /* Detect an obvious case of infinite recursion. If this should occur, we'd like to know about it, so error out, fatally. */ - if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc) + if (mfunsym.value_address () == pc) internal_error (__FILE__, __LINE__, _("Infinite recursion detected in find_pc_sect_line;" "please file a bug report")); - return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0); + return find_pc_line (mfunsym.value_address (), 0); } } @@ -3766,7 +3779,7 @@ find_function_start_sal (symbol *sym, bool funfirstline) { fixup_symbol_section (sym, NULL); symtab_and_line sal - = find_function_start_sal_1 (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)), + = find_function_start_sal_1 (BLOCK_ENTRY_PC (sym->value_block ()), sym->obj_section (symbol_objfile (sym)), funfirstline); sal.symbol = sym; @@ -3895,7 +3908,7 @@ skip_prologue_sal (struct symtab_and_line *sal) fixup_symbol_section (sym, NULL); objfile = symbol_objfile (sym); - pc = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + pc = BLOCK_ENTRY_PC (sym->value_block ()); section = sym->obj_section (objfile); name = sym->linkage_name (); } @@ -3908,7 +3921,7 @@ skip_prologue_sal (struct symtab_and_line *sal) return; objfile = msymbol.objfile; - pc = BMSYMBOL_VALUE_ADDRESS (msymbol); + pc = msymbol.value_address (); section = msymbol.minsym->obj_section (objfile); name = msymbol.minsym->linkage_name (); } @@ -3971,8 +3984,8 @@ skip_prologue_sal (struct symtab_and_line *sal) /* Check if gdbarch_skip_prologue left us in mid-line, and the next line is still part of the same function. */ if (skip && start_sal.pc != pc - && (sym ? (BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end - && start_sal.end < BLOCK_END (SYMBOL_BLOCK_VALUE (sym))) + && (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end + && start_sal.end < BLOCK_END (sym->value_block ())) : (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym == lookup_minimal_symbol_by_pc_section (pc, section).minsym))) { @@ -4169,7 +4182,7 @@ find_function_alias_target (bound_minimal_symbol msymbol) symbol *sym = find_pc_function (func_addr); if (sym != NULL && sym->aclass () == LOC_BLOCK - && BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)) == func_addr) + && BLOCK_ENTRY_PC (sym->value_block ()) == func_addr) return sym; return NULL; @@ -4822,8 +4835,7 @@ global_symbol_searcher::expand_symtabs the symbols tables are expanded. */ if (kind == FUNCTIONS_DOMAIN ? (find_pc_compunit_symtab - (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) - == NULL) + (msymbol->value_address (objfile)) == NULL) : (lookup_symbol_in_objfile_from_linkage_name (objfile, msymbol->linkage_name (), VAR_DOMAIN) @@ -4945,8 +4957,7 @@ global_symbol_searcher::add_matching_msymbols symbol might be found via find_pc_symtab. */ if (kind != FUNCTIONS_DOMAIN || (find_pc_compunit_symtab - (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) - == NULL)) + (msymbol->value_address (objfile)) == NULL)) { if (lookup_symbol_in_objfile_from_linkage_name (objfile, msymbol->linkage_name (), @@ -5168,11 +5179,11 @@ print_msymbol_info (struct bound_minimal_symbol msymbol) char *tmp; if (gdbarch_addr_bit (gdbarch) <= 32) - tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol) + tmp = hex_string_custom (msymbol.value_address () & (CORE_ADDR) 0xffffffff, 8); else - tmp = hex_string_custom (BMSYMBOL_VALUE_ADDRESS (msymbol), + tmp = hex_string_custom (msymbol.value_address (), 16); ui_file_style sym_style = (msymbol.minsym->text_p () @@ -5780,7 +5791,7 @@ find_gnu_ifunc (const symbol *sym) symbol_name_match_type::SEARCH_NAME); struct objfile *objfile = symbol_objfile (sym); - CORE_ADDR address = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)); + CORE_ADDR address = BLOCK_ENTRY_PC (sym->value_block ()); minimal_symbol *ifunc = NULL; iterate_over_minimal_symbols (objfile, lookup_name, @@ -5789,7 +5800,7 @@ find_gnu_ifunc (const symbol *sym) if (MSYMBOL_TYPE (minsym) == mst_text_gnu_ifunc || MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) { - CORE_ADDR msym_addr = MSYMBOL_VALUE_ADDRESS (objfile, minsym); + CORE_ADDR msym_addr = minsym->value_address (objfile); if (MSYMBOL_TYPE (minsym) == mst_data_gnu_ifunc) { struct gdbarch *gdbarch = objfile->arch (); @@ -6634,9 +6645,9 @@ get_symbol_address (const struct symbol *sym) bound_minimal_symbol minsym = lookup_minimal_symbol_linkage (linkage_name, objfile); if (minsym.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (minsym); + return minsym.value_address (); } - return sym->value.address; + return sym->m_value.address; } /* See symtab.h. */ @@ -6657,10 +6668,10 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym) bound_minimal_symbol found = lookup_minimal_symbol_linkage (linkage_name, objfile); if (found.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (found); + return found.value_address (); } } - return (minsym->value.address + return (minsym->m_value.address + objf->section_offsets[minsym->section_index ()]); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 0df5e237564..390ee9d0d67 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -475,6 +475,16 @@ struct general_symbol_info gdb::optional hash = gdb::optional ()); + CORE_ADDR value_address () const + { + return m_value.address; + } + + void set_value_address (CORE_ADDR address) + { + m_value.address = address; + } + /* Name of the symbol. This is a required field. Storage for the name is allocated on the objfile_obstack for the associated objfile. For languages like C++ that make a distinction between @@ -507,7 +517,7 @@ struct general_symbol_info struct symbol *chain; } - value; + m_value; /* Since one and only one language can apply, wrap the language specific information inside a union. */ @@ -573,19 +583,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); extern CORE_ADDR get_symbol_address (const struct symbol *sym); -/* Note that these macros only work with symbol, not partial_symbol. */ - -#define SYMBOL_VALUE(symbol) (symbol)->value.ivalue -#define SYMBOL_VALUE_ADDRESS(symbol) \ - (((symbol)->maybe_copied) ? get_symbol_address (symbol) \ - : ((symbol)->value.address)) -#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \ - ((symbol)->value.address = (new_value)) -#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes -#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block -#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block -#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain - /* Try to determine the demangled name for a symbol, based on the language of that symbol. If the language is set to language_auto, it will attempt to find any demangling algorithm that works and @@ -664,6 +661,15 @@ enum minimal_symbol_type #define MINSYM_TYPE_BITS 4 gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS)); +/* Return the address of MINSYM, which comes from OBJF. The + MAYBE_COPIED flag must be set on MINSYM. If MINSYM appears in the + main program's minimal symbols, then that minsym's address is + returned; otherwise, MINSYM's address is returned. This should + generally only be used via the MSYMBOL_VALUE_ADDRESS macro. */ + +extern CORE_ADDR get_msymbol_address (struct objfile *objf, + const struct minimal_symbol *minsym); + /* Define a simple structure used to hold some very basic information about all defined global symbols (text, data, bss, abs, etc). The only required information is the general_symbol_info. @@ -678,6 +684,21 @@ gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS)); struct minimal_symbol : public general_symbol_info { + LONGEST value_longest () const + { + return m_value.ivalue; + } + + /* The relocated address of the minimal symbol, using the section + offsets from OBJFILE. */ + CORE_ADDR value_address (objfile *objfile) const; + + /* The unrelocated address of the minimal symbol. */ + CORE_ADDR value_raw_address () const + { + return m_value.address; + } + /* Size of this symbol. dbx_end_psymtab in dbxread.c uses this information to calculate the end of the partial symtab based on the address of the last symbol plus the size of the last symbol. */ @@ -735,15 +756,6 @@ struct minimal_symbol : public general_symbol_info bool text_p () const; }; -/* Return the address of MINSYM, which comes from OBJF. The - MAYBE_COPIED flag must be set on MINSYM. If MINSYM appears in the - main program's minimal symbols, then that minsym's address is - returned; otherwise, MINSYM's address is returned. This should - generally only be used via the MSYMBOL_VALUE_ADDRESS macro. */ - -extern CORE_ADDR get_msymbol_address (struct objfile *objf, - const struct minimal_symbol *minsym); - #define MSYMBOL_TARGET_FLAG_1(msymbol) (msymbol)->target_flag_1 #define MSYMBOL_TARGET_FLAG_2(msymbol) (msymbol)->target_flag_2 #define MSYMBOL_SIZE(msymbol) ((msymbol)->size + 0) @@ -756,23 +768,6 @@ extern CORE_ADDR get_msymbol_address (struct objfile *objf, #define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0) #define MSYMBOL_TYPE(msymbol) (msymbol)->type -#define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue -/* The unrelocated address of the minimal symbol. */ -#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0) -/* The relocated address of the minimal symbol, using the section - offsets from OBJFILE. */ -#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \ - (((symbol)->maybe_copied) ? get_msymbol_address (objfile, symbol) \ - : ((symbol)->value.address \ - + (objfile)->section_offsets[(symbol)->section_index ()])) -/* For a bound minsym, we can easily compute the address directly. */ -#define BMSYMBOL_VALUE_ADDRESS(symbol) \ - MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym) -#define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ - ((symbol)->value.address = (new_value)) -#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes -#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block - #include "minsyms.h" @@ -1124,7 +1119,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack /* We can't use an initializer list for members of a base class, and general_symbol_info needs to stay a POD type. */ m_name = nullptr; - value.ivalue = 0; + m_value.ivalue = 0; language_specific.obstack = nullptr; m_language = language_unknown; ada_mangled = 0; @@ -1222,6 +1217,69 @@ struct symbol : public general_symbol_info, public allocate_on_obstack m_line = line; } + LONGEST value_longest () const + { + return m_value.ivalue; + } + + void set_value_longest (LONGEST value) + { + m_value.ivalue = value; + } + + CORE_ADDR value_address () const + { + if (this->maybe_copied) + return get_symbol_address (this); + else + return m_value.address; + } + + void set_value_address (CORE_ADDR address) + { + m_value.address = address; + } + + const gdb_byte *value_bytes () const + { + return m_value.bytes; + } + + void set_value_bytes (const gdb_byte *bytes) + { + m_value.bytes = bytes; + } + + const common_block *value_common_block () const + { + return m_value.common_block; + } + + void set_value_common_block (const common_block *common_block) + { + m_value.common_block = common_block; + } + + const block *value_block () const + { + return m_value.block; + } + + void set_value_block (const block *block) + { + m_value.block = block; + } + + symbol *value_chain () const + { + return m_value.chain; + } + + void set_value_chain (symbol *sym) + { + m_value.chain = sym; + } + /* Data type of value */ struct type *m_type = nullptr; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index b45763ec02b..5a4048f9078 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -696,7 +696,7 @@ validate_actionline (const char *line, struct breakpoint *b) error (_("constant `%s' (value %s) " "will not be collected."), sym->print_name (), - plongest (SYMBOL_VALUE (sym))); + plongest (sym->value_longest ())); } else if (sym->aclass () == LOC_OPTIMIZED_OUT) { @@ -931,10 +931,10 @@ collection_list::collect_symbol (struct symbol *sym, break; case LOC_CONST: gdb_printf ("constant %s (value %s) will not be collected.\n", - sym->print_name (), plongest (SYMBOL_VALUE (sym))); + sym->print_name (), plongest (sym->value_longest ())); break; case LOC_STATIC: - offset = SYMBOL_VALUE_ADDRESS (sym); + offset = sym->value_address (); if (info_verbose) { gdb_printf ("LOC_STATIC %s: collect %ld bytes at %s.\n", @@ -965,7 +965,7 @@ collection_list::collect_symbol (struct symbol *sym, break; case LOC_ARG: reg = frame_regno; - offset = frame_offset + SYMBOL_VALUE (sym); + offset = frame_offset + sym->value_longest (); if (info_verbose) { gdb_printf ("LOC_LOCAL %s: Collect %ld bytes at offset %s" @@ -975,7 +975,7 @@ collection_list::collect_symbol (struct symbol *sym, add_memrange (gdbarch, reg, offset, len, scope); break; case LOC_REGPARM_ADDR: - reg = SYMBOL_VALUE (sym); + reg = sym->value_longest (); offset = 0; if (info_verbose) { @@ -987,7 +987,7 @@ collection_list::collect_symbol (struct symbol *sym, break; case LOC_LOCAL: reg = frame_regno; - offset = frame_offset + SYMBOL_VALUE (sym); + offset = frame_offset + sym->value_longest (); if (info_verbose) { gdb_printf ("LOC_LOCAL %s: Collect %ld bytes at offset %s" @@ -2526,20 +2526,18 @@ info_scope_command (const char *args_in, int from_tty) continue; case LOC_CONST: gdb_printf ("a constant with value %s (%s)", - plongest (SYMBOL_VALUE (sym)), - hex_string (SYMBOL_VALUE (sym))); + plongest (sym->value_longest ()), + hex_string (sym->value_longest ())); break; case LOC_CONST_BYTES: gdb_printf ("constant bytes: "); if (sym->type ()) for (j = 0; j < TYPE_LENGTH (sym->type ()); j++) - gdb_printf (" %02x", - (unsigned) SYMBOL_VALUE_BYTES (sym)[j]); + gdb_printf (" %02x", (unsigned) sym->value_bytes ()[j]); break; case LOC_STATIC: gdb_printf ("in static storage at address "); - gdb_printf ("%s", paddress (gdbarch, - SYMBOL_VALUE_ADDRESS (sym))); + gdb_printf ("%s", paddress (gdbarch, sym->value_address ())); break; case LOC_REGISTER: /* GDBARCH is the architecture associated with the objfile @@ -2561,15 +2559,15 @@ info_scope_command (const char *args_in, int from_tty) break; case LOC_ARG: gdb_printf ("an argument at stack/frame offset %s", - plongest (SYMBOL_VALUE (sym))); + plongest (sym->value_longest ())); break; case LOC_LOCAL: gdb_printf ("a local variable at frame offset %s", - plongest (SYMBOL_VALUE (sym))); + plongest (sym->value_longest ())); break; case LOC_REF_ARG: gdb_printf ("a reference argument at offset %s", - plongest (SYMBOL_VALUE (sym))); + plongest (sym->value_longest ())); break; case LOC_REGPARM_ADDR: /* Note comment at LOC_REGISTER. */ @@ -2583,13 +2581,13 @@ info_scope_command (const char *args_in, int from_tty) continue; case LOC_LABEL: gdb_printf ("a label at address "); - gdb_printf ("%s", paddress (gdbarch, - SYMBOL_VALUE_ADDRESS (sym))); + gdb_printf ("%s", paddress (gdbarch, sym->value_address ())); break; case LOC_BLOCK: gdb_printf ("a function at address "); gdb_printf ("%s", - paddress (gdbarch, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym)))); + paddress (gdbarch, + BLOCK_ENTRY_PC (sym->value_block ()))); break; case LOC_UNRESOLVED: msym = lookup_minimal_symbol (sym->linkage_name (), @@ -2600,8 +2598,7 @@ info_scope_command (const char *args_in, int from_tty) { gdb_printf ("static storage at address "); gdb_printf ("%s", - paddress (gdbarch, - BMSYMBOL_VALUE_ADDRESS (msym))); + paddress (gdbarch, msym.value_address ())); } break; case LOC_OPTIMIZED_OUT: diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 70f7429d32b..2cb9c75ca8d 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -168,9 +168,9 @@ tui_find_backward_disassembly_start_address (CORE_ADDR addr) lookup_msym_prefer::TEXT, &msym_prev); if (msym.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (msym); + return msym.value_address (); else if (msym_prev.minsym != nullptr) - return BMSYMBOL_VALUE_ADDRESS (msym_prev); + return msym_prev.value_address (); /* Find the section that ADDR is in, and look for the start of the section. */ @@ -404,7 +404,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) struct bound_minimal_symbol main_symbol = lookup_minimal_symbol (main_name (), nullptr, nullptr); if (main_symbol.minsym != nullptr) - addr = BMSYMBOL_VALUE_ADDRESS (main_symbol); + addr = main_symbol.value_address (); } } else /* The target is executing. */ diff --git a/gdb/valops.c b/gdb/valops.c index 67209ce6cd8..42a1213b0c5 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -146,7 +146,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char); type = lookup_function_type (type); type = lookup_pointer_type (type); - maddr = BMSYMBOL_VALUE_ADDRESS (msymbol); + maddr = msymbol.value_address (); if (objf_p) *objf_p = objfile; diff --git a/gdb/value.c b/gdb/value.c index 24f1151c03f..08cccf711b2 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2986,7 +2986,7 @@ value_static_field (struct type *type, int fieldno) if (!msym.minsym) retval = allocate_optimized_out_value (field_type); else - retval = value_at_lazy (field_type, BMSYMBOL_VALUE_ADDRESS (msym)); + retval = value_at_lazy (field_type, msym.value_address ()); } else retval = value_of_variable (sym.symbol, sym.block); @@ -3184,7 +3184,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, VALUE_LVAL (v) = lval_memory; if (sym) { - set_value_address (v, BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym))); + set_value_address (v, BLOCK_ENTRY_PC (sym->value_block ())); } else { @@ -3195,7 +3195,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, set_value_address (v, gdbarch_convert_from_func_ptr_addr - (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym), + (gdbarch, msym.value_address (), current_inferior ()->top_target ())); } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index e45fa275c09..c5d2d0a492f 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1563,7 +1563,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) ++name; /* default assumptions */ - SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off); + sym->set_value_address (cs->c_value + off); sym->set_domain (VAR_DOMAIN); sym->set_section_index (secnum_to_section (cs->c_secnum, objfile)); @@ -1660,9 +1660,8 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) cs->c_name, 0, 0, objfile); if (sym != NULL) { - SET_SYMBOL_VALUE_ADDRESS (sym, - SYMBOL_VALUE_ADDRESS (sym) - + static_block_base); + sym->set_value_address + (sym->value_address () + static_block_base); sym->set_section_index (static_block_section); } return sym; diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index a252574c94e..c2d906d1402 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -360,7 +360,7 @@ z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, msymbol = lookup_minimal_symbol ("__sdcc_enter_ix", NULL, NULL); if (msymbol.minsym) { - value = BMSYMBOL_VALUE_ADDRESS (msymbol); + value = msymbol.value_address (); if (value == extract_unsigned_integer (&prologue[pos+1], addr_len, byte_order)) { pos += 1 + addr_len; @@ -625,7 +625,7 @@ z80_frame_unwind_cache (struct frame_info *this_frame, msymbol = lookup_minimal_symbol (names[i], NULL, NULL); if (!msymbol.minsym) continue; - if (addr == BMSYMBOL_VALUE_ADDRESS (msymbol)) + if (addr == msymbol.value_address ()) break; } if (i >= 0) @@ -722,7 +722,7 @@ z80_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr) struct bound_minimal_symbol bh; bh = lookup_minimal_symbol ("_break_handler", NULL, NULL); if (bh.minsym) - addr = BMSYMBOL_VALUE_ADDRESS (bh); + addr = bh.value_address (); else { warning(_("Unable to determine inferior's software breakpoint type: " @@ -927,14 +927,13 @@ z80_read_overlay_region_table () word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; byte_order = gdbarch_byte_order (gdbarch); - cache_novly_regions = read_memory_integer ( - BMSYMBOL_VALUE_ADDRESS (novly_regions_msym), - 4, byte_order); + cache_novly_regions = read_memory_integer (novly_regions_msym.value_address (), + 4, byte_order); cache_ovly_region_table = (unsigned int (*)[3]) xmalloc (cache_novly_regions * sizeof (*cache_ovly_region_table)); cache_ovly_region_table_base - = BMSYMBOL_VALUE_ADDRESS (ovly_region_table_msym); + = ovly_region_table_msym.value_address (); read_target_long_array (cache_ovly_region_table_base, (unsigned int *) cache_ovly_region_table, cache_novly_regions * 3, word_size, byte_order); -- 2.30.2