aboutsummaryrefslogtreecommitdiff
path: root/contrib/gdb
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2012-11-13 03:05:28 +0000
committerEd Maste <emaste@FreeBSD.org>2012-11-13 03:05:28 +0000
commitc73d086b0410525784c699c8e278747aaf9cf6bf (patch)
treecd71e982c2718a953e7f5ae5050c1733ebbbeca6 /contrib/gdb
parent8d220203844bdb6ecb222812ec0ffb08295700a7 (diff)
downloadsrc-c73d086b0410525784c699c8e278747aaf9cf6bf.tar.gz
src-c73d086b0410525784c699c8e278747aaf9cf6bf.zip
Do not unwind past a zero PC frame.
This improves GDB usability when debugging code compiled with optimization. Upstream GDB revision f0031b6d3ae9b164b3747986ab898190bd4dcf8c (prior to GDB's switch to GPLv3), with frame_debug_got_null_frame expanded inline. | 2004-12-12 Andrew Cagney <cagney@gnu.org> | | * frame.c (get_prev_frame): When unwinding normal frames, check | that the PC isn't zero. Sponsored by: ADARA Networks MFC After: 1 month
Notes
Notes: svn path=/head/; revision=242943
Diffstat (limited to 'contrib/gdb')
-rw-r--r--contrib/gdb/gdb/frame.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/gdb/gdb/frame.c b/contrib/gdb/gdb/frame.c
index a032c47e92b1..3650b7c39998 100644
--- a/contrib/gdb/gdb/frame.c
+++ b/contrib/gdb/gdb/frame.c
@@ -1846,6 +1846,23 @@ get_prev_frame (struct frame_info *this_frame)
return NULL;
}
+ /* Assume that the only way to get a zero PC is through something
+ like a SIGSEGV or a dummy frame, and hence that NORMAL frames
+ will never unwind a zero PC. */
+ if (this_frame->level > 0
+ && get_frame_type (this_frame) == NORMAL_FRAME
+ && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
+ && get_frame_pc (this_frame) == 0)
+ {
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, this_frame->prev);
+ fprintf_unfiltered (gdb_stdlog, " // zero PC \n");
+ }
+ return NULL;
+ }
+
/* Only try to do the unwind once. */
if (this_frame->prev_p)
{