From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5902 invoked by alias); 20 Jan 2006 14:56:01 -0000 Received: (qmail 5892 invoked by uid 22791); 20 Jan 2006 14:56:01 -0000 X-Spam-Check-By: sourceware.org Received: from fra-del-01.spheriq.net (HELO fra-del-01.spheriq.net) (195.46.51.97) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Jan 2006 14:55:58 +0000 Received: from fra-out-03.spheriq.net (fra-out-03.spheriq.net [195.46.51.131]) by fra-del-01.spheriq.net with ESMTP id k0KEtn3O021765 for ; Fri, 20 Jan 2006 14:55:49 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-03.spheriq.net with ESMTP id k0KEtniG013774 for ; Fri, 20 Jan 2006 14:55:49 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id k0KEtlJo029096 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Fri, 20 Jan 2006 14:55:47 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A2295DA44; Fri, 20 Jan 2006 14:55:42 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B2524473D9; Fri, 20 Jan 2006 14:59:11 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHD67240 (AUTH stubbsa); Fri, 20 Jan 2006 14:55:38 GMT Message-ID: <43D0F96E.2030104@st.com> Date: Fri, 20 Jan 2006 14:56:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5 (Windows/20051201) 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> <20060112162659.GA16141@nevyn.them.org> <43C7E466.9080703@st.com> <20060114160611.GA12603@nevyn.them.org> <43CB97A2.20205@st.com> <43CBC6EB.9080904@st.com> In-Reply-To: <43CBC6EB.9080904@st.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.2.0 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/msg00248.txt.bz2 Any opinions anybody? Andrew Stubbs wrote: > Andrew STUBBS wrote: >> Now onto figuring out why it doesn't work.... > > The smoking gun seems to be here: > > [From linux-thread-db.c] > > static void > detach_thread (ptid_t ptid, int verbose) > { > struct thread_info *thread_info; > > if (verbose) > printf_unfiltered (_("[%s exited]\n"), target_pid_to_str (ptid)); > > /* Don't delete the thread now, because it still reports as active > until it has executed a few instructions after the event > breakpoint - if we deleted it now, "info threads" would cause us > to re-attach to it. Just mark it as having had a TD_DEATH > event. This means that we won't delete it from our thread list > until we notice that it's dead (via prune_threads), or until > something re-uses its thread ID. */ > thread_info = find_thread_pid (ptid); > gdb_assert (thread_info != NULL); > thread_info->private->dying = 1; > } > > > The attached patch fixes the problem, but I don't know if it does it the > best way. > > What do you think? > > Andrew Stubbs > > > ------------------------------------------------------------------------ > > 2006-01-16 Amdrew Stubbs > > * gdbthread.h (prune_threads): Add prototype. > * infrun.c (normal_stop): Call prune_threads(). > * thread.c (prune_threads): Remove 'static'. > > Index: src/gdb/gdbthread.h > =================================================================== > --- src.orig/gdb/gdbthread.h 2006-01-16 16:08:57.000000000 +0000 > +++ src/gdb/gdbthread.h 2006-01-16 16:13:57.000000000 +0000 > @@ -80,6 +80,9 @@ extern struct thread_info *add_thread (p > /* Delete an existing thread list entry. */ > extern void delete_thread (ptid_t); > > +/* Delete all dead threads from the list. */ > +extern void prune_threads (void); > + > /* Delete a step_resume_breakpoint from the thread database. */ > extern void delete_step_resume_breakpoint (void *); > > Index: src/gdb/infrun.c > =================================================================== > --- src.orig/gdb/infrun.c 2006-01-16 16:08:57.000000000 +0000 > +++ src/gdb/infrun.c 2006-01-16 16:13:57.000000000 +0000 > @@ -3037,6 +3037,9 @@ Further execution is probably impossible > if (stopped_by_random_signal) > disable_current_display (); > > + /* Delete any threads which have died. */ > + prune_threads (); > + > /* Don't print a message if in the middle of doing a "step n" > operation for n > 1 */ > if (step_multi && stop_step) > Index: src/gdb/thread.c > =================================================================== > --- src.orig/gdb/thread.c 2006-01-16 16:08:57.000000000 +0000 > +++ src/gdb/thread.c 2006-01-16 16:13:57.000000000 +0000 > @@ -64,7 +64,6 @@ static void info_threads_command (char * > static void thread_apply_command (char *, int); > static void restore_current_thread (ptid_t); > static void switch_to_thread (ptid_t ptid); > -static void prune_threads (void); > > void > delete_step_resume_breakpoint (void *arg) > @@ -382,7 +381,7 @@ thread_alive (struct thread_info *tp) > return 1; > } > > -static void > +void > prune_threads (void) > { > struct thread_info *tp, *next;