This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch: signal trampoline frame cache corruption (repost?)


This might be a repost.  

Attached is a patch to fix some signal trampoline frame cache corruption
that occurs on machines that have no FPU registers.  The corruption was
reported when running gdb 6.4 on a PowerPC 440.  If a backtrace command
was run after hitting a signal trampoline frame, the frame cache would
become corrupted and GDB would SIGSEGV.

I have checked the cvs head sources, and the code has moved, but has not
been fixed.  So I updated the patch to apply to cvs head.

Ok to commit?  (This is almost an obvious fix, isn't it?)


---
 gdb/ppc-linux-tdep.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

--- gdb-6.4.orig/gdb/ppc-linux-tdep.c
+++ gdb-6.4/gdb/ppc-linux-tdep.c
@@ -967,14 +967,16 @@ ppc_linux_sigtramp_cache (struct frame_i
   trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum,
 			   gpregs + 38 * tdep->wordsize);
 
-  /* Floating point registers.  */
-  for (i = 0; i < 32; i++)
-    {
-      int regnum = i + FP0_REGNUM;
-      trad_frame_set_reg_addr (this_cache, regnum, fpregs + i * tdep->wordsize);
-    }
-  trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
-			   fpregs + 32 * tdep->wordsize);
+  if (ppc_floating_point_unit_p(gdbarch)) {
+	  /* Floating point registers.  */
+	  for (i = 0; i < 32; i++)
+	  {
+		  int regnum = i + FP0_REGNUM;
+		  trad_frame_set_reg_addr (this_cache, regnum, fpregs + i * tdep->wordsize);
+	  }
+	  trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
+			  fpregs + 32 * tdep->wordsize);
+  }
   trad_frame_set_id (this_cache, frame_id_build (base, func));
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]