From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17579 invoked by alias); 13 Jan 2006 04:19:45 -0000 Received: (qmail 17571 invoked by uid 22791); 13 Jan 2006 04:19:45 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 13 Jan 2006 04:19:43 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k0D4JfgJ026629 for ; Thu, 12 Jan 2006 23:19:41 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k0D4Jf117678; Thu, 12 Jan 2006 23:19:41 -0500 Received: from [172.16.24.50] (bluegiant.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id k0D4JY78008916; Thu, 12 Jan 2006 23:19:39 -0500 Message-ID: <43C729FA.2020500@redhat.com> Date: Fri, 13 Jan 2006 04:19:00 -0000 From: Michael Snyder User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) MIME-Version: 1.0 To: Andrew STUBBS CC: Daniel Jacobowitz , gdb-patches@sources.redhat.com Subject: Re: [PATCH] Disable thread specific breakpoints when thread dies References: <43723446.7000903@st.com> <20051113184515.GG3599@nevyn.them.org> <437875B0.4000007@st.com> <20051114155659.GA25717@nevyn.them.org> <437A19DE.6040905@st.com> <437B47A1.4040705@st.com> <20051117034811.GB3057@nevyn.them.org> <437CA66B.9060201@st.com> <43C6825C.9020909@st.com> In-Reply-To: <43C6825C.9020909@st.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00136.txt.bz2 Daniel, valid_thread_id wouldn't be safe, because thread ids might be re-used. This implementation looks fine to me... Michael Andrew STUBBS wrote: > Ping. > > Since valid_thread_id did not work am I OK to commit this one. It has > been on hold since mid Novemeber. > > Thanks > > Andrew > > Andrew Stubbs wrote: > >> Daniel Jacobowitz wrote: >> >>> On Wed, Nov 16, 2005 at 02:52:17PM +0000, Andrew STUBBS wrote: >>> >>>> + /* There is no point inserting thread-specific breakpoints if >>>> the >>>> + thread no longer exists. */ >>>> + if (b->owner->thread != -1 >>>> + && !target_thread_alive(thread_id_to_pid(b->owner->thread))) >>>> + continue; >>> >>> >>> >>> >>> You shouldn't need to use the target method here. Does valid_thread_id >>> work? >>> >>> Also, please remember the space before opening parentheses. >> >> >> >> The thread still seems to have a valid ID after it has died. You can >> even do 'b 8 t 4' after the program has exited. It does give an error >> for threads which never existed though. >> >> Here is the patch again with the spaces fixed. >> >> Andrew >> >> >> >> ------------------------------------------------------------------------ >> >> 2005-11-17 Andrew Stubbs >> >> * breakpoint.c (insert_breakpoints): Check that a thread exists >> before inserting thread specific breakpoints. >> >> Index: src/gdb/breakpoint.c >> =================================================================== >> --- src.orig/gdb/breakpoint.c 2005-11-17 15:47:04.000000000 +0000 >> +++ src/gdb/breakpoint.c 2005-11-17 15:47:42.000000000 +0000 >> @@ -1142,6 +1142,12 @@ insert_breakpoints (void) >> if (!breakpoint_enabled (b->owner)) >> continue; >> >> + /* There is no point inserting thread-specific breakpoints if the >> + thread no longer exists. */ >> + if (b->owner->thread != -1 >> + && !target_thread_alive (thread_id_to_pid (b->owner->thread))) >> + continue; >> + >> /* FIXME drow/2003-10-07: This code should be pushed elsewhere >> when >> hardware watchpoints are split into multiple loc breakpoints. */ >> if ((b->loc_type == bp_loc_hardware_watchpoint > > >