From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5225 invoked by alias); 20 Jun 2013 18:42:29 -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 5215 invoked by uid 89); 20 Jun 2013 18:42:29 -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-03-ewr.mailhop.org (HELO mho-01-ewr.mailhop.org) (204.13.248.66) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 20 Jun 2013 18:42:28 +0000 Received: from pool-108-49-156-142.bstnma.fios.verizon.net ([108.49.156.142] helo=cgf.cx) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1UpjoP-0002pe-9J; Thu, 20 Jun 2013 18:42:25 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id E244360124; Thu, 20 Jun 2013 14:42:23 -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: U2FsdGVkX18JVhrfDCg3zwkWmuI6BOBl Date: Thu, 20 Jun 2013 18:51: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: <20130620184223.GA6474@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130618234349.GH5560@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-06/txt/msg00559.txt.bz2 On Tue, Jun 18, 2013 at 04:43:49PM -0700, Joel Brobecker wrote: >> FWIW, I've seen this from time to time and have convinced myself that >> it's a red herring. When it happens, it probably should just silently >> continue. > >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; >I think there are other situations as well were we emit a warning, >and where I've been considering the idea of downgrading them to >complaints, so that users don't unnecessarily get concerned. But >I wanted to investigate a little bit before doing so, and I've >never had the time :-(. I think this probably shouldn't be a warning. If there is an issue then it will become clearer at some other point. cgf