Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: davem@davemloft.net
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Add sparc64-linux sigtramp support
Date: Thu, 21 Apr 2005 21:20:00 -0000	[thread overview]
Message-ID: <200504212120.j3LLKB42010991@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <20050421122250.6108168c.davem@davemloft.net>

   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
 }
 \f
 
+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);
 }



  reply	other threads:[~2005-04-21 21:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21  3:51 David S. Miller
2005-04-21 19:23 ` Mark Kettenis
2005-04-21 19:29   ` David S. Miller
2005-04-21 21:20     ` Mark Kettenis [this message]
2005-04-21 21:41       ` David S. Miller
2005-04-21 21:57         ` Mark Kettenis
2005-04-21 22:04           ` David S. Miller
2005-04-21 21:55       ` David S. Miller
2005-04-21 22:09         ` Mark Kettenis
2005-04-22 22:45           ` David S. Miller
2005-04-23 12:33             ` Mark Kettenis
2005-04-23 17:47               ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200504212120.j3LLKB42010991@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=davem@davemloft.net \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox