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>
Subject: Re: [RFC] control-c handling on Windows...
Date: Sat, 10 May 2008 04:34:00 -0000	[thread overview]
Message-ID: <20080509202942.GA4386@ednor.casa.cgf.cx> (raw)
In-Reply-To: <20080507205611.GB7421@adacore.com>

On Wed, May 07, 2008 at 01:56:11PM -0700, Joel Brobecker wrote:
>Hello,
>
>We noticed the following anomaly when trying to interrupt the inferior
>with a control-c event:
>
>(gdb) run
>Starting program: C:\[...]/always.exe
>[New thread 6772.0xadc]
>Hello world: 1
>Hello world: 2
>[New thread 6772.0x13fc]
>[Switching to thread 6772.0x13fc]
>Quit (expect signal SIGINT when the program is resumed)
>(gdb)
>
>The debugger stopped but doesn't show the usual "Program received
>SIGINT [...]" message. It almost looks like the debugger stopped
>because of the new thread.
>
>Also, the "Quit (expect signal SIGINT when the program is resumed)"
>message is indeed right. When I do a "continue", I immediately get
>the SIGINT:
>
>    (gdb) c
>    Continuing.
>    Hello world: 3
>    Program received signal SIGINT, Interrupt.
>    0x7c87534d in KERNEL32!GetConsoleCharType ()
>       from C:\WINDOWS\system32\kernel32.dll
>    (gdb)
>
>In fact, what happened was that GDB received a SIGINT event,
>and as such set the quit_flag. At the same time, the inferior
>received the control-c event as well, and therefore created
>a new thread to handle it. That new thread generated an event
>intercepted by GDB; after GDB updated its thread list, it tried
>to resume the execution. However, there is a QUIT at the very
>beginning of resume which, because of quit_flag being set,
>aborted the resume action. This is why GDB stopped the first
>time instead of resuming until we get the control-c exception
>event.

>I think this is happening because of a change that was made a year
>ago which adds a call to target_terminal_ours at the beginning of
>win32_wait().  As a result, the SIGINT handler gets reactivated while
>the inferior is running.  This change was made because TUI apparently
>does some output while the terminal process group is set to the inferior
>process.

Thanks for the analysis.  I've talked to Corinna about this since she
was responsible for the original patch in question.  I think her patch
still makes sense so I guess your change is required although I can't
shake the feeling that there is some CreateProcess setting that we're
missing to deal with this behavior.

But, if your patch fixes the problem I'm ok with checking it in.

cgf


  reply	other threads:[~2008-05-09 20:30 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 [this message]
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
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=20080509202942.GA4386@ednor.casa.cgf.cx \
    --to=cgf-use-the-mailinglist-please@sourceware.org \
    --cc=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