[RFC] control-c handling on Windows...

Christopher Faylor cgf-use-the-mailinglist-please@sourceware.org
Sat May 10 15:31:00 GMT 2008


On Fri, May 09, 2008 at 06:33:37PM -0700, Joel Brobecker wrote:
>> But, if your patch fixes the problem I'm ok with checking it in.
>
>I think that this is probably the easiest to solve all problems.
>Here is the same patch, but with a comment explaining why we temporarily
>ignore SIGINT...
>
>2008-05-10  Joel Brobecker  <brobecker@adacore.com>
>
>        * win32-nat.c (win32_wait): Ignore SIGINT while waiting for
>        a debug event.
>
>I thought you might have some comments/suggestions on the comment,
>so I'll wait for your OK before checking it in.

I don't think the comment is right.  I think it is expected behavior
that both gdb and the inferior should see the CTRL-C since they are both
associated with the same console.  I don't know this for sure because
Windows concept of process groups are sort of a mystery to me.

I think the way this is handled in linux is by resetting the controlling
process group of the terminal to the pid of the inferior.  On thinking
about this more, I think it probably makes more sense to bracket the
call with:

  SetConsoleCtrlHandler (NULL, TRUE);
  retval = get_win32_debug_event (pid, ourstatus);
  SetConsoleCtrlHandler (NULL, FALSE);

That's almost equivalent to what linux does with process groups I think.

Does the above work in your scenario, Joel?  If so, I think this is
safe to check in.

cgf



More information about the Gdb-patches mailing list