This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/2] Add an undwinder_name field to "struct frame_unwind" for use by "info frame".
- From: Samuel Bronson <naesten at gmail dot com>
- To: gdb-patches at sourceware dot org
- Cc: Samuel Bronson <naesten at gmail dot com>
- Date: Fri, 29 May 2009 19:16:26 -0400
- Subject: [PATCH 1/2] Add an undwinder_name field to "struct frame_unwind" for use by "info frame".
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",
};
@@ -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",
};
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