aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2022-03-03 10:55:12 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2022-03-04 03:17:03 +0900
commitefd153853c44876cceb430a0cc1a1a94e2067c96 (patch)
tree27d6a8f31c2a39b3a20c6134c9219179d4238892
parentd6b778617d3d3869971579427dd45648a2e75030 (diff)
downloadnewlib-efd153853c44876cceb430a0cc1a1a94e2067c96.zip
newlib-efd153853c44876cceb430a0cc1a1a94e2067c96.tar.gz
newlib-efd153853c44876cceb430a0cc1a1a94e2067c96.tar.bz2
Cygwin: pty: Simplify the setup code for GDB a bit.
- This patch omits the unnecessary code path for setup for GDB.
-rw-r--r--winsup/cygwin/fhandler_tty.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index be3e6fc..c7588a0 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -121,12 +121,12 @@ static bool isHybrid; /* Set true if the active pipe is set to nat pipe even
static HANDLE h_gdb_inferior; /* Handle of GDB inferior process. */
static void
-set_switch_to_nat_pipe (HANDLE *in, HANDLE *out, HANDLE *err, bool iscygwin)
+set_switch_to_nat_pipe (HANDLE *in, HANDLE *out, HANDLE *err)
{
cygheap_fdenum cfd (false);
int fd;
fhandler_base *replace_in = NULL, *replace_out = NULL, *replace_err = NULL;
- fhandler_pty_slave *ptys_nat = NULL;
+ fhandler_pty_slave *ptys = NULL;
while ((fd = cfd.next ()) >= 0)
{
if (*in == cfd->get_handle () ||
@@ -141,15 +141,14 @@ set_switch_to_nat_pipe (HANDLE *in, HANDLE *out, HANDLE *err, bool iscygwin)
if (cfd->get_device () == (dev_t) myself->ctty)
{
fhandler_base *fh = cfd;
- fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
- if (*in == ptys->get_handle ()
- || *out == ptys->get_output_handle ()
- || *err == ptys->get_output_handle ())
- ptys_nat = ptys;
+ if (*in == fh->get_handle ()
+ || *out == fh->get_output_handle ()
+ || *err == fh->get_output_handle ())
+ ptys = (fhandler_pty_slave *) fh;
}
}
- if (!iscygwin && ptys_nat)
- ptys_nat->set_switch_to_nat_pipe ();
+ if (ptys)
+ ptys->set_switch_to_nat_pipe ();
if (replace_in)
*in = replace_in->get_handle_nat ();
if (replace_out)
@@ -280,8 +279,9 @@ CreateProcessA_Hooked
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
}
bool path_iscygexec = fhandler_termios::path_iscygexec_a (n, c);
- set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
- &siov->hStdError, path_iscygexec);
+ if (!path_iscygexec)
+ set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
+ &siov->hStdError);
BOOL ret = CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
h_gdb_inferior = pi->hProcess;
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
@@ -318,8 +318,9 @@ CreateProcessW_Hooked
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
}
bool path_iscygexec = fhandler_termios::path_iscygexec_w (n, c);
- set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
- &siov->hStdError, path_iscygexec);
+ if (!path_iscygexec)
+ set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
+ &siov->hStdError);
BOOL ret = CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
h_gdb_inferior = pi->hProcess;
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,