* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / values.c
index 1eaef33254b361effc7514fe218abd7909ab6669..accb0d595801516018973cb15aea40c9da6b170d 100644 (file)
@@ -1,5 +1,6 @@
 /* Low level packing and unpacking of values for GDB, the GNU Debugger.
-   Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991, 1993, 1994
+   Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -27,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "command.h"
 #include "gdbcmd.h"
 #include "target.h"
+#include "language.h"
 #include "demangle.h"
 
 /* Local function prototypes. */
@@ -483,6 +485,7 @@ set_internalvar (var, val)
 #endif
 
   newval = value_copy (val);
+  newval->modifiable = 1;
 
   /* Force the value to be fetched from the target now, to avoid problems
      later when this internalvar is referenced and the target is gone or
@@ -674,11 +677,13 @@ unpack_double (type, valaddr, invp)
   *invp = 0;                   /* Assume valid.   */
   if (code == TYPE_CODE_FLT)
     {
+#ifdef INVALID_FLOAT
       if (INVALID_FLOAT (valaddr, len))
        {
          *invp = 1;
          return 1.234567891011121314;
        }
+#endif
       return extract_floating (valaddr, len);
     }
   else if (nosign)
@@ -1246,11 +1251,10 @@ unpack_field_as_long (type, valaddr, fieldno)
 
   /* Extract bits.  See comment above. */
 
-#if BITS_BIG_ENDIAN
-  lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
-#else
-  lsbcount = (bitpos % 8);
-#endif
+  if (BITS_BIG_ENDIAN)
+    lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
+  else
+    lsbcount = (bitpos % 8);
   val >>= lsbcount;
 
   /* If the field does not entirely fill a LONGEST, then zero the sign bits.
@@ -1297,9 +1301,8 @@ modify_field (addr, fieldval, bitpos, bitsize)
   oword = extract_signed_integer (addr, sizeof oword);
 
   /* Shifting for bit field depends on endianness of the target machine.  */
-#if BITS_BIG_ENDIAN
-  bitpos = sizeof (oword) * 8 - bitpos - bitsize;
-#endif
+  if (BITS_BIG_ENDIAN)
+    bitpos = sizeof (oword) * 8 - bitpos - bitsize;
 
   /* Mask out old value, while avoiding shifts >= size of oword */
   if (bitsize < 8 * sizeof (oword))
@@ -1465,8 +1468,6 @@ set_return_value (val)
      value_ptr val;
 {
   register enum type_code code = TYPE_CODE (VALUE_TYPE (val));
-  double dbuf;
-  LONGEST lbuf;
 
   if (code == TYPE_CODE_ERROR)
     error ("Function return type unknown.");
@@ -1475,19 +1476,7 @@ set_return_value (val)
       || code == TYPE_CODE_UNION)      /* FIXME, implement struct return.  */
     error ("GDB does not support specifying a struct or union return value.");
 
-  /* FIXME, this is bogus.  We don't know what the return conventions
-     are, or how values should be promoted.... */
-  if (code == TYPE_CODE_FLT)
-    {
-      dbuf = value_as_double (val);
-
-      STORE_RETURN_VALUE (VALUE_TYPE (val), (char *)&dbuf);
-    }
-  else
-    {
-      lbuf = value_as_long (val);
-      STORE_RETURN_VALUE (VALUE_TYPE (val), (char *)&lbuf);
-    }
+  STORE_RETURN_VALUE (VALUE_TYPE (val), VALUE_CONTENTS (val));
 }
 \f
 void
This page took 0.024881 seconds and 4 git commands to generate.