Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] control-c handling on Windows...
Date: Sun, 11 May 2008 21:26:00 -0000	[thread overview]
Message-ID: <20080511164043.GJ28890@adacore.com> (raw)
In-Reply-To: <20080510194232.GC17229@ednor.casa.cgf.cx>

> >I wonder if there might be some sort of timing issue that causes
> >the signal to sometimes be delivered after we stopped ignoring control
> >events.  In other words, some of the time, we receive the signal
> >reasonably close to when we receive the debug event for the new thread,
> >and so it gets ignored.  But some other time, we receive the signal
> >sufficiently after we got the debug event that we already got out of
> >get_win32_debug_event and restored the regular SIGINT handler...
> >That would explain why we're seeing the QUIT message.
> 
> i.e., it's a classic race.

Yes, and I'm still not sure how to solve it completely :-(. I double-checked
the cygwin case inside a cygwin window, and things seem to be pretty solid
as soon as the SetConsoleCtrlHandler wrapper is installed. Not sure whether
it's a coincidence or whether it's expected that I wouldn't see that race
with a cygwin window (and in fact, I'm not sure that the cygwin window
is relevant to the experiment either). I did verify it again in the case
of mingw.

So, I suggest we install you patch for now. Hopefully we'll find a way
to get rid of the race condition, but in the meantime, we have something
that makes the situation better.

> >On a side note, utils.c:quit is:
> >
> >    void
> >    quit (void)
> >    {
> >    #ifdef __MSDOS__
> >      /* No steenking SIGINT will ever be coming our way when the
> >         program is resumed.  Don't lie.  */
> >      fatal ("Quit");
> >    #else
> >      if (job_control
> >          /* If there is no terminal switching for this target, then we can't
> >             possibly get screwed by the lack of job control.  */
> >          || current_target.to_terminal_ours == NULL)
> >        fatal ("Quit");
> >      else
> >        fatal ("Quit (expect signal SIGINT when the program is resumed)");
> >    #endif
> >    }
> >
> >Not sure when __MSDOS__ is defined, but perhaps we should extend
> >that case to mingw & cygwin as well? At least we wouldn't get the
> >"expect signal SIGINT when the program is resumed" part which
> >I don't think can happen on Windows anymore.
> 
> I'm still assuming that you're talking about mingw here since Cygwin should
> have different behavior.  For instance, it implements tcsetpgrp.

Ah, you're right, that would cause job_control to be set on cygwin,
I think. So that means we would probably want to emulate the __MSDOS__
case for mingw only.

-- 
Joel


  reply	other threads:[~2008-05-11 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  9:46 Joel Brobecker
2008-05-10  4:34 ` Christopher Faylor
2008-05-10 13:10   ` Joel Brobecker
2008-05-10 15:31     ` Christopher Faylor
2008-05-10 22:28       ` Joel Brobecker
2008-05-11  5:30         ` Christopher Faylor
2008-05-11 13:31         ` Joel Brobecker
2008-05-11 13:46           ` Eli Zaretskii
2008-05-11 13:58           ` Christopher Faylor
2008-05-11 21:26             ` Joel Brobecker [this message]
2008-05-17 11:38               ` Christopher Faylor
2008-05-21  0:34                 ` Joel Brobecker
2008-05-21  3:19                   ` 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=20080511164043.GJ28890@adacore.com \
    --to=brobecker@adacore.com \
    --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