* gdbarch.sh (value_from_register): New gdbarch function.

* gdbarch.c, gdbarch.h: Regenerate.
	* findvar.c (default_value_from_register): New function.
	(value_from_register): Use gdbarch_value_from_register.
	* value.h (default_value_from_register): Declare.
	* spu-tdep.c (spu_convert_register_p, spu_register_to_value,
	spu_value_to_register): Remove.
	(spu_value_from_register): New function.
	(spu_gdbarch_init): Do not call set_gdbarch_convert_register_p,
	set_gdbarch_register_to_value, set_gdbarch_value_to_register.
	Call set_gdbarch_value_from_register.
	* s390-tdep.c (s390_convert_register_p, s390_register_to_value,
	s390_value_to_register): Remove.
	(s390_value_from_register): New function.
	(s390_gdbarch_init): Do not call set_gdbarch_convert_register_p,
	set_gdbarch_register_to_value, set_gdbarch_value_to_register.
	Call set_gdbarch_value_from_register.
This commit is contained in:
Ulrich Weigand
2007-01-08 20:03:49 +00:00
parent f822c95b59
commit 9acbedc0c0
8 changed files with 121 additions and 79 deletions

View File

@@ -599,20 +599,44 @@ addresses have not been bound by the dynamic loader. Try again when executable i
return v;
}
/* Install default attributes for register values. */
struct value *
default_value_from_register (struct type *type, int regnum,
struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int len = TYPE_LENGTH (type);
struct value *value = allocate_value (type);
VALUE_LVAL (value) = lval_register;
VALUE_FRAME_ID (value) = get_frame_id (frame);
VALUE_REGNUM (value) = regnum;
/* Any structure stored in more than one register will always be
an integral number of registers. Otherwise, you need to do
some fiddling with the last register copied here for little
endian machines. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < register_size (gdbarch, regnum))
/* Big-endian, and we want less than full size. */
set_value_offset (value, register_size (gdbarch, regnum) - len);
else
set_value_offset (value, 0);
return value;
}
/* Return a value of type TYPE, stored in register REGNUM, in frame FRAME. */
struct value *
value_from_register (struct type *type, int regnum, struct frame_info *frame)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct value *v = allocate_value (type);
CHECK_TYPEDEF (type);
struct type *type1 = check_typedef (type);
struct value *v;
VALUE_LVAL (v) = lval_register;
VALUE_FRAME_ID (v) = get_frame_id (frame);
VALUE_REGNUM (v) = regnum;
if (CONVERT_REGISTER_P (regnum, type))
if (CONVERT_REGISTER_P (regnum, type1))
{
/* The ISA/ABI need to something weird when obtaining the
specified value from this register. It might need to
@@ -621,22 +645,18 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
the corresponding [integer] type (see Alpha). The assumption
is that REGISTER_TO_VALUE populates the entire value
including the location. */
REGISTER_TO_VALUE (frame, regnum, type, value_contents_raw (v));
v = allocate_value (type);
VALUE_LVAL (v) = lval_register;
VALUE_FRAME_ID (v) = get_frame_id (frame);
VALUE_REGNUM (v) = regnum;
REGISTER_TO_VALUE (frame, regnum, type1, value_contents_raw (v));
}
else
{
int len = TYPE_LENGTH (type);
/* Any structure stored in more than one register will always be
an integral number of registers. Otherwise, you need to do
some fiddling with the last register copied here for little
endian machines. */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
&& len < register_size (gdbarch, regnum))
/* Big-endian, and we want less than full size. */
set_value_offset (v, register_size (gdbarch, regnum) - len);
else
set_value_offset (v, 0);
/* Construct the value. */
v = gdbarch_value_from_register (gdbarch, type, regnum, frame);
/* Get the data. */
if (!get_frame_register_bytes (frame, regnum, value_offset (v), len,