From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18111 invoked by alias); 24 Jun 2013 23:34:26 -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 18098 invoked by uid 89); 24 Jun 2013 23:34:25 -0000 X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 24 Jun 2013 23:34:24 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4B45E1C64CC; Mon, 24 Jun 2013 19:34:23 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26kHL4d1vNoy; Mon, 24 Jun 2013 19:34:23 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1A1D31C64C9; Mon, 24 Jun 2013 19:34:23 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 3958BD5250; Mon, 24 Jun 2013 16:34:21 -0700 (PDT) Date: Mon, 24 Jun 2013 23:45:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: [commit/windows] Add thread ID in SuspendThread error warning message. Message-ID: <20130624233421.GD5326@adacore.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130620184223.GA6474@ednor.casa.cgf.cx> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-06/txt/msg00681.txt.bz2 > >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. 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. -- Joel