From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26700 invoked by alias); 29 Nov 2007 10:44:21 -0000 Received: (qmail 26681 invoked by uid 22791); 29 Nov 2007 10:44:19 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 29 Nov 2007 10:42:18 +0000 Received: (qmail 27018 invoked from network); 29 Nov 2007 10:42:16 -0000 Received: from unknown (HELO wind.local) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Nov 2007 10:42:16 -0000 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: Re: [RFA] Try 2: Use multiple locations for hardware watchpoints. Date: Thu, 29 Nov 2007 10:44:00 -0000 User-Agent: KMail/1.9.6 References: <200711282014.28537.vladimir@codesourcery.com> In-Reply-To: <200711282014.28537.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_EepTHKn+mezxWOj" Message-Id: <200711291342.12336.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00542.txt.bz2 --Boundary-00=_EepTHKn+mezxWOj Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1656 On Wednesday 28 November 2007 20:14:28 you wrote: > > This is a revised patch to make watchpoint use regular locations > mechanism for storing locations to be watched. Compared to the > previous patch: > > - The 'update_watchpoint' function now updates the value stored > inside breakpoint, removing the need for a special code for that > purpose inside 'insert_breakpoints', which code had a FIXME saying > it should be moved elsewhere. Since we call evaluate_expression > anyway, update_watchpoint only needs a little care with memory management > to do that -- there's no extra overhead. > > - The 'update_watchpoint' function also has 'reparse' parameter, which > causes it to reparse the watched expression. The breakpoint_re_set_one, > for the case of watchpoints, now merely calls update_watchpoint. > > - Presently, if I set a watchpoint on a global variable in an > explicitly loaded shared library, and re-run the program, gdb promptly > segfaults. This patch fixes that, and adds a testcase for that behaviour. > > This patch should be applied on top of my previous breakpoint_re_set_on > watchpoint cleanup patch. I've noticed that update_watchpoint fail to exit early in case the breakpoint's disposition is disp_del_at_next_stop. That disposition is used for breakpoints that we need to delete when they are out of scope -- that's kind of hack, as trying to call delete_breakpoint directly will lead to crashes as later code touches this breakpoint. Without this check, nothing breaks, but we sometimes get a message about a deleted watchpoint twice. To fix it, the below one-liner should be applied on top of this patch. - Volodya --Boundary-00=_EepTHKn+mezxWOj Content-Type: text/x-diff; charset="iso-8859-15"; name="delta.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="delta.diff" Content-length: 435 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4f6f161..7a07678 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -855,6 +855,9 @@ update_watchpoint (struct breakpoint *b, int reparse) value_free (b->val); b->val = NULL; + + if (b->disposition == disp_del_at_next_stop) + return; /* Save the current frame's ID so we can restore it after evaluating the watchpoint expression on its own frame. */ --Boundary-00=_EepTHKn+mezxWOj--