aboutsummaryrefslogtreecommitdiff
path: root/gdb/alpha-tdep.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-06-02 16:17:54 +0000
committerRichard Henderson <rth@redhat.com>2003-06-02 16:17:54 +0000
commit0ede8ecaa06c0d3981bae4bd9015f19bcad25e79 (patch)
tree549b1c33fc1d666515e2505876544ff0cbe4903f /gdb/alpha-tdep.c
parent7b5e1cb37df34656476b693c53996ec158f92e39 (diff)
downloadgdb-0ede8ecaa06c0d3981bae4bd9015f19bcad25e79.zip
gdb-0ede8ecaa06c0d3981bae4bd9015f19bcad25e79.tar.gz
gdb-0ede8ecaa06c0d3981bae4bd9015f19bcad25e79.tar.bz2
* alpha-tdep.c (alpha_push_dummy_call): Handle ABI mandated
sign-extension of 32-bit values. (alpha_store_return_value): Similarly.
Diffstat (limited to 'gdb/alpha-tdep.c')
-rw-r--r--gdb/alpha-tdep.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index ff5fe7a..8dd2d0d 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -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;