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]

Re: [PATCH] Add sparc64-linux sigtramp support


   Date: Thu, 21 Apr 2005 12:22:50 -0700
   From: "David S. Miller" <davem@davemloft.net>

   Sure, I'll fix this all up.  Thanks for reviewing.  I'd like to convert
   this stuff over to the cleaner infrastructure PPC and MIPS linux targets
   use, it might mean ditching the solaris tdep sharing though since they
   sniff the sigtramps slightly differently.  It's kind of weird that we
   let the solaris code register it's sniffer in the chain on linux targets
   even though the linux sniffer is registered such that it trumps the solaris
   one.

It'd be great if you could convert things to use the tramp_frame
stuff.  Should be doable for SPARC/UltraSPARC Linux without too much
effort, and simplify the code a bit.

The Solaris sniffer shouldn't really hurt the Linux stuff.  But I
guess it makes sense now, to copy the SVR4-style shared library stuff
into sparcxx_linux_init_abi() and remove the call to
sparcxx_sol2_init_abi().  I'll make that change.

   > P.S. I'm close to enabling the DWARF2 unwinder for SPARC, but there
   > still are a few issues that I have to solve yet.  None of these affect
   > Linux/sparc64.  I can send you a patch to test if you want.

   Funny, I started playing around with the DWARF2 unwinder last night
   as well on Sparc.  It interacted badly with the signal trampoline
   sniffers but otherwise mostly worked, and that's as far as I got before
   I went to bed.

   Please send me your test patch and what issues you are aware of, I can
   likely work on fixing them today/tonight.


The attached patch was what I was thinking about.  If it has issues
with signal handlers, take a look at
i386-linux-tdep.c:i386_linux_dwarf_signale_p(), That might help in the
case DWARF2 CFI for the signal trampoline is provided.

Mark


Index: sparc64-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 sparc64-linux-tdep.c
--- sparc64-linux-tdep.c 21 Apr 2005 19:38:20 -0000 1.5
+++ sparc64-linux-tdep.c 21 Apr 2005 21:06:47 -0000
@@ -206,6 +206,7 @@ sparc64_linux_init_abi (struct gdbarch_i
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
   frame_unwind_append_sniffer (gdbarch, sparc64_linux_sigtramp_frame_sniffer);
 
   /* GNU/Linux is very similar to Solaris ...  */
Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.21
diff -u -p -r1.21 sparc64-tdep.c
--- sparc64-tdep.c 28 Mar 2005 13:42:49 -0000 1.21
+++ sparc64-tdep.c 21 Apr 2005 21:06:48 -0000
@@ -21,6 +21,7 @@
 
 #include "defs.h"
 #include "arch-utils.h"
+#include "dwarf2-frame.h"
 #include "floatformat.h"
 #include "frame.h"
 #include "frame-base.h"
@@ -1103,6 +1104,26 @@ sparc64_return_value (struct gdbarch *gd
 }
 
 
+static void
+sparc64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
+			       struct dwarf2_frame_state_reg *reg)
+{
+  switch (regnum)
+    {
+    case SPARC_SP_REGNUM:
+      reg->how = DWARF2_FRAME_REG_CFA;
+      break;
+    case SPARC64_PC_REGNUM:
+      reg->how = DWARF2_FRAME_REG_RA_OFFSET;
+      reg->loc.offset = 8;
+      break;
+    case SPARC64_NPC_REGNUM:
+      reg->how = DWARF2_FRAME_REG_RA_OFFSET;
+      reg->loc.offset = 12;
+      break;
+    }
+}
+
 void
 sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -1137,6 +1158,12 @@ sparc64_init_abi (struct gdbarch_info in
 
   set_gdbarch_skip_prologue (gdbarch, sparc64_skip_prologue);
 
+  /* Hook in the DWARF CFI frame unwinder.  */
+  dwarf2_frame_set_init_reg (gdbarch, sparc64_dwarf2_frame_init_reg);
+#if notyet
+  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+#endif
+
   frame_unwind_append_sniffer (gdbarch, sparc64_frame_sniffer);
   frame_base_set_default (gdbarch, &sparc64_frame_base);
 }



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