{
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;
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."));
&& 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:
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:
/* 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. */
(*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;
}
}
if (msymbol.minsym != NULL)
{
struct ada_exc_info info
- = {name, BMSYMBOL_VALUE_ADDRESS (msymbol)};
+ = {name, msymbol.value_address ()};
exceptions->push_back (info);
}
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);
}
&& 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);
}
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));
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,
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 ());
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",
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;
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. */
{
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));
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 ());
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 ();
= lookup_minimal_symbol (target_name, NULL, objfile);
if (minsym.minsym != nullptr)
- return BMSYMBOL_VALUE_ADDRESS (minsym);
+ return minsym.value_address ();
return 0;
}
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;
}
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
/* 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)
{
static void
gen_sym_offset (struct agent_expr *ax, struct symbol *var)
{
- gen_offset (ax, SYMBOL_VALUE (var));
+ gen_offset (ax, var->value_longest ());
}
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;
/* 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;
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;
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;
if (symbol)
{
- bl = SYMBOL_BLOCK_VALUE (symbol);
+ bl = symbol->value_block ();
return BLOCK_ENTRY_PC (bl);
}
}
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;
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;
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);
{
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;
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);
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);
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);
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,
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;
}
sym = lookup_minimal_symbol (name, NULL, objfile);
if (sym.minsym)
- return BMSYMBOL_VALUE_ADDRESS (sym);
+ return sym.value_address ();
return 0;
}
{
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)
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 ());
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
if (alias_target != NULL)
{
block_symbol bsym { alias_target,
- SYMBOL_BLOCK_VALUE (alias_target) };
+ alias_target->value_block () };
pstate->push_new<var_value_operation> (bsym);
}
else
/* 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);
" \"%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 ();
sym = process_coff_symbol
(cs, &main_aux, objfile);
- SYMBOL_VALUE (sym) = tmpaddr + offset;
+ sym->set_value_longest (tmpaddr + offset);
sym->set_section_index (sec);
}
}
&& 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);
}
}
}
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 = {
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)));
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;
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. */
#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;
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;
{
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 ());
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;
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;
}
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;
}
context->plugin ().build_constant
(sym_type, sym.symbol->natural_name (),
- SYMBOL_VALUE (sym.symbol),
+ sym.symbol->value_longest (),
filename, line);
return;
case LOC_STATIC:
kind = GCC_C_SYMBOL_VARIABLE;
- addr = SYMBOL_VALUE_ADDRESS (sym.symbol);
+ addr = sym.symbol->value_address ();
break;
case LOC_FINAL_VALUE:
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))
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;
"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;
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);
}
}
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:
case LOC_STATIC:
kind = GCC_CP_SYMBOL_VARIABLE;
- addr = SYMBOL_VALUE_ADDRESS (sym.symbol);
+ addr = sym.symbol->value_address ();
break;
case LOC_FINAL_VALUE:
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))
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;
"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;
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)),
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))
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",
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\" "
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)
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.
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 ());
}
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))
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))
}
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;
= 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. */
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;
: msym.minsym->print_name ()));
}
- callback (BMSYMBOL_VALUE_ADDRESS (msym));
+ callback (msym.value_address ());
}
break;
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"),
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);
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;
}
}
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;
}
sym = new_symbol (die, objfile_type (objfile)->builtin_void, cu);
- SYMBOL_VALUE_COMMON_BLOCK (sym) = common_block;
+ sym->set_value_common_block (common_block);
}
}
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;
}
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
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,
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);
}
}
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;
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)
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);
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));
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;
/* 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;
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;
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;
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:
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:
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;
case LOC_LOCAL:
addr = get_frame_locals_address (frame);
- addr += SYMBOL_VALUE (var);
+ addr += var->value_longest ();
break;
case LOC_TYPEDEF:
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:
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. */
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. */
/* 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
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;
}
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 ());
}
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;
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
minsym = lookup_minimal_symbol (sym, NULL, NULL);
if (minsym.minsym)
- return BMSYMBOL_VALUE_ADDRESS (minsym);
+ return minsym.value_address ();
else
return (CORE_ADDR)-1;
}
{
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;
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);
}
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;
{
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
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 ())
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++;
}
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;
}
}
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));
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 ());
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;
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;
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. */
&& 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
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);
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;
}
}
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;
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;
}
if (version_msym.minsym == NULL)
return 0;
- version_addr = BMSYMBOL_VALUE_ADDRESS (version_msym);
+ version_addr = version_msym.value_address ();
gdb::unique_xmalloc_ptr<char> version
= target_read_string (version_addr, 32, &got);
if (version != nullptr
/* This will be used for extensions later. Like adding modules. */
block : fblock
- { $$ = SYMBOL_BLOCK_VALUE($1); }
+ { $$ = $1->value_block (); }
;
fblock : BLOCKNAME
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);
}
}
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);
}
}
else
{
/* The trampoline's address is our pointer. */
- addr = BMSYMBOL_VALUE_ADDRESS (tramp_msym);
+ addr = tramp_msym.value_address ();
}
}
/* 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
/* 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
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. */
return 0;
}
else
- return BMSYMBOL_VALUE_ADDRESS (msym);
+ return msym.value_address ();
}
/* Add oso file OSO/ABFD as a symbol file. */
{
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)
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))
{
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;
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);
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;
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;
/* 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;
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);
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;
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);
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);
if (s != 0)
{
- b = SYMBOL_BLOCK_VALUE (s);
+ b = s->value_block ();
}
else
{
{
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
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 ());
}
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 ());
}
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)
{
= lookup_minimal_symbol (name, NULL, objfile);
if (sym.minsym != NULL)
- *addr = BMSYMBOL_VALUE_ADDRESS (sym);
+ *addr = sym.value_address ();
return sym.minsym == NULL;
}
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;
}
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;
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. */
&& 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)))
{
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--;
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)
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;
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;
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;
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. */
}
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 (),
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
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. */
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. */
{
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);
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);
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);
}
}
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;
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;
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);
continue;
}
- methcalls[i].begin = BMSYMBOL_VALUE_ADDRESS (func);
+ methcalls[i].begin = func.value_address ();
methcalls[i].end = minimal_symbol_upper_bound (func);
}
}
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
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);
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);
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
/* 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);
{
/* 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
}
}
else
- addr = BMSYMBOL_VALUE_ADDRESS (bound_msym);
+ addr = bound_msym.value_address ();
if (overlay_debugging)
addr = symbol_overlayed_address (addr, section);
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;
}
if (fn.minsym == NULL)
return 0;
/* Found a descriptor. */
- (*desc_addr) = BMSYMBOL_VALUE_ADDRESS (fn);
+ (*desc_addr) = fn.value_address ();
return 1;
}
pointer is <function+3>. 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
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
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
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 ();
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,
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
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))
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))
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))
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),
}
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);
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;
}
/* 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 ()]);
}
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
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
p = find_pc_sect_psymbol (objfile, pst, pc, section);
if (p == NULL
|| (p->address (objfile)
- != BMSYMBOL_VALUE_ADDRESS (msymbol)))
+ != msymbol.value_address ()))
goto next;
}
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);
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
/* 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 (),
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);
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. */
if (!ms.minsym)
return PS_NOSYM;
- *ld_symbol_addr = BMSYMBOL_VALUE_ADDRESS (ms);
+ *ld_symbol_addr = ms.value_address ();
return PS_OK;
}
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;
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",
return 0;
}
- addr = BMSYMBOL_VALUE_ADDRESS (got_sym) + 8;
+ addr = got_sym.value_address () + 8;
if (solib_frv_debug)
gdb_printf (gdb_stdlog,
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. */
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;
{
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 (),
{
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 ());
{
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. */
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))
{
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;
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;
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;
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;
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:
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;
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 ());
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;
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 ());
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;
/* 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)
{
/* 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;
}
/* 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;
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
*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
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
*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
/* 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;
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;
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;
"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;
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;
&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);
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)
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;
}
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);
}
}
\f
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. */
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
{
else
{
prev = sym;
- sym = SYMBOL_VALUE_CHAIN (sym);
+ sym = sym->value_chain ();
}
}
}
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)
if (func)
{
- const struct block *b = SYMBOL_BLOCK_VALUE (func);
+ const struct block *b = func->value_block ();
struct block_iterator iter;
struct symbol *sym;
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
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;
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);
"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))
/* 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 ());
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",
{
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:
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));
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:
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));
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));
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
{
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:
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (sym->aclass () == LOC_STATIC
- && SYMBOL_VALUE_ADDRESS (sym) == addr)
+ && sym->value_address () == addr)
return sym;
}
}
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",
/* 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);
}
}
{
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;
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 ();
}
return;
objfile = msymbol.objfile;
- pc = BMSYMBOL_VALUE_ADDRESS (msymbol);
+ pc = msymbol.value_address ();
section = msymbol.minsym->obj_section (objfile);
name = msymbol.minsym->linkage_name ();
}
/* 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)))
{
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;
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)
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 (),
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 ()
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,
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 ();
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. */
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 ()]);
}
gdb::optional<hashval_t> hash
= gdb::optional<hashval_t> ());
+ 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
struct symbol *chain;
}
- value;
+ m_value;
/* Since one and only one language can apply, wrap the language specific
information inside a union. */
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
#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.
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. */
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)
#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"
\f
/* 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;
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;
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)
{
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",
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"
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)
{
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"
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
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. */
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 (),
{
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:
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. */
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. */
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;
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);
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
{
set_value_address (v,
gdbarch_convert_from_func_ptr_addr
- (gdbarch, BMSYMBOL_VALUE_ADDRESS (msym),
+ (gdbarch, msym.value_address (),
current_inferior ()->top_target ()));
}
++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));
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;
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;
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)
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: "
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);