Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/ppcnbsd] Signal trampoline unwinder
@ 2004-03-31 23:18 Andrew Cagney
  2004-04-22 20:51 ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2004-03-31 23:18 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 46 bytes --]

Current more-up-to-date version.  Ok?

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 3269 bytes --]

2004-03-31  Andrew Cagney  <cagney@redhat.com>

	* ppcnbsd-tdep.c: Update copyright.  Include "tramp-frame.h" and
	"trad-frame.h".
	(ppcnbsd_sigtramp_cache_init, ppcnbsd_sigtramp): Implement a NetBSD
	signal trampoline unwinder.
	(ppcnbsd_init_abi): Register ppcnbsd_sigtramp.

Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.12
diff -u -r1.12 ppcnbsd-tdep.c
--- ppcnbsd-tdep.c	23 Mar 2004 14:47:56 -0000	1.12
+++ ppcnbsd-tdep.c	31 Mar 2004 22:57:12 -0000
@@ -1,5 +1,7 @@
 /* Target-dependent code for PowerPC systems running NetBSD.
-   Copyright 2002, 2003 Free Software Foundation, Inc.
+
+   Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -30,6 +32,8 @@
 #include "ppc-tdep.h"
 #include "ppcnbsd-tdep.h"
 #include "nbsd-tdep.h"
+#include "tramp-frame.h"
+#include "trad-frame.h"
 
 #include "solib-svr4.h"
 
@@ -228,6 +232,59 @@
 }
 
 static void
+ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
+			     struct frame_info *next_frame,
+			     struct trad_frame_cache *this_cache,
+			     CORE_ADDR func)
+{
+  CORE_ADDR base;
+  CORE_ADDR offset;
+  int i;
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  base = frame_unwind_register_unsigned (next_frame, SP_REGNUM);
+  offset = base + 0x18 + 2 * tdep->wordsize;
+  for (i = 0; i < 32; i++)
+    {
+      int regnum = i + tdep->ppc_gp0_regnum;
+      trad_frame_set_reg_addr (this_cache, regnum, offset);
+      offset += tdep->wordsize;
+    }
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, PC_REGNUM, offset); /* SRR0? */
+  offset += tdep->wordsize;
+
+  /* Construct the frame ID using the function start.  */
+  trad_frame_set_id (this_cache, frame_id_build (base, func));
+}
+
+/* Given the NEXT frame, examine the instructions at and around this
+   frame's resume address (aka PC) to see of they look like a signal
+   trampoline.  Return the address of the trampolines first
+   instruction, or zero if it isn't a signal trampoline.  */
+
+static const struct tramp_frame ppcnbsd_sigtramp = {
+  4, /* insn size */
+  { /* insn */
+    0x38610018, /* addi r3,r1,24 */
+    0x38000127, /* li r0,295 */
+    0x44000002, /* sc */
+    0x38000001, /* li r0,1 */
+    0x44000002, /* sc */
+    TRAMP_SENTINEL_INSN
+  },
+  ppcnbsd_sigtramp_cache_init
+};
+
+static void
 ppcnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
 {
@@ -237,6 +294,7 @@
   set_gdbarch_return_value (gdbarch, ppcnbsd_return_value);
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
+  tramp_frame_append (gdbarch, &ppcnbsd_sigtramp);
 }
 
 void

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa/ppcnbsd] Signal trampoline unwinder
  2004-03-31 23:18 [rfa/ppcnbsd] Signal trampoline unwinder Andrew Cagney
@ 2004-04-22 20:51 ` Andrew Cagney
  2004-04-22 20:58   ` Jason Thorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2004-04-22 20:51 UTC (permalink / raw)
  To: Jason R Thorpe; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

ping

