summaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1993-11-02 21:51:10 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1993-11-02 21:51:10 +0000
commitad09cb2bd3ea991f862103ee802a7a93e7895909 (patch)
tree9cf8cf03811fb421fa7f561f13fa4254c9a5018c /gdb/valops.c
parentffd334ce820ff277e635f4a674b60776f0d633fd (diff)
downloadbinutils-gdb-ad09cb2bd3ea991f862103ee802a7a93e7895909.tar.gz
* findvar.c (value_of_register, value_from_register),
hppa-tdep.c (pa_print_fp_reg), infcmd.c (do_registers_info), valops.c (value_assign): Use REGISTER_CONVERT_TO_* only if REGISTER_CONVERTIBLE is defined, otherwise just copy the content. Pass desired type to REGISTER_CONVERT_TO_*. * config/m68k/tm-m68k.h, config/i960/tm-i960.h (REGISTER_CONVERT_*): Pass length of desired type to store/extract_floating. * config/i386/tm-arm.h, config/i386/tm-i386aix.h, config/i386/tm-sun386.h, config/i386/tm-symmetry.h, config/m88k/tm-m88k.h config/rs6000/tm-rs6000.h (REGISTER_CONVERT_*): Use extract_floating and store_floating with length of desired type. * config/m68k/tm-news.h (STORE,EXTRACT_RETURN_VALUE): Add type parameter to REGISTER_CONVERT_*. * config/a29k/tm-a29k.h, config/convex/tm-convex.h, config/gould/tm-np1.h, config/gould/tm-pn.h, config/h8300/tm-h8300.h, config/h8500/tm-h8500.h, config/i386/tm-i386v.h, config/mips/tm-mips.h, config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h, config/pa/tm-hppa.h, config/pyr/tm-pyr.h, config/sh/tm-sh.h, config/sparc/tm-sparc.h, config/tahoe/tm-tahoe.h, config/vax/tm-vax.h, config/z8k/tm-z8k.h (REGISTER_CONVERTIBLE, REGISTER_CONVERT_TO_RAW, REGISTER_CONVERT_TO_VIRTUAL): Remove versions for which REGISTER_CONVERTIBLE is always false. * z8k-tdep.c (register_convert_to_virtual, register_convert_to_raw): Remove, no longer used. * alpha-tdep.c (alpha_register_convert_to_raw, alpha_register_convert_to_virtual): New routines to handle the different raw formats in alpha floating point registers. * config/alpha/tm-alpha.h (REGISTER_CONVERTIBLE, REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW): Use them.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 7697266107b..ebddb5b90b4 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -286,7 +286,6 @@ value_assign (toval, fromval)
register struct type *type = VALUE_TYPE (toval);
register value val;
char raw_buffer[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
int use_buffer = 0;
COERCE_ARRAY (fromval);
@@ -300,17 +299,19 @@ value_assign (toval, fromval)
convert FROMVAL's contents now, with result in `raw_buffer',
and set USE_BUFFER to the number of bytes to write. */
+#ifdef REGISTER_CONVERTIBLE
if (VALUE_REGNO (toval) >= 0
&& REGISTER_CONVERTIBLE (VALUE_REGNO (toval)))
{
int regno = VALUE_REGNO (toval);
- if (VALUE_TYPE (fromval) != REGISTER_VIRTUAL_TYPE (regno))
- fromval = value_cast (REGISTER_VIRTUAL_TYPE (regno), fromval);
- memcpy (virtual_buffer, VALUE_CONTENTS (fromval),
- REGISTER_VIRTUAL_SIZE (regno));
- REGISTER_CONVERT_TO_RAW (regno, virtual_buffer, raw_buffer);
- use_buffer = REGISTER_RAW_SIZE (regno);
+ if (REGISTER_CONVERTIBLE (regno))
+ {
+ REGISTER_CONVERT_TO_RAW (VALUE_TYPE (fromval), regno,
+ VALUE_CONTENTS (fromval), raw_buffer);
+ use_buffer = REGISTER_RAW_SIZE (regno);
+ }
}
+#endif
switch (VALUE_LVAL (toval))
{
@@ -336,10 +337,10 @@ value_assign (toval, fromval)
+ VALUE_BITSIZE (toval)
+ HOST_CHAR_BIT - 1)
/ HOST_CHAR_BIT;
- /* If bigger than a LONGEST, we don't handle it correctly,
- but at least avoid corrupting memory. */
+
if (len > sizeof (LONGEST))
- len = sizeof (LONGEST);
+ error ("Can't handle bitfields which don't fit in a %d bit word.",
+ sizeof (LONGEST) * HOST_CHAR_BIT);
read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
buffer, len);
@@ -359,8 +360,20 @@ value_assign (toval, fromval)
case lval_register:
if (VALUE_BITSIZE (toval))
{
- char buffer[MAX_REGISTER_RAW_SIZE];
+ char buffer[sizeof (LONGEST)];
int len = REGISTER_RAW_SIZE (VALUE_REGNO (toval));
+
+ if (len > sizeof (LONGEST))
+ error ("Can't handle bitfields in registers larger than %d bits.",
+ sizeof (LONGEST) * HOST_CHAR_BIT);
+
+ if (VALUE_BITPOS (toval) + VALUE_BITSIZE (toval)
+ > len * HOST_CHAR_BIT)
+ /* Getting this right would involve being very careful about
+ byte order. */
+ error ("\
+Can't handle bitfield which doesn't fit in a single register.");
+
read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
buffer, len);
modify_field (buffer, value_as_long (fromval),
@@ -485,9 +498,6 @@ value_assign (toval, fromval)
type = VALUE_TYPE (fromval);
}
- /* FIXME: This loses if fromval is a different size than toval, for
- example because fromval got cast in the REGISTER_CONVERTIBLE case
- above. */
val = allocate_value (type);
memcpy (val, toval, VALUE_CONTENTS_RAW (val) - (char *) val);
memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),