public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: pty: Fix Ctrl-C behaviour in latest GDB.
Date: Mon, 18 Apr 2022 12:03:42 +0000 (GMT)	[thread overview]
Message-ID: <20220418120342.E70DC3857C48@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0a67adb0f518b1590bd94cdf98bed60888156bed

commit 0a67adb0f518b1590bd94cdf98bed60888156bed
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Mon Apr 18 20:07:48 2022 +0900

    Cygwin: pty: Fix Ctrl-C behaviour in latest GDB.
    
    - In the latest GDB (11.2-1), Ctrl-C behaviour is broken a bit for
      non-cygwin inferior. For example, Ctrl-C on GDB prompt is not sent
      to GDB but to the inferior. This patch fixes the issue.

Diff:
---
 winsup/cygwin/fhandler_termios.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index 5cd44d7bf..4eff5eab3 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -350,7 +350,8 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
 			 cygwin apps started from non-cygwin shell. */
       if (c == '\003' && p && p->ctty == ttyp->ntty && p->pgid == pgid
 	  && ((p->process_state & PID_NOTCYGWIN)
-	      || (p->exec_dwProcessId == p->dwProcessId)
+	      || ((p->exec_dwProcessId == p->dwProcessId)
+		  && ttyp->pty_input_state_eq (tty::to_nat))
 	      || !(p->process_state & PID_CYGPARENT)))
 	{
 	  /* Ctrl-C event will be sent only to the processes attaching
@@ -406,6 +407,7 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
 	    with_debugger = true; /* inferior is cygwin app */
 	  if (!(p->process_state & PID_NOTCYGWIN)
 	      && (p->exec_dwProcessId == p->dwProcessId) /* Check marker */
+	      && ttyp->pty_input_state_eq (tty::to_nat)
 	      && p->pid == pgid)
 	    with_debugger_nat = true; /* inferior is non-cygwin app */
 	}


                 reply	other threads:[~2022-04-18 12:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220418120342.E70DC3857C48@sourceware.org \
    --to=tyan0@sourceware.org \
    --cc=cygwin-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).