* values.c, value.h (modify_field), callers: Make fieldval a LONGEST.
authorJim Kingdon <jkingdon@engr.sgi.com>
Sat, 10 Jul 1993 05:03:22 +0000 (05:03 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Sat, 10 Jul 1993 05:03:22 +0000 (05:03 +0000)
* 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.

gdb/ChangeLog
gdb/core.c
gdb/h8300-tdep.c
gdb/values.c

index c937f3723575723d02a85938a8bf7671c095c485..f384ee41f3a4f7bda3b73e8bbe56cd67611d0b5c 100644 (file)
@@ -1,5 +1,10 @@
 Fri Jul  9 12:36:46 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
+       * 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.
index 4c60fb7e04e3a26345b10588f00d7425cc6c598f..4ef24d39d20027306716d721943d4c83bc37a9e9 100644 (file)
@@ -214,9 +214,8 @@ read_memory_integer (memaddr, len)
      CORE_ADDR memaddr;
      int len;
 {
-  char *buf;
+  char buf[sizeof (LONGEST)];
 
-  buf = alloca (len);
   read_memory (memaddr, buf, len);
   return extract_signed_integer (buf, len);
 }
@@ -226,9 +225,8 @@ read_memory_unsigned_integer (memaddr, len)
      CORE_ADDR memaddr;
      int len;
 {
-  char *buf;
+  char buf[sizeof (unsigned LONGEST)];
 
-  buf = alloca (len);
   read_memory (memaddr, buf, len);
   return extract_unsigned_integer (buf, len);
 }
index 69a720d7c117337d62752bff7970fb4813660920..2ed8844b5737f00b852f49cccd796ae9350c85f9 100644 (file)
@@ -178,7 +178,7 @@ CORE_ADDR
 NEXT_PROLOGUE_INSN (addr, lim, pword1)
      CORE_ADDR addr;
      CORE_ADDR lim;
-     short *pword1;
+     INSN_WORD *pword1;
 {
   char buf[2];
   if (addr < lim + 8)
index 60c3c0804b77ff4e3402ee72e0a1eced495cb0f5..f9296c67057af1b3f12100b1264cf037dd573f0b 100644 (file)
@@ -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);
This page took 0.040687 seconds and 4 git commands to generate.