This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

[PATCH] linux/ppc backtrace through signal handler fix


I've just committed the changes below to the sourceware repository. 
I've fixed the "can't backtrace through signal handler" bug, reorganized
config/powerpc/tm-linux.h a little bit (mostly by just including
config/tm-linux.h), and fixed some warnings in the ppc-linux-*.c files.

	* ppc-linux-nat.c (supply_gregset, supply_fpregset): Add return
	type.
	* ppc-linux-tdep.c (ppc_linux_at_sigtramp_return_path): Add
	forward declaration.

	* ppc-linux-tdep.c (ppc_linux_frame_saved_pc): Handle case
	where the next frame is a signal handler caller.

	* config/powerpc/tm-linux.h (PUSH_ARGUMENTS): Remove extraneous
	undef.
	(tm-linux.h): Include.
	(tm-sysv4.h): Don't include (directly).  config/tm-linux.h will
	include this file for us.
	(REALTIME_LO, REALTIME_HI): Don't define.  These are defined by
	config/tm-linux.h for us.
	(SOFUN_ADDRESS_MAYBE_MISSING): Define.

Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.1
diff -u -p -r1.1 ppc-linux-nat.c
--- ppc-linux-nat.c	2000/02/22 01:19:11	1.1
+++ ppc-linux-nat.c	2000/02/22 18:34:28
@@ -54,6 +54,7 @@ ppc_register_u_addr (int ustart, int reg
   return (ustart + 4 * regmap[regnum]);
 }
 
+void
 supply_gregset (gregset_t * gregsetp)
 {
   int regi;
@@ -66,6 +67,7 @@ supply_gregset (gregset_t * gregsetp)
     supply_register (regi, (char *) (regp + regmap[regi]));
 }
 
+void
 supply_fpregset (fpregset_t * fpregsetp)
 {
   int regi;
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 ppc-linux-tdep.c
--- ppc-linux-tdep.c	2000/02/22 01:19:11	1.1
+++ ppc-linux-tdep.c	2000/02/22 18:34:28
@@ -95,6 +95,8 @@
 #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
 #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
 
+int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc);
+
 /* Determine if pc is in a signal trampoline...
 
    Ha!  That's not what this does at all.  wait_for_inferior in infrun.c
@@ -312,12 +314,19 @@ ppc_linux_frame_saved_pc (struct frame_i
   if (fi->signal_handler_caller)
     {
       CORE_ADDR regs_addr =
-      read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
+	read_memory_integer (fi->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
       /* return the NIP in the regs array */
       return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_NIP, 4);
     }
-
-  return rs6000_frame_saved_pc (fi);
+  else if (fi->next && fi->next->signal_handler_caller)
+    {
+      CORE_ADDR regs_addr =
+	read_memory_integer (fi->next->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
+      /* return LNK in the regs array */
+      return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_LNK, 4);
+    }
+  else
+    return rs6000_frame_saved_pc (fi);
 }
 
 void
Index: config/powerpc/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/tm-linux.h,v
retrieving revision 1.1
diff -u -p -r1.1 tm-linux.h
--- tm-linux.h	2000/02/22 01:19:11	1.1
+++ tm-linux.h	2000/02/22 18:34:29
@@ -21,8 +21,9 @@ Foundation, Inc., 59 Temple Place - Suit
 #define TM_LINUX_H
 
 #include "powerpc/tm-ppc-eabi.h"
-
-#undef PUSH_ARGUMENTS
+/* Avoid warning from redefinition in tm-sysv4.h (included from tm-linux.h) */
+#undef SKIP_TRAMPOLINE_CODE
+#include "tm-linux.h"
 
 /* We can single step on linux */
 #undef  SOFTWARE_SINGLE_STEP
@@ -44,12 +45,6 @@ extern int at_subroutine_call_instructio
 /* Offset to saved PC in sigcontext, from <linux/signal.h>.  */
 #define SIGCONTEXT_PC_OFFSET 184
 
-/* Avoid warning from redefinition in tm-sysv4.h */
-#undef SKIP_TRAMPOLINE_CODE
-
-/* We need this file for the SOLIB_TRAMPOLINE stuff. */
-#include "tm-sysv4.h"
-
 extern CORE_ADDR ppc_linux_skip_trampoline_code (CORE_ADDR pc);
 #undef SKIP_TRAMPOLINE_CODE
 #define	SKIP_TRAMPOLINE_CODE(pc) ppc_linux_skip_trampoline_code (pc)
@@ -98,16 +93,8 @@ CORE_ADDR ppc_sysv_abi_push_arguments PA
 #define PROLOGUE_FIRSTLINE_OVERLAP
 #endif
 
-/* Some versions of Linux have real-time signal support in the C library, and
-   some don't.  We have to include this file to find out.  */
-#include <signal.h>
-
-#ifdef __SIGRTMIN
-#define REALTIME_LO __SIGRTMIN
-#define REALTIME_HI (__SIGRTMAX + 1)
-#else
-#define REALTIME_LO 32
-#define REALTIME_HI 64
-#endif
+/* N_FUN symbols in shared libaries have 0 for their values and need
+   to be relocated. */
+#define SOFUN_ADDRESS_MAYBE_MISSING
 
 #endif  /* #ifndef TM_LINUX_H */


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