From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36060 invoked by alias); 26 Jun 2018 11:15:50 -0000 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 Received: (qmail 35857 invoked by uid 89); 26 Jun 2018 11:15:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=gdbpatches, gdb-patches, restores, brobecker X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Jun 2018 11:15:28 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F044A5BCD5; Tue, 26 Jun 2018 11:15:18 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 767B72026D6A; Tue, 26 Jun 2018 11:15:18 +0000 (UTC) Subject: Re: [RFA] Fix GDB build failure on Windows To: Joel Brobecker , gdb-patches@sourceware.org References: <1529951254-45540-1-git-send-email-brobecker@adacore.com> From: Pedro Alves Message-ID: <072c18e0-448a-2978-6d9d-870fd09cb967@redhat.com> Date: Tue, 26 Jun 2018 11:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1529951254-45540-1-git-send-email-brobecker@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-06/txt/msg00610.txt.bz2 Hi Joel, I had already pushed a patch to fix this: which just restores the old behavior, but I'm fine with your patch too. Thanks, Pedro Alves On 06/25/2018 07:27 PM, Joel Brobecker wrote: > --- > gdb/windows-nat.c | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > > diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c > index 63a7800..620e25c 100644 > --- a/gdb/windows-nat.c > +++ b/gdb/windows-nat.c > @@ -479,7 +479,7 @@ windows_init_thread_list (void) > > /* Delete a thread from the list of threads. */ > static void > -windows_delete_thread (ptid_t ptid, DWORD exit_code) > +windows_delete_thread (const ptid_t &ptid, DWORD exit_code) > { > windows_thread_info *th; > DWORD id; > @@ -493,7 +493,26 @@ windows_delete_thread (ptid_t ptid, DWORD exit_code) > else if (print_thread_events && id != main_thread_id) > printf_unfiltered (_("[%s exited with code %u]\n"), > target_pid_to_str (ptid), (unsigned) exit_code); > - delete_thread (ptid); > + > + thread_info *tp = find_thread_ptid (ptid); > + if (tp != NULL) > + delete_thread (tp); > + else > + { > + /* Something unexpected happened: We are trying to delete > + a thread that the core layer apparently does not know about. > + This should never happen, and thus we want to be able to > + report this discrepancy should it actually happen and have > + unanticipated side-effects; but since we were trying to > + delete the thread anyway, it's quite possible that this > + issue has no actual consequence in terms of the overall > + behavior. So, instead of unnecessarily worrying the user > + with a warning or internal-error, just log a DEBUG_EVENTS > + event. */ > + DEBUG_EVENTS (("gdb: windows_delete_thread cannot find thread" > + " for ptid (pid=%d, tid=%ld)\n", > + ptid.pid(), ptid.tid())); > + } > > for (th = &thread_head; > th->next != NULL && th->next->id != id; > @@ -2000,7 +2019,7 @@ windows_nat_target::detach (inferior *inf, int from_tty) > > x86_cleanup_dregs (); > inferior_ptid = null_ptid; > - detach_inferior (current_event.dwProcessId); > + detach_inferior (current_inferior ()); > > maybe_unpush_target (); > }