From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] control-c handling on Windows...
Date: Sat, 10 May 2008 22:28:00 -0000 [thread overview]
Message-ID: <20080510153102.GE28890@adacore.com> (raw)
In-Reply-To: <20080510043413.GA5429@ednor.casa.cgf.cx>
Hi Chris,
> 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.
I think it does work. All my experiments at resuming the inferior after
having interrupted it with C-c have been succesful.
The only problem is that once in a while GDB still receives the SIGINT.
This time, it doesn't cause the debugger to QUIT during the resume after
handling the new-thread event like it used to, so we properly report the
SIGINT event to the user:
(gdb) cont
Continuing.
I = 10
I = 11
I = 12
[New thread 2348.0x1550] <<<--- pressed C-c
Program received signal SIGINT, Interrupt.
[Switching to thread 2348.0x1550]
0x7c87534d in KERNEL32!GetConsoleCharType (Quit (expect signal SIGINT when the program is resumed)
However, because the SIGINT handler was called, we still get the unexpected
"Quit (expect signal SIGINT when the program is resumed" message in
the middle of printing the current frame. As I said earlier, it doesn't
prevent the next resume to work properly. It's a little misleading but
I think this is already a good improvement, so I suggest we go with your
suggestion.
If only I understood signals and terminals better, I would try to
understand the reason why GDB still gets the SIGINT despite all our
efforts. But, right now, I'm a little in the dark :(. I know that
Nicolas Roche, one of the engineers at AdaCore, has spent quite
a bit of time studying this sort of issues, so I'll see if I can
nudge him a little out of his busy schedule to share some of the ideas
he had.
--
Joel
next prev parent reply other threads:[~2008-05-10 15:31 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 [this message]
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
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=20080510153102.GE28890@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