[commit] Fix missing backchain in dummy frames on spu

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[commit] Fix missing backchain in dummy frames on spu

Ulrich Weigand

spu_push_dummy_call neglected to store the stack back chain into the
dummy frame it allocates.  This violates the SPU ABI, and may cause
problems in some cases.  Fixed by the following patch.

Tested on spu-elf, committed to mainline.



        * spu-tdep.c (spu_push_dummy_call): Store stack back chain.

diff -urNp gdb-orig/gdb/spu-tdep.c gdb-head/gdb/spu-tdep.c
--- gdb-orig/gdb/spu-tdep.c 2007-06-01 21:16:09.552289469 +0200
+++ gdb-head/gdb/spu-tdep.c 2007-06-01 21:15:56.222081009 +0200
@@ -1013,6 +1013,10 @@ spu_push_dummy_call (struct gdbarch *gdb
   /* Allocate stack frame header.  */
   sp -= 32;
+  /* Store stack back chain.  */
+  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);
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  [hidden email]