* alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated
authorRichard Henderson <rth@redhat.com>
Mon, 2 Jun 2003 16:17:54 +0000 (16:17 +0000)
committerRichard Henderson <rth@redhat.com>
Mon, 2 Jun 2003 16:17:54 +0000 (16:17 +0000)
        sign-extension of 32-bit values.
        (alpha_store_return_value): Similarly.

gdb/ChangeLog
gdb/alpha-tdep.c

index 2f337d9ff3ed5305eb2a1f6e7071aaaaf2d78dfd..886ffae8d092de02939dfda35041e35b842bfc69 100644 (file)
@@ -1,5 +1,9 @@
 2003-06-02  Richard Henderson  <rth@redhat.com>
 
+        * alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated 
+        sign-extension of 32-bit values.
+        (alpha_store_return_value): Similarly.
+
         * alpha-tdep.c (alpha_push_dummy_call): Handle COMPLEX types.
         (alpha_extract_return_value): Likewise.
         (alpha_store_return_value): Likewise.
index ff5fe7a6c1e5aeee8e989a1ba136f5357dca0157..8dd2d0d49c05699f9874b98a2479fc90b6605c03 100644 (file)
@@ -276,9 +276,16 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
        case TYPE_CODE_CHAR:
        case TYPE_CODE_RANGE:
        case TYPE_CODE_ENUM:
-         if (TYPE_LENGTH (arg_type) < TYPE_LENGTH (builtin_type_long))
+         if (TYPE_LENGTH (arg_type) == 4)
            {
-             arg_type = builtin_type_long;
+             /* 32-bit values must be sign-extended to 64 bits
+                even if the base data type is unsigned.  */
+             arg_type = builtin_type_int32;
+             arg = value_cast (arg_type, arg);
+           }
+         if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE)
+           {
+             arg_type = builtin_type_int64;
              arg = value_cast (arg_type, arg);
            }
          break;
@@ -541,6 +548,10 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
 
     default:
       /* Assume everything else degenerates to an integer.  */
+      /* 32-bit values must be sign-extended to 64 bits
+        even if the base data type is unsigned.  */
+      if (length == 4)
+       valtype = builtin_type_int32;
       l = unpack_long (valtype, valbuf);
       regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
       break;