reg_val = allocate_value (register_type (current_gdbarch, regnum));
- /* Convert raw data to virtual format if necessary. */
-
- if (DEPRECATED_REGISTER_CONVERTIBLE (regnum))
- {
- DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, register_type (current_gdbarch, regnum),
- raw_buffer, VALUE_CONTENTS_RAW (reg_val));
- }
- else if (DEPRECATED_REGISTER_RAW_SIZE (regnum) == DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum))
- memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
- DEPRECATED_REGISTER_RAW_SIZE (regnum));
- else
- internal_error (__FILE__, __LINE__,
- "Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
- REGISTER_NAME (regnum),
- regnum,
- DEPRECATED_REGISTER_RAW_SIZE (regnum),
- DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
+ memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
+ register_size (current_gdbarch, regnum));
VALUE_LVAL (reg_val) = lval;
VALUE_ADDRESS (reg_val) = addr;
- VALUE_REGNO (reg_val) = regnum;
+ VALUE_REGNUM (reg_val) = regnum;
VALUE_OPTIMIZED_OUT (reg_val) = optim;
+ VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
return reg_val;
}
v = allocate_value (type);
VALUE_LVAL (v) = lval_memory; /* The most likely possibility. */
- VALUE_BFD_SECTION (v) = SYMBOL_BFD_SECTION (var);
len = TYPE_LENGTH (type);
addresses have not been bound by the dynamic loader. Try again when executable is running.");
locaddr = SYMBOL_VALUE_ADDRESS (var);
- loc = value_at (lookup_pointer_type (type), locaddr, NULL);
+ loc = value_at (lookup_pointer_type (type), locaddr);
addr = value_as_address (loc);
}
if (!argref)
return 0;
argref += SYMBOL_VALUE (var);
- ref = value_at (lookup_pointer_type (type), argref, NULL);
+ ref = value_at (lookup_pointer_type (type), argref);
addr = value_as_address (ref);
break;
}
struct value *v = allocate_value (type);
CHECK_TYPEDEF (type);
- if (CONVERT_REGISTER_P (regnum, type))
+ if (TYPE_LENGTH (type) == 0)
+ {
+ /* It doesn't matter much what we return for this: since the
+ length is zero, it could be anything. But if allowed to see
+ a zero-length type, the register-finding loop below will set
+ neither mem_stor nor reg_stor, and then report an internal
+ error.
+
+ Zero-length types can legitimately arise from declarations
+ like 'struct {}' (a GCC extension, not valid ISO C). GDB may
+ also create them when it finds bogus debugging information;
+ for example, in GCC 2.95.4 and binutils 2.11.93.0.2, the
+ STABS BINCL->EXCL compression process can create bad type
+ numbers. GDB reads these as TYPE_CODE_UNDEF types, with zero
+ length. (That bug is actually the only known way to get a
+ zero-length value allocated to a register --- which is what
+ it takes to make it here.)
+
+ We'll just attribute the value to the original register. */
+ VALUE_LVAL (v) = lval_register;
+ VALUE_ADDRESS (v) = regnum;
+ VALUE_REGNUM (v) = regnum;
+ }
+ else if (CONVERT_REGISTER_P (regnum, type))
{
/* The ISA/ABI need to something weird when obtaining the
specified value from this register. It might need to
is that REGISTER_TO_VALUE populates the entire value
including the location. */
REGISTER_TO_VALUE (frame, regnum, type, VALUE_CONTENTS_RAW (v));
- VALUE_LVAL (v) = lval_reg_frame_relative;
+ VALUE_LVAL (v) = lval_register;
VALUE_FRAME_ID (v) = get_frame_id (frame);
- VALUE_FRAME_REGNUM (v) = regnum;
+ VALUE_REGNUM (v) = regnum;
}
else
{
/* Copy all of the data out, whereever it may be. */
for (local_regnum = regnum, value_bytes_copied = 0;
value_bytes_copied < len;
- (value_bytes_copied += DEPRECATED_REGISTER_RAW_SIZE (local_regnum),
+ (value_bytes_copied += register_size (current_gdbarch, local_regnum),
++local_regnum))
{
int realnum;
{
mem_stor++;
+ /* FIXME: cagney/2004-11-12: I think this is trying to
+ check that the stored registers are adjacent in
+ memory. It isn't doing a good job? */
mem_tracking = (mem_tracking
&& (regnum == local_regnum
|| addr == last_addr));
last_addr = addr;
}
- /* FIXME: cagney/2003-06-04: Shouldn't this always use
- lval_reg_frame_relative? If it doesn't and the register's
- location changes (say after a resume) then this value is
- going to have wrong information. */
- if ((reg_stor && mem_stor)
- || (mem_stor && !mem_tracking))
- /* Mixed storage; all of the hassle we just went through was
- for some good purpose. */
- {
- VALUE_LVAL (v) = lval_reg_frame_relative;
- VALUE_FRAME_ID (v) = get_frame_id (frame);
- VALUE_FRAME_REGNUM (v) = regnum;
- }
- else if (mem_stor)
+ if (mem_tracking && mem_stor && !reg_stor)
{
VALUE_LVAL (v) = lval_memory;
VALUE_ADDRESS (v) = first_addr;
}
- else if (reg_stor)
+ else
{
VALUE_LVAL (v) = lval_register;
- VALUE_ADDRESS (v) = first_addr;
- VALUE_REGNO (v) = first_realnum;
+ VALUE_FRAME_ID (v) = get_frame_id (frame);
+ VALUE_REGNUM (v) = regnum;
}
- else
- internal_error (__FILE__, __LINE__,
- "value_from_register: Value not stored anywhere!");
VALUE_OPTIMIZED_OUT (v) = optimized;
some fiddling with the last register copied here for little
endian machines. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
- && len < DEPRECATED_REGISTER_RAW_SIZE (regnum))
+ && len < register_size (current_gdbarch, regnum))
/* Big-endian, and we want less than full size. */
- VALUE_OFFSET (v) = DEPRECATED_REGISTER_RAW_SIZE (regnum) - len;
+ v->offset = register_size (current_gdbarch, regnum) - len;
else
- VALUE_OFFSET (v) = 0;
- memcpy (VALUE_CONTENTS_RAW (v), value_bytes + VALUE_OFFSET (v), len);
+ v->offset = 0;
+ memcpy (VALUE_CONTENTS_RAW (v), value_bytes + value_offset (v), len);
}
return v;
}
addr = VALUE_ADDRESS (lazy_value);
val = value_from_pointer (lookup_pointer_type (type), addr);
- VALUE_BFD_SECTION (val) = VALUE_BFD_SECTION (lazy_value);
return val;
}
switch (VALUE_LVAL (lazy_value))
{
case lval_register:
- gdb_assert (REGISTER_NAME (VALUE_REGNO (lazy_value)) != NULL
- && *REGISTER_NAME (VALUE_REGNO (lazy_value)) != '\0');
+ gdb_assert (REGISTER_NAME (VALUE_REGNUM (lazy_value)) != NULL
+ && *REGISTER_NAME (VALUE_REGNUM (lazy_value)) != '\0');
error("Address requested for identifier "
"\"%s\" which is in register $%s",
SYMBOL_PRINT_NAME (var),
- REGISTER_NAME (VALUE_REGNO (lazy_value)));
- break;
-
- case lval_reg_frame_relative:
- gdb_assert (REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)) != NULL
- && *REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)) != '\0');
- error("Address requested for identifier "
- "\"%s\" which is in frame register $%s",
- SYMBOL_PRINT_NAME (var),
- REGISTER_NAME (VALUE_FRAME_REGNUM (lazy_value)));
+ REGISTER_NAME (VALUE_REGNUM (lazy_value)));
break;
default: