This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [commit/windows] Add thread ID in SuspendThread error warning message.
- From: Christopher Faylor <cgf-use-the-mailinglist-please at sourceware dot org>
- To: gdb-patches at sourceware dot org, Joel Brobecker <brobecker at adacore dot com>, Eli Zaretskii <eliz at gnu dot org>
- Date: Thu, 20 Jun 2013 14:42:23 -0400
- Subject: Re: [commit/windows] Add thread ID in SuspendThread error warning message.
- References: <1370946106-7883-1-git-send-email-brobecker at adacore dot com> <8338somyrk dot fsf at gnu dot org> <20130611162738 dot GN3969 at adacore dot com> <83ppvslgrq dot fsf at gnu dot org> <20130618180156 dot GA7035 at ednor dot casa dot cgf dot cx> <20130618234349 dot GH5560 at adacore dot com>
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