This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

[PATCH] OpenBSD/powerpc signal trampoline support


Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* ppcobsd-tdep.c: Update copyright year.  Include "trad-frame.h"
	and "tramp-frame.h".
	(ppcobsd_sigtramp_cache_init): New function.
	(ppcobsd_sigtramp): New variable.
	(ppcobsd_init_abi): Prepend signal trampoline unwinder.
	* Makefile.in (ppcobsd-tdep.o): Update dependencies.

Index: ppcobsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcobsd-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 ppcobsd-tdep.c
--- ppcobsd-tdep.c 31 Oct 2004 19:43:30 -0000 1.5
+++ ppcobsd-tdep.c 9 Apr 2005 11:37:30 -0000
@@ -1,6 +1,6 @@
 /* Target-dependent code for OpenBSD/powerpc.
 
-   Copyright 2004 Free Software Foundation, Inc.
+   Copyright 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,8 +24,10 @@
 #include "osabi.h"
 #include "regcache.h"
 #include "regset.h"
-#include "gdb_assert.h"
+#include "trad-frame.h"
+#include "tramp-frame.h"
 
+#include "gdb_assert.h"
 #include "gdb_string.h"
 
 #include "ppc-tdep.h"
@@ -111,6 +113,59 @@ ppcobsd_regset_from_core_section (struct
 }
 
 
+/* Signal trampolines.  */
+
+static void
+ppcobsd_sigtramp_cache_init (const struct tramp_frame *self,
+			     struct frame_info *next_frame,
+			     struct trad_frame_cache *this_cache,
+			     CORE_ADDR func)
+{
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  CORE_ADDR addr, base;
+  int i;
+
+  base = frame_unwind_register_unsigned (next_frame, SP_REGNUM);
+  addr = base + 0x18 + 2 * tdep->wordsize;
+  for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize)
+    {
+      int regnum = i + tdep->ppc_gp0_regnum;
+      trad_frame_set_reg_addr (this_cache, regnum, addr);
+    }
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum, addr);
+  addr += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum, addr);
+  addr += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum, addr);
+  addr += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr);
+  addr += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, PC_REGNUM, addr); /* SRR0? */
+  addr += tdep->wordsize;
+
+  /* Construct the frame ID using the function start.  */
+  trad_frame_set_id (this_cache, frame_id_build (base, func));
+}
+
+static const struct tramp_frame ppcobsd_sigtramp =
+{
+  SIGTRAMP_FRAME,
+  4,
+  {
+    { 0x3821fff0, -1 },		/* add r1,r1,-16 */
+    { 0x4e800021, -1 },		/* blrl */
+    { 0x38610018, -1 },		/* addi r3,r1,24 */
+    { 0x38000067, -1 },		/* li r0,103 */
+    { 0x44000002, -1 },		/* sc */
+    { 0x38000001, -1 },		/* li r0,1 */
+    { 0x44000002, -1 },		/* sc */
+    { TRAMP_SENTINEL_INSN, -1 }
+  },
+  ppcobsd_sigtramp_cache_init
+};
+
+
 static void
 ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -120,6 +175,8 @@ ppcobsd_init_abi (struct gdbarch_info in
 
   set_gdbarch_regset_from_core_section
     (gdbarch, ppcobsd_regset_from_core_section);
+
+  tramp_frame_prepend_unwinder (gdbarch, &ppcobsd_sigtramp);
 }
 
 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.710
diff -u -p -r1.710 Makefile.in
--- Makefile.in 31 Mar 2005 19:58:24 -0000 1.710
+++ Makefile.in 9 Apr 2005 11:37:33 -0000
@@ -2373,8 +2373,9 @@ ppcnbsd-tdep.o: ppcnbsd-tdep.c $(defs_h)
 ppcobsd-nat.o: ppcobsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
 	$(ppc_tdep_h) $(ppcobsd_tdep_h)
 ppcobsd-tdep.o: ppcobsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
-	$(regcache_h) $(regset_h) $(gdb_assert_h) $(gdb_string_h) \
-	$(ppc_tdep_h) $(ppcobsd_tdep_h) $(solib_svr4_h)
+	$(regcache_h) $(regset_h) $(trad_frame_h_ $(tramp_frame_h) \
+	$(gdb_assert_h) $(gdb_string_h) $(ppc_tdep_h) $(ppcobsd_tdep_h) \
+	$(solib_svr4_h)
 ppc-sysv-tdep.o: ppc-sysv-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(regcache_h) $(value_h) $(gdb_string_h) $(gdb_assert_h) \
 	$(ppc_tdep_h) $(target_h) $(objfiles_h) $(infcall_h)


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