aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2007-12-20 17:13:57 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2007-12-20 17:13:57 +0000
commit5863b5d5368ca1fb517ee065ab687d8ba2fde354 (patch)
tree4e573a01d8116be7d465ed99f8701d828f15561c
parent1e9836570f11422834da6ad9ccc49ce2fd121222 (diff)
downloadgdb-5863b5d5368ca1fb517ee065ab687d8ba2fde354.zip
gdb-5863b5d5368ca1fb517ee065ab687d8ba2fde354.tar.gz
gdb-5863b5d5368ca1fb517ee065ab687d8ba2fde354.tar.bz2
* mips-tdep.c (mips_n32n64_push_dummy_call): Sign-extend
integers and 32-bit pointers as required by the ABI.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/mips-tdep.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ce6e80d..3d56550 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-20 David Ung <davidu@mips.com>
+ Maciej W. Rozycki <macro@mips.com>
+
+ * mips-tdep.c (mips_n32n64_push_dummy_call): Sign-extend
+ integers and 32-bit pointers as required by the ABI.
+
2007-12-20 Joel Brobecker <brobecker@adacore.com>
* symtab.h: Remove "defs.h" #include.
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 193a21b..d4c8a3c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3184,8 +3184,21 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM)
{
- LONGEST regval =
- extract_unsigned_integer (val, partial_len);
+ LONGEST regval;
+
+ /* Sign extend pointers, 32-bit integers and signed
+ 16-bit and 8-bit integers; everything else is taken
+ as is. */
+
+ if ((partial_len == 4
+ && (typecode == TYPE_CODE_PTR
+ || typecode == TYPE_CODE_INT))
+ || (partial_len < 4
+ && typecode == TYPE_CODE_INT
+ && !TYPE_UNSIGNED (arg_type)))
+ regval = extract_signed_integer (val, partial_len);
+ else
+ regval = extract_unsigned_integer (val, partial_len);
/* A non-floating-point argument being passed in a
general register. If a struct or union, and if