public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: Hannes Domani <ssbssa@yahoo.de>,
	 Hannes Domani via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [RFC] Move SetConsoleCtrlHandler calls to async thread
Date: Fri, 02 Dec 2022 15:22:19 -0700	[thread overview]
Message-ID: <877cz9la3o.fsf@tromey.com> (raw)
In-Reply-To: <87o7sllr7j.fsf@tromey.com> (Tom Tromey's message of "Fri, 02 Dec 2022 09:12:48 -0700")

Tom> Another problem I thought of is what should happen with these interrupt
Tom> sequences when the user puts the inferior in the background, like with
Tom> "continue &".  Having them stop the inferior seems wrong, the user might
Tom> be trying to interrupt some gdb command instead.

Tom> I don't know how this area is supposed to work.

I looked into how Linux handles this.  Of course, it turns out to be
super complicated.  I did learn some things, though.

First, windows_nat_target doesn't override pass_ctrlc.  However, the one
it inherits calls child_pass_ctrlc, which does:

#ifndef _WIN32
	  kill (inf->pid, SIGINT);
#endif

... oops for this case.

However, this function is pretty interesting because it looks for a
foreground process to interrupt, and if it doesn't find one:

  gdb_assert_not_reached ("no inferior resumed in the fg found");

This leads me to think that if we can integrate windows_nat_target into
the pass_ctrlc codepath, things should work.

I have some patches to attempt this, but of course they don't really
work.  The main mystery right now is that in some scenarios (like the
new-console scenario), when I type C-c, default_quit_handler doesn't
seem to be called at all.

C-break does still work.  (I have this working on my branch by
installing a signal handler for SIGBREAK.)  So I thought maybe SIGINT is
being redirected somewhere, but I couldn't find that.

So once again, not sure what's going on.  Maybe closer though.

Tom

  reply	other threads:[~2022-12-02 22:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221128191526.1426-1-ssbssa.ref@yahoo.de>
2022-11-28 19:15 ` Hannes Domani
2022-12-01 17:30   ` Tom Tromey
2022-12-01 19:06     ` Hannes Domani
2022-12-01 21:22       ` Tom Tromey
2022-12-02 16:12         ` Tom Tromey
2022-12-02 22:22           ` Tom Tromey [this message]
2022-12-02 22:51             ` Hannes Domani
2022-12-05 18:54               ` Tom Tromey

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=877cz9la3o.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).