* spu-tdep.c (spu_push_dummy_call): Update all stack pointer slots
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 3 Sep 2008 21:27:05 +0000 (21:27 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Wed, 3 Sep 2008 21:27:05 +0000 (21:27 +0000)
when allocating stack frame for inferior call.

gdb/ChangeLog
gdb/spu-tdep.c

index a52ce2ec2ac11eb19deaf8f1f571fa86be651e4a..856fed0895ee06cd76db05552ca35c71bcd81ce7 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-03  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * spu-tdep.c (spu_push_dummy_call): Update all stack pointer slots
+       when allocating stack frame for inferior call.
+
 2008-09-03  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * spu-tdep.c (spu_frame_unwind_cache): Do not attempt to unwind
index b016d4ba79e65493e91fbfda6378616ffbdbabfe..8ebaf04a586e4edae2dac958847d95287395f2ef 100644 (file)
@@ -1107,6 +1107,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                     int nargs, struct value **args, CORE_ADDR sp,
                     int struct_return, CORE_ADDR struct_addr)
 {
+  CORE_ADDR sp_delta;
   int i;
   int regnum = SPU_ARG1_REGNUM;
   int stack_arg = -1;
@@ -1186,8 +1187,14 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   regcache_cooked_read (regcache, SPU_RAW_SP_REGNUM, buf);
   target_write_memory (sp, buf, 16);
 
-  /* Finally, update the SP register.  */
-  regcache_cooked_write_unsigned (regcache, SPU_SP_REGNUM, sp);
+  /* Finally, update all slots of the SP register.  */
+  sp_delta = sp - extract_unsigned_integer (buf, 4);
+  for (i = 0; i < 4; i++)
+    {
+      CORE_ADDR sp_slot = extract_unsigned_integer (buf + 4*i, 4);
+      store_unsigned_integer (buf + 4*i, 4, sp_slot + sp_delta);
+    }
+  regcache_cooked_write (regcache, SPU_RAW_SP_REGNUM, buf);
 
   return sp;
 }
This page took 0.031465 seconds and 4 git commands to generate.