[-- Attachment #2: Attached Message --]
[-- Type: message/rfc822, Size: 6276 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 46 bytes --]

Current more-up-to-date version.  Ok?

Andrew

[-- Attachment #2.1.2: diffs --]
[-- Type: text/plain, Size: 3269 bytes --]

2004-03-31  Andrew Cagney  <cagney@redhat.com>

	* ppcnbsd-tdep.c: Update copyright.  Include "tramp-frame.h" and
	"trad-frame.h".
	(ppcnbsd_sigtramp_cache_init, ppcnbsd_sigtramp): Implement a NetBSD
	signal trampoline unwinder.
	(ppcnbsd_init_abi): Register ppcnbsd_sigtramp.

Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.12
diff -u -r1.12 ppcnbsd-tdep.c
--- ppcnbsd-tdep.c	23 Mar 2004 14:47:56 -0000	1.12
+++ ppcnbsd-tdep.c	31 Mar 2004 22:57:12 -0000
@@ -1,5 +1,7 @@
 /* Target-dependent code for PowerPC systems running NetBSD.
-   Copyright 2002, 2003 Free Software Foundation, Inc.
+
+   Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+
    Contributed by Wasabi Systems, Inc.
 
    This file is part of GDB.
@@ -30,6 +32,8 @@
 #include "ppc-tdep.h"
 #include "ppcnbsd-tdep.h"
 #include "nbsd-tdep.h"
+#include "tramp-frame.h"
+#include "trad-frame.h"
 
 #include "solib-svr4.h"
 
@@ -228,6 +232,59 @@
 }
 
 static void
+ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
+			     struct frame_info *next_frame,
+			     struct trad_frame_cache *this_cache,
+			     CORE_ADDR func)
+{
+  CORE_ADDR base;
+  CORE_ADDR offset;
+  int i;
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  base = frame_unwind_register_unsigned (next_frame, SP_REGNUM);
+  offset = base + 0x18 + 2 * tdep->wordsize;
+  for (i = 0; i < 32; i++)
+    {
+      int regnum = i + tdep->ppc_gp0_regnum;
+      trad_frame_set_reg_addr (this_cache, regnum, offset);
+      offset += tdep->wordsize;
+    }
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, offset);
+  offset += tdep->wordsize;
+  trad_frame_set_reg_addr (this_cache, PC_REGNUM, offset); /* SRR0? */
+  offset += tdep->wordsize;
+
+  /* Construct the frame ID using the function start.  */
+  trad_frame_set_id (this_cache, frame_id_build (base, func));
+}
+
+/* Given the NEXT frame, examine the instructions at and around this
+   frame's resume address (aka PC) to see of they look like a signal
+   trampoline.  Return the address of the trampolines first
+   instruction, or zero if it isn't a signal trampoline.  */
+
+static const struct tramp_frame ppcnbsd_sigtramp = {
+  4, /* insn size */
+  { /* insn */
+    0x38610018, /* addi r3,r1,24 */
+    0x38000127, /* li r0,295 */
+    0x44000002, /* sc */
+    0x38000001, /* li r0,1 */
+    0x44000002, /* sc */
+    TRAMP_SENTINEL_INSN
+  },
+  ppcnbsd_sigtramp_cache_init
+};
+
+static void
 ppcnbsd_init_abi (struct gdbarch_info info,
                   struct gdbarch *gdbarch)
 {
@@ -237,6 +294,7 @@
   set_gdbarch_return_value (gdbarch, ppcnbsd_return_value);
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                 nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
+  tramp_frame_append (gdbarch, &ppcnbsd_sigtramp);
 }
 
 void

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa/ppcnbsd] Signal trampoline unwinder
  2004-04-22 20:51 ` Andrew Cagney
@ 2004-04-22 20:58   ` Jason Thorpe
  2004-04-22 21:43     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Thorpe @ 2004-04-22 20:58 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]


On Apr 22, 2004, at 1:50 PM, Andrew Cagney wrote:

> ping

Sorry for the delay.  I guess I get more email than I can keep up with.

Anyway, the change looks fine to me.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa/ppcnbsd] Signal trampoline unwinder
  2004-04-22 20:58   ` Jason Thorpe
@ 2004-04-22 21:43     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2004-04-22 21:43 UTC (permalink / raw)
  To: Jason Thorpe; +Cc: gdb-patches

> 
> On Apr 22, 2004, at 1:50 PM, Andrew Cagney wrote:
> 
>> ping
> 
> 
> Sorry for the delay.  I guess I get more email than I can keep up with.
> 
> Anyway, the change looks fine to me.

Thanks, committed.  Now about the ns32k (MarkK updated the vax), got one 
I could borrow :-)

Andrew



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-22 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-31 23:18 [rfa/ppcnbsd] Signal trampoline unwinder Andrew Cagney
2004-04-22 20:51 ` Andrew Cagney
2004-04-22 20:58   ` Jason Thorpe
2004-04-22 21:43     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox