/* Find a variable's value in memory, for GDB, the GNU debugger.
- Copyright (C) 1986-2020 Free Software Foundation, Inc.
+ Copyright (C) 1986-2021 Free Software Foundation, Inc.
This file is part of GDB.
_("extract_typed_address: "
"type is not a pointer or reference"));
- return gdbarch_pointer_to_address (get_type_arch (type), type, buf);
+ return gdbarch_pointer_to_address (type->arch (), type, buf);
}
/* All 'store' functions accept a host-format integer and store a
_("store_typed_address: "
"type is not a pointer or reference"));
- gdbarch_address_to_pointer (get_type_arch (type), type, buf, addr);
+ gdbarch_address_to_pointer (type->arch (), type, buf, addr);
}
/* Copy a value from SOURCE of size SOURCE_SIZE bytes to DEST of size DEST_SIZE
switch (SYMBOL_CLASS (sym))
{
/* All cases listed explicitly so that gcc -Wall will detect it if
- we failed to consider one. */
+ we failed to consider one. */
case LOC_COMPUTED:
gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
case LOC_LABEL:
/* Getting the address of a label can be done independently of the block,
- even if some *uses* of that address wouldn't work so well without
- the right frame. */
+ even if some *uses* of that address wouldn't work so well without
+ the right frame. */
case LOC_BLOCK:
case LOC_CONST_BYTES:
sym_need = symbol_read_needs (var);
if (sym_need == SYMBOL_NEEDS_FRAME)
gdb_assert (frame != NULL);
- else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers)
+ else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers ())
error (_("Cannot read `%s' without registers"), var->print_name ());
if (frame != NULL)
v = allocate_value (type);
if (overlay_debugging)
{
- addr
- = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
- SYMBOL_OBJ_SECTION (symbol_objfile (var),
- var));
-
+ struct objfile *var_objfile = symbol_objfile (var);
+ addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+ var->obj_section (var_objfile));
store_typed_address (value_contents_raw (v), type, addr);
}
else
case LOC_STATIC:
if (overlay_debugging)
- addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
- SYMBOL_OBJ_SECTION (symbol_objfile (var),
- var));
+ addr
+ = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+ var->obj_section (symbol_objfile (var)));
else
addr = SYMBOL_VALUE_ADDRESS (var);
break;
if (overlay_debugging)
addr = symbol_overlayed_address
(BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var)),
- SYMBOL_OBJ_SECTION (symbol_objfile (var), var));
+ var->obj_section (symbol_objfile (var)));
else
addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (var));
break;
if (regval == NULL)
error (_("Value of register variable not available for `%s'."),
- var->print_name ());
+ var->print_name ());
addr = value_as_address (regval);
}
if (regval == NULL)
error (_("Value of register variable not available for `%s'."),
- var->print_name ());
+ var->print_name ());
return regval;
}
}
error (_("Missing %s symbol \"%s\"."),
flavour_name, var->linkage_name ());
}
- obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym);
+ obj_section = msym->obj_section (lookup_data.result.objfile);
/* Relocate address, unless there is no section or the variable is
a TLS variable. */
if (obj_section == NULL
struct value *
default_value_from_register (struct gdbarch *gdbarch, struct type *type,
- int regnum, struct frame_id frame_id)
+ int regnum, struct frame_id frame_id)
{
int len = TYPE_LENGTH (type);
struct value *value = allocate_value (type);
int reg_len = type_length_units (value_type (regval)) - reg_offset;
/* If the register length is larger than the number of bytes
- remaining to copy, then only copy the appropriate bytes. */
+ remaining to copy, then only copy the appropriate bytes. */
if (reg_len > len)
reg_len = len;
int optim, unavail, ok;
/* The ISA/ABI need to something weird when obtaining the
- specified value from this register. It might need to
- re-order non-adjacent, starting with REGNUM (see MIPS and
- i386). It might need to convert the [float] register into
- the corresponding [integer] type (see Alpha). The assumption
- is that gdbarch_register_to_value populates the entire value
- including the location. */
+ specified value from this register. It might need to
+ re-order non-adjacent, starting with REGNUM (see MIPS and
+ i386). It might need to convert the [float] register into
+ the corresponding [integer] type (see Alpha). The assumption
+ is that gdbarch_register_to_value populates the entire value
+ including the location. */
v = allocate_value (type);
VALUE_LVAL (v) = lval_register;
VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));