public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: Don't change pgid to ctty pgid under debugger
@ 2019-07-25  8:46 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-07-25  8:46 UTC (permalink / raw)
  To: cygwin-cvs

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

commit 2232498c712acc97a38fdc297cbe53ba74d0ec2c
Author: Corinna Vinschen <corinna-cygwin@cygwin.com>
Date:   Thu Jul 25 10:40:03 2019 +0200

    Cygwin: Don't change pgid to ctty pgid under debugger
    
    _pinfo::set_ctty sets myself's pgid to the ctty pgid if the process has
    been started from a non-Cygwin process.  This isn't the right thing to
    do when started from GDB.  GDB starts the application via standard
    Windows means, not via Cygwin fork/exec, so it's treated as being
    a non-Cygwin parent.
    
    But we want the app running in it's own process group.  So skip this
    step when running under a debugger
    
    Signed-off-by: Corinna Vinschen <corinna-cygwin@cygwin.com>

Diff:
---
 winsup/cygwin/pinfo.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index cdbd8bd..123784e 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -554,7 +554,11 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
       syscall_printf ("attaching %s sid %d, pid %d, pgid %d, tty->pgid %d, tty->sid %d",
 		      __ctty (), sid, pid, pgid, tc.getpgid (), tc.getsid ());
       if (!cygwin_finished_initializing && !myself->cygstarted
-	  && pgid == pid && tc.getpgid () && tc.getsid ())
+	  && pgid == pid && tc.getpgid () && tc.getsid ()
+	  /* Even GDB starts app via CreateProcess which changes cygstarted.
+	     This results in setting the wrong pgid here, so just skip this
+	     under debugger. */
+	  && !being_debugged ())
 	pgid = tc.getpgid ();
 
       /* May actually need to do this:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-25  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  8:46 [newlib-cygwin] Cygwin: Don't change pgid to ctty pgid under debugger Corinna Vinschen

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).