* [COMMIT PATCH] get_prev_frame, stop_reason != UNWIND_NO_REASON, add frame debug output.
@ 2013-11-28 18:58 Pedro Alves
0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2013-11-28 18:58 UTC (permalink / raw)
To: gdb-patches
The stop_reason != UNWIND_NO_REASON doesn't currently have "set debug
frame" output. This patch makes it print the stop_reason enum value
as a string.
gdb/
2013-11-28 Pedro Alves <palves@redhat.com>
* frame.c (get_prev_frame_1) <stop_reason != UNWIND_NO_REASON>:
Add "set debug frame" output.
(frame_stop_reason_symbol_string): New function.
---
gdb/ChangeLog | 6 ++++++
gdb/frame.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b171f00..b15bee9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2013-11-28 Pedro Alves <palves@redhat.com>
+ * frame.c (get_prev_frame_1) <stop_reason != UNWIND_NO_REASON>:
+ Add "set debug frame" output.
+ (frame_stop_reason_symbol_string): New function.
+
+2013-11-28 Pedro Alves <palves@redhat.com>
+
* frame-unwind.c (default_frame_unwind_stop_reason): Return
UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
* frame.c (get_prev_frame_1): Remove outer_frame_id check.
diff --git a/gdb/frame.c b/gdb/frame.c
index df1d218..db94d98 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -48,6 +48,7 @@
static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
+static const char *frame_stop_reason_symbol_string (enum unwind_stop_reason reason);
/* We keep a cache of stack frames, each of which is a "struct
frame_info". The innermost one gets allocated (in
@@ -1771,7 +1772,18 @@ get_prev_frame_1 (struct frame_info *this_frame)
&this_frame->prologue_cache);
if (this_frame->stop_reason != UNWIND_NO_REASON)
- return NULL;
+ {
+ if (frame_debug)
+ {
+ enum unwind_stop_reason reason = this_frame->stop_reason;
+
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // %s }\n",
+ frame_stop_reason_symbol_string (reason));
+ }
+ return NULL;
+ }
/* Check that this frame's ID isn't inner to (younger, below, next)
the next frame. This happens when a frame unwind goes backwards.
@@ -2479,6 +2491,25 @@ frame_stop_reason_string (enum unwind_stop_reason reason)
}
}
+/* Return the enum symbol name of REASON as a string, to use in debug
+ output. */
+
+static const char *
+frame_stop_reason_symbol_string (enum unwind_stop_reason reason)
+{
+ switch (reason)
+ {
+#define SET(name, description) \
+ case name: return #name;
+#include "unwind_stop_reasons.def"
+#undef SET
+
+ default:
+ internal_error (__FILE__, __LINE__,
+ "Invalid frame stop reason");
+ }
+}
+
/* Clean up after a failed (wrong unwinder) attempt to unwind past
FRAME. */
--
1.7.11.7
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-28 18:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-28 18:58 [COMMIT PATCH] get_prev_frame, stop_reason != UNWIND_NO_REASON, add frame debug output Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).