diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-10 05:03:22 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-10 05:03:22 +0000 |
commit | 58e49e2178609318ec612ec400d76a24c86b7d6d (patch) | |
tree | 113fde38c427472a953a30e42497f5d408515b26 /gdb/values.c | |
parent | 34df79fc9d631a7cacdb2f9a9e12d5e3f8c6dd1c (diff) | |
download | gdb-58e49e2178609318ec612ec400d76a24c86b7d6d.zip gdb-58e49e2178609318ec612ec400d76a24c86b7d6d.tar.gz gdb-58e49e2178609318ec612ec400d76a24c86b7d6d.tar.bz2 |
* values.c, value.h (modify_field), callers: Make fieldval a LONGEST.
* h8300-tdep.c (NEXT_PROLOGUE_INSN): Make pword1 an INSN_WORD *
not short *.
* findvar.c, defs.h
({extract,store}_{signed_integer,unsigned_integer,address}):
New routines to replace SWAP_TARGET_AND_HOST.
All over: All uses of SWAP_TARGET_AND_HOST on integers replaced.
Diffstat (limited to 'gdb/values.c')
-rw-r--r-- | gdb/values.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gdb/values.c b/gdb/values.c index 60c3c08..f9296c6 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -436,7 +436,7 @@ set_internalvar_component (var, offset, bitpos, bitsize, newval) #endif if (bitsize) - modify_field (addr, (int) value_as_long (newval), + modify_field (addr, value_as_long (newval), bitpos, bitsize); else memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (VALUE_TYPE (newval))); @@ -1207,16 +1207,20 @@ unpack_field_as_long (type, valaddr, fieldno) void modify_field (addr, fieldval, bitpos, bitsize) char *addr; - int fieldval; + LONGEST fieldval; int bitpos, bitsize; { - long oword; + LONGEST oword; /* Reject values too big to fit in the field in question, otherwise adjoining fields may be corrupted. */ if (bitsize < (8 * sizeof (fieldval)) && 0 != (fieldval & ~((1<<bitsize)-1))) - error ("Value %d does not fit in %d bits.", fieldval, bitsize); + { + /* FIXME: would like to include fieldval in the message, but + we don't have a sprintf_longest. */ + error ("Value does not fit in %d bits.", bitsize); + } oword = extract_signed_integer (addr, sizeof oword); @@ -1225,11 +1229,11 @@ modify_field (addr, fieldval, bitpos, bitsize) bitpos = sizeof (oword) * 8 - bitpos - bitsize; #endif - /* Mask out old value, while avoiding shifts >= longword size */ + /* Mask out old value, while avoiding shifts >= size of oword */ if (bitsize < 8 * sizeof (oword)) - oword &= ~(((((unsigned long)1) << bitsize) - 1) << bitpos); + oword &= ~(((((unsigned LONGEST)1) << bitsize) - 1) << bitpos); else - oword &= ~((-1) << bitpos); + oword &= ~((~(unsigned LONGEST)0) << bitpos); oword |= fieldval << bitpos; store_signed_integer (addr, sizeof oword, oword); |