Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
To: gdb-patches@sourceware.org,
	Joel Brobecker <brobecker@adacore.com>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: [commit/windows] Add thread ID in SuspendThread error warning message.
Date: Thu, 20 Jun 2013 18:51:00 -0000	[thread overview]
Message-ID: <20130620184223.GA6474@ednor.casa.cgf.cx> (raw)
In-Reply-To: <20130618234349.GH5560@adacore.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


  reply	other threads:[~2013-06-20 18:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 10:22 Joel Brobecker
2013-06-11 10:50 ` Pedro Alves
2013-06-11 11:07   ` Joel Brobecker
2013-06-11 13:25     ` Pedro Alves
2013-06-11 16:27 ` Eli Zaretskii
2013-06-11 16:38   ` Joel Brobecker
2013-06-11 17:40     ` Eli Zaretskii
2013-06-18 18:09       ` Christopher Faylor
2013-06-19  1:57         ` Joel Brobecker
2013-06-20 18:51           ` Christopher Faylor [this message]
2013-06-24 23:45             ` Joel Brobecker
2013-06-25 21:13               ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130620184223.GA6474@ednor.casa.cgf.cx \
    --to=cgf-use-the-mailinglist-please@sourceware.org \
    --cc=brobecker@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox