Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Samuel Bronson <naesten@gmail.com>
To: gdb-patches@sourceware.org
Cc: Samuel Bronson <naesten@gmail.com>
Subject: [PATCH 1/2] Add an undwinder_name field to "struct frame_unwind" for use by "info frame".
Date: Fri, 29 May 2009 23:09:00 -0000	[thread overview]
Message-ID: <1243638987-4533-1-git-send-email-naesten@gmail.com> (raw)

Have "info frame" display this field when present.

Fill in the field for unwinders (besides the sentinel) which are
normally built on i386 Linux.

Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 gdb/dummy-frame.c  |    2 ++
 gdb/dwarf2-frame.c |    8 ++++++--
 gdb/frame-unwind.h |    1 +
 gdb/frame.c        |    7 +++++++
 gdb/frame.h        |    3 +++
 gdb/i386-tdep.c    |    8 ++++++--
 gdb/stack.c        |   10 +++++++++-
 gdb/tramp-frame.c  |    1 +
 8 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 6e63686..59990c1 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -278,6 +278,8 @@ static const struct frame_unwind dummy_frame_unwinder =
   dummy_frame_prev_register,
   NULL,
   dummy_frame_sniffer,
+  NULL,
+  "dummy_frame_unwinder",
 };
 
 const struct frame_unwind *const dummy_frame_unwind = {
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index ce11d89..c90bd08 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1183,7 +1183,9 @@ static const struct frame_unwind dwarf2_frame_unwind =
   dwarf2_frame_this_id,
   dwarf2_frame_prev_register,
   NULL,
-  dwarf2_frame_sniffer
+  dwarf2_frame_sniffer,
+  NULL,
+  "dwarf2_frame_unwind",
 };
 
 static const struct frame_unwind dwarf2_signal_frame_unwind =
@@ -1192,7 +1194,9 @@ static const struct frame_unwind dwarf2_signal_frame_unwind =
   dwarf2_frame_this_id,
   dwarf2_frame_prev_register,
   NULL,
-  dwarf2_frame_sniffer
+  dwarf2_frame_sniffer,
+  NULL,
+  "dwarf2_signal_frame_unwind",
 };
 
 /* Append the DWARF-2 frame unwinders to GDBARCH's list.  */
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 35eeebf..4da7fcc 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -133,6 +133,7 @@ struct frame_unwind
   const struct frame_data *unwind_data;
   frame_sniffer_ftype *sniffer;
   frame_dealloc_cache_ftype *dealloc_cache;
+  const char *unwinder_name;
 };
 
 /* Register a frame unwinder, _prepending_ it to the front of the
diff --git a/gdb/frame.c b/gdb/frame.c
index b0a99fb..1319f3a 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1824,6 +1824,13 @@ frame_stop_reason_string (enum unwind_stop_reason reason)
     }
 }
 
+/* Return unwinder name */
+
+const char *get_frame_unwinder_name (struct frame_info *frame)
+{
+  return frame->unwind->unwinder_name;
+}
+
 /* Clean up after a failed (wrong unwinder) attempt to unwind past
    FRAME.  */
 
diff --git a/gdb/frame.h b/gdb/frame.h
index 224aec9..b4a0871 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -422,6 +422,9 @@ enum unwind_stop_reason get_frame_unwind_stop_reason (struct frame_info *);
 
 const char *frame_stop_reason_string (enum unwind_stop_reason);
 
+/* Return the name of the frame's unwinder (or NULL) */
+const char *get_frame_unwinder_name (struct frame_info *);
+
 /* Unwind the stack frame so that the value of REGNUM, in the previous
    (up, older) frame is returned.  If VALUEP is NULL, don't
    fetch/compute the value.  Instead just return the location of the
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index c2515fe..bc35279 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1467,7 +1467,9 @@ static const struct frame_unwind i386_frame_unwind =
   i386_frame_this_id,
   i386_frame_prev_register,
   NULL,
-  default_frame_sniffer
+  default_frame_sniffer,
+  NULL,
+  "i386_frame_unwind",
 };
 \f
 
@@ -1567,7 +1569,9 @@ static const struct frame_unwind i386_sigtramp_frame_unwind =
   i386_sigtramp_frame_this_id,
   i386_sigtramp_frame_prev_register,
   NULL,
-  i386_sigtramp_frame_sniffer
+  i386_sigtramp_frame_sniffer,
+  NULL,
+  "i386_sigtramp_frame_unwind",
 };
 \f
 
diff --git a/gdb/stack.c b/gdb/stack.c
index cc56125..1169d59 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1151,7 +1151,8 @@ frame_info (char *addr_exp, int from_tty)
     int count;
     int i;
     int need_nl = 1;
-
+    const char *unwinder;
+    
     /* The sp is special; what's displayed isn't the save address, but
        the value of the previous frame's sp.  This is a legacy thing,
        at one stage the frame cached the previous frame's SP instead
@@ -1198,6 +1199,13 @@ frame_info (char *addr_exp, int from_tty)
 	/* else keep quiet.  */
       }
 
+    unwinder = get_frame_unwinder_name(fi);
+    if (unwinder)
+      {
+	printf_filtered(" Unwinder: %s\n", unwinder);
+	need_nl = 0;
+      }
+
     count = 0;
     numregs = gdbarch_num_regs (gdbarch)
 	      + gdbarch_num_pseudo_regs (gdbarch);
diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
index 46d32fd..0880113 100644
--- a/gdb/tramp-frame.c
+++ b/gdb/tramp-frame.c
@@ -157,5 +157,6 @@ tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
   unwinder->sniffer = tramp_frame_sniffer;
   unwinder->this_id = tramp_frame_this_id;
   unwinder->prev_register = tramp_frame_prev_register;
+  unwinder->unwinder_name = "tramp-frame.c";
   frame_unwind_prepend_unwinder (gdbarch, unwinder);
 }
-- 
1.6.3.1.169.g33fd.dirty


             reply	other threads:[~2009-05-29 23:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-29 23:09 Samuel Bronson [this message]
2009-05-29 23:10 ` [PATCH 2/2] Add "set/show debug unwinder" prefix commands Samuel Bronson
2009-05-30  6:57   ` Eli Zaretskii
2009-05-30 19:25   ` Doug Evans
2009-05-31 15:50     ` Samuel Bronson
2009-06-04 22:05   ` Tom Tromey
2009-06-09  0:49     ` Samuel Bronson
2009-06-09 19:44       ` Tom Tromey
2009-06-04 22:00 ` [PATCH 1/2] Add an undwinder_name field to "struct frame_unwind" for use by "info frame" Tom Tromey
2009-06-09  0:24   ` Samuel Bronson
2009-06-09 19:41     ` Tom Tromey

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=1243638987-4533-1-git-send-email-naesten@gmail.com \
    --to=naesten@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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