From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1770 invoked by alias); 3 Sep 2003 09:38:23 -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 1763 invoked from network); 3 Sep 2003 09:38:22 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 3 Sep 2003 09:38:22 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h839cKl07416 for ; Wed, 3 Sep 2003 05:38:20 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h839cJL24073 for ; Wed, 3 Sep 2003 05:38:19 -0400 Received: from cygbert.vinschen.de (vpn50-24.rdu.redhat.com [172.16.50.24]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h839cHw10401 for ; Wed, 3 Sep 2003 02:38:18 -0700 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 083F558207; Wed, 3 Sep 2003 11:38:15 +0200 (CEST) Date: Wed, 03 Sep 2003 09:38:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: [RFA] breakpoint.c, scanning epilogue if frame chain is invalid Message-ID: <20030903093815.GQ1859@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2003-09/txt/msg00012.txt.bz2 Hi, I'd like to propose the following patch to breakpoint.c: * breakpoint.c (watchpoint_check): Check for pc being in an epilogue if watchpoint frame couldn't be found. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.126 diff -u -p -r1.126 breakpoint.c --- breakpoint.c 9 Aug 2003 14:57:30 -0000 1.126 +++ breakpoint.c 3 Sep 2003 09:14:02 -0000 @@ -2411,7 +2411,7 @@ watchpoint_check (void *p) Since we can't rely on the values of local variables after the stack has been destroyed, we are treating the watchpoint in that state as `not changed' without further checking. */ - if (within_current_scope && fr == get_current_frame () + if ((!within_current_scope || fr == get_current_frame ()) && gdbarch_in_function_epilogue_p (current_gdbarch, read_pc ())) return WP_VALUE_NOT_CHANGED; if (within_current_scope) While tracking down a FAIL in testsuite/gdb.base/recurse.exp, I found that the PC was in the epilogue of a function, at a point where the FP has been messed up so that frame_find_by_id(b->watchpoint_frame) was unable to find the watchpoint_frame (which would have been the frame of the same function 4 recursions above). As a result, "within_current_scope" would have been set to FALSE and the above code wouldn't call gdbarch_in_function_epilogue_p() even though it would have recognized that the PC *is* in an epilogue currently and would have *correctly* returned TRUE. As a result of this misbehaviour, the to be checked watchpoint would have been deleted because that's the consequence of not being in the scope of the watchpoint. The above patch is basically this: If we couldn't find the watchpoint frame, at least try to find out if PC is just in an epilogue. If so, it's probably the cause of failing to find the watchpoint frame so just leave the watchpoint alone until we're on firmer ground again. Not calling gdbarch_in_function_epilogue_p() at this point is not exactly what gdbarch_in_function_epilogue_p() was originally desigend for and deleting the watchpoint instead is a bit of an overreaction. Corinna -- Corinna Vinschen Cygwin Developer Red Hat, Inc.