From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4918 invoked by alias); 25 Jun 2013 21:04:15 -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 4907 invoked by uid 89); 25 Jun 2013 21:04:15 -0000 X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE autolearn=ham version=3.3.1 Received: from mho-02-ewr.mailhop.org (HELO mho-02-ewr.mailhop.org) (204.13.248.72) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 25 Jun 2013 21:04:14 +0000 Received: from pool-108-49-156-142.bstnma.fios.verizon.net ([108.49.156.142] helo=cgf.cx) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1UraPL-000Ewb-6t; Tue, 25 Jun 2013 21:04:11 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 1292460065; Tue, 25 Jun 2013 17:04:10 -0400 (EDT) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/TEpuxEIbclSn/jiFmX3xd Date: Tue, 25 Jun 2013 21:13:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org, Joel Brobecker , Eli Zaretskii Subject: Re: [commit/windows] Add thread ID in SuspendThread error warning message. Message-ID: <20130625210410.GA5980@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org, Joel Brobecker , Eli Zaretskii References: <1370946106-7883-1-git-send-email-brobecker@adacore.com> <8338somyrk.fsf@gnu.org> <20130611162738.GN3969@adacore.com> <83ppvslgrq.fsf@gnu.org> <20130618180156.GA7035@ednor.casa.cgf.cx> <20130618234349.GH5560@adacore.com> <20130620184223.GA6474@ednor.casa.cgf.cx> <20130624233421.GD5326@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130624233421.GD5326@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-06/txt/msg00747.txt.bz2 On Mon, Jun 24, 2013 at 04:34:21PM -0700, Joel Brobecker wrote: >> >That's interesting. I have the following patch in AdaCore's tree >> >which I have been uhming and ahming about. Would it apply to your >> >situation as well? >> > >> >- warning (_("SuspendThread failed. (winerr %u)"), >> >- (unsigned) err); >> >- return NULL; >> >+ /* If SuspendThread failed with error 5 (access >> >+ denied), then ignore the error. It's unclear >> >+ where this comes from and how to prevent it. >> >+ But in the meantime, ignoring it seems to allow >> >+ us to inspect the thread (including fetching >> >+ registers) without apparent ill effect. */ >> >+ if (err != 5) >> >+ { >> >+ warning (_("SuspendThread (tid=0x%x) failed." >> >+ " (winerr %d)"), >> >+ (unsigned) id, (unsigned) err); >> >+ return NULL; >> >+ } >> >> That's basically what I'm doing in the Cygwin release: >> >> if (SuspendThread (th->h) == (DWORD) -1) >> { >> DWORD err = GetLastError (); >> - warning (_("SuspendThread failed. (winerr %u)"), >> - (unsigned) err); >> + /* Can get a ERROR_INVALID_HANDLE if the main thread has >> + exited. */ >> + if (err != ERROR_INVALID_HANDLE) >> + warning (_("SuspendThread(%p) failed. (winerr %u)"), >> + (void *) th->h, (unsigned) err); >> return NULL; >> } >> th->suspended = 1; > >That's interesting again. If I read MSDN right, ERROR_INVALID_HANDLE >is 6, whereas I ignore the error for code 5 (access denied). I say >that it's interesting, because the report we had was for the error >you ignore. I have only seen an invalid handle error and I think it makes sense since it's possible that the thread has disappeared when this function is called. I thought it happened when the main thread exits before some other thread. >Someone was able to reproduce this issue consistently, and I wish >they had more time to help me investigate this. If we had more >details on the two error cases, I would not mind checking in >a merge of both our changes. I think adding the tid is a good idea so if you want to merge the two that's fine with me. I've been meaning to dust off my changes and submit them for approval anyway so you'd save me that step. cgf