From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17806 invoked by alias); 25 Feb 2003 19:43:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17782 invoked from network); 25 Feb 2003 19:43:02 -0000 Received: from unknown (HELO localhost.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 25 Feb 2003 19:43:02 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id C46AD2ABA; Tue, 25 Feb 2003 12:44:29 -0500 (EST) Message-ID: <3E5BAB7D.8090801@redhat.com> Date: Tue, 25 Feb 2003 19:43:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michal Ludvig Cc: GDB Patches Subject: Re: [patch/rfc] Add a sentinel frame References: <3E305670.3020700@redhat.com> <3E48378E.6090007@suse.cz> <3E492953.8010001@redhat.com> <3E52173B.1030800@suse.cz> <3E538770.6070209@redhat.com> <3E5B98D8.3030002@suse.cz> Content-Type: multipart/mixed; boundary="------------040900090409080900090001" X-SW-Source: 2003-02/txt/msg00652.txt.bz2 This is a multi-part message in MIME format. --------------040900090409080900090001 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 41 Michael, try the attached patch. Andrew --------------040900090409080900090001 Content-Type: message/rfc822; name="mailbox-message://ac131313@movemail/fsf/gdb/patches#31479902" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mailbox-message://ac131313@movemail/fsf/gdb/patches#31479902" Content-length: 6352 X-Mozilla-Status2: 10000000 Return-Path: Delivered-To: cagney@localhost.redhat.com Received: from localhost (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id BE7112A9C for ; Mon, 24 Feb 2003 23:04:47 -0500 (EST) Envelope-to: cagney@gnu.org Delivery-date: Mon, 24 Feb 2003 23:00:48 -0500 Received: from fencepost.gnu.org by localhost with IMAP (fetchmail-6.2.1) for cagney@localhost (single-drop); Mon, 24 Feb 2003 23:04:47 -0500 (EST) Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.10) id 18nWGu-0006Io-00 for cagney@gnu.org; Mon, 24 Feb 2003 23:00:48 -0500 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18nWGq-0003Te-00 for cagney@gnu.org; Mon, 24 Feb 2003 23:00:44 -0500 Received: from sources.redhat.com ([66.187.233.205]) by monty-python.gnu.org with smtp (Exim 4.10.13) id 18nWFL-0002UG-00 for cagney@gnu.org; Mon, 24 Feb 2003 22:59:11 -0500 Received: (qmail 28159 invoked by alias); 25 Feb 2003 03:59:08 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Delivered-To: mailing list gdb-patches@sources.redhat.com Received: (qmail 28152 invoked from network); 25 Feb 2003 03:59:08 -0000 Received: from unknown (HELO localhost.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 25 Feb 2003 03:59:08 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 82FC52A9C for ; Mon, 24 Feb 2003 23:01:24 -0500 (EST) Message-ID: <3E5AEA94.4050401@redhat.com> Date: Mon, 24 Feb 2003 23:01:24 -0500 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc] strengthn get_prev_frame() checks References: <3E5AE9C9.70801@mac.com> Content-Type: multipart/mixed; boundary="------------000502030005060708050407" X-Spam-Status: No, hits=-3.5 required=5.0 tests=FROM_ENDS_IN_NUMS,MISSING_HEADERS,PATCH_UNIFIED_DIFF, QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01,USER_AGENT, USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.41 X-Spam-Level: This is a multi-part message in MIME format. --------------000502030005060708050407 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 248 > 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.... --------------000502030005060708050407 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 2983 2003-02-24 Andrew Cagney * 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; } --------------000502030005060708050407-- --------------040900090409080900090001--