From: Andrew Cagney <ac131313@redhat.com>
To: Michal Ludvig <mludvig@suse.cz>
Cc: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [patch/rfc] Add a sentinel frame
Date: Tue, 25 Feb 2003 19:43:00 -0000 [thread overview]
Message-ID: <3E5BAB7D.8090801@redhat.com> (raw)
In-Reply-To: <3E5B98D8.3030002@suse.cz>
[-- Attachment #1: Type: text/plain, Size: 41 bytes --]
Michael, try the attached patch.
Andrew
[-- Attachment #2: mailbox-message://ac131313@movemail/fsf/gdb/patches#31479902 --]
[-- Type: message/rfc822, Size: 6393 bytes --]
[-- Attachment #2.1.1: Type: text/plain, Size: 248 bytes --]
> Hello,
>
> This improves the checks in get_prev_frame() that look for stuff like the top-of-stack or a corrupt stack.
>
> d10v (which uses this) showed no regressions, neither did i386.
>
> I'll commit `tomorrow'.
>
> Andrew
With patch....
[-- Attachment #2.1.2: diffs --]
[-- Type: text/plain, Size: 2983 bytes --]
2003-02-24 Andrew Cagney <cagney@redhat.com>
* frame.c (get_prev_frame): Add comment on check for
inside_entry_func. Only check for inside_entry_file when not a
dummy and not a sentinel. Check that the new frame is not inner
to the old frame.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.67
diff -u -r1.67 frame.c
--- frame.c 20 Feb 2003 16:35:51 -0000 1.67
+++ frame.c 25 Feb 2003 03:51:35 -0000
@@ -1230,7 +1230,6 @@
return next_frame->prev;
next_frame->prev_p = 1;
- /* If we're inside the entry file, it isn't valid. */
/* NOTE: drow/2002-12-25: should there be a way to disable this
check? It assumes a single small entry file, and the way some
debug readers (e.g. dbxread) figure out which object is the
@@ -1238,8 +1237,26 @@
/* NOTE: cagney/2003-01-10: If there is a way of disabling this test
then it should probably be moved to before the ->prev_p test,
above. */
- if (inside_entry_file (get_frame_pc (next_frame)))
- return NULL;
+ /* If we're inside the entry file, it isn't valid. Don't apply this
+ test to a dummy frame - dummy frame PC's typically land in the
+ entry file. Don't apply this test to the sentinel frame.
+ Sentinel frames should always be allowed to unwind. */
+ if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0
+ && inside_entry_file (get_frame_pc (next_frame)))
+ return NULL;
+
+#if 0
+ /* NOTE: cagney/2003-02-25: Don't enable until someone has found
+ evidence that this is needed. */
+ /* If we're already inside the entry function for the main objfile,
+ then it isn't valid. Don't apply this test to a dummy frame -
+ dummy frame PC's typically land in the entry func. Don't apply
+ this test to the sentinel frame. Sentinel frames should always
+ be allowed to unwind. */
+ if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0
+ && inside_entry_func (get_frame_pc (fi)))
+ return 0;
+#endif
/* If any of the old frame initialization methods are around, use
the legacy get_prev_frame method. Just don't try to unwind a
@@ -1301,6 +1318,16 @@
struct frame_id id = frame_id_unwind (next_frame);
if (!frame_id_p (id))
return NULL;
+ /* Check that the new frame isn't inner to (younger, below, next)
+ the old frame - we've not gone backwards. Ignore the sentinel
+ frame where weird things happen. */
+ if (next_frame->level >= 0
+ && frame_id_inner (id, get_frame_id (next_frame)))
+ error ("Unwound frame inner to selected frame (corrupt stack?)");
+ /* Note that, due to frameless functions, the stronger test of the
+ new frame being outer to the old frame can't be used -
+ frameless functions differ by only their PC value. Ignore the
+ sentinel frame where weird things happen. */
prev_frame->frame = id.base;
}
next prev parent reply other threads:[~2003-02-25 19:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-23 20:54 Andrew Cagney
2003-01-27 21:42 ` Andrew Cagney
2003-02-10 23:36 ` Michal Ludvig
2003-02-11 16:48 ` Andrew Cagney
2003-02-18 11:21 ` Michal Ludvig
2003-02-19 13:27 ` Andrew Cagney
2003-02-19 14:04 ` Daniel Jacobowitz
2003-02-19 16:46 ` Andrew Cagney
2003-02-19 16:56 ` Daniel Jacobowitz
2003-02-19 17:11 ` Andrew Cagney
2003-02-19 17:17 ` Daniel Jacobowitz
2003-02-19 17:46 ` Andrew Cagney
2003-02-19 17:56 ` Daniel Jacobowitz
2003-02-19 18:36 ` Andrew Cagney
2003-02-19 18:52 ` Daniel Jacobowitz
2003-02-19 20:22 ` Andrew Cagney
2003-02-19 20:39 ` Daniel Jacobowitz
2003-02-19 21:21 ` Andrew Cagney
2003-02-20 19:32 ` Daniel Jacobowitz
2003-02-19 21:45 ` Andrew Cagney
2003-02-20 19:32 ` Daniel Jacobowitz
2003-02-25 16:24 ` Michal Ludvig
2003-02-25 19:43 ` Andrew Cagney [this message]
2003-02-25 21:00 ` Michal Ludvig
2003-02-25 21:12 ` Andrew Cagney
2003-02-26 8:04 ` Michal Ludvig
2003-02-27 18:27 ` Andrew Cagney
2003-02-28 13:02 ` Michal Ludvig
2003-02-28 15:48 ` Andrew Cagney
2003-03-05 17:38 ` Michal Ludvig
2003-03-05 18:25 ` Andrew Cagney
2003-03-06 16:00 ` Michal Ludvig
2003-03-06 20:13 ` Andrew Cagney
2003-03-06 22:42 ` [RFA] Dummy frames on x86-64 Michal Ludvig
2003-03-07 14:50 ` Andrew Cagney
2003-02-25 22:41 ` [patch/rfc] Add a sentinel frame Andrew Cagney
2003-02-25 21:21 Michael Elizabeth Chastain
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=3E5BAB7D.8090801@redhat.com \
--to=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=mludvig@suse.cz \
/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