From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16356 invoked by alias); 19 Nov 2009 17:46:48 -0000 Received: (qmail 16347 invoked by uid 22791); 19 Nov 2009 17:46:47 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Nov 2009 17:45:43 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 4C4B31088A; Thu, 19 Nov 2009 17:45:41 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 1B4EA1086A; Thu, 19 Nov 2009 17:45:41 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1NBB4d-0006RV-VJ; Thu, 19 Nov 2009 12:45:39 -0500 Date: Thu, 19 Nov 2009 17:46:00 -0000 From: Daniel Jacobowitz To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: Don't delete local watchpoints just because a different thread stopped. Message-ID: <20091119174539.GA24336@caradoc.them.org> Mail-Followup-To: Pedro Alves , gdb-patches@sourceware.org References: <200911190207.02432.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200911190207.02432.pedro@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes 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: 2009-11/txt/msg00415.txt.bz2 On Thu, Nov 19, 2009 at 02:07:01AM +0000, Pedro Alves wrote: > One could even come up with a test case where the current > frame id on this other thread does happen to be in the > frame chain. Shouldn't be hard to trigger if the threads > are running the same function --- GDB can then mistakenly > try to extract a new current watchpoint value on the wrong > thread context. I hope your threads have different stacks :-) So I don't think this case happens. > Index: src/gdb/breakpoint.h > =================================================================== > --- src.orig/gdb/breakpoint.h 2009-11-19 01:10:05.000000000 +0000 > +++ src/gdb/breakpoint.h 2009-11-19 01:10:16.000000000 +0000 > @@ -457,6 +457,10 @@ struct breakpoint > should be evaluated on the outermost frame. */ > struct frame_id watchpoint_frame; > > + /* Holds the thread which identifies the frame this watchpoint > + should be considered in scope for, or -1 if don't care. */ > + int watchpoint_thread; > + > /* For hardware watchpoints, the triggered status according to the > hardware. */ > enum watchpoint_triggered watchpoint_triggered; Why not just use a ptid? If the answer has to do with ptid reuse, then we ought to delete the watchpoint before that comes up - anyway, at least deserves a comment of what units this is in. > @@ -1004,6 +1028,12 @@ update_watchpoint (struct breakpoint *b, > bpstat bs; > struct program_space *frame_pspace; > > + /* If this is a local watchpoint, we only want to check if the > + watchpoint frame is in scope if the current thread is the thread > + that was used to create the watchpoint. */ > + if (!watchpoint_thread_match (b)) > + return; > + > /* We don't free locations. They are stored in bp_location array and > update_global_locations will eventually delete them and remove > breakpoints if needed. */ For all-stop, do we want to check whenever the watchpoint's thread is stopped? -- Daniel Jacobowitz CodeSourcery