Cygwin: pty: Simplify the setup code for GDB a bit.
- This patch omits the unnecessary code path for setup for GDB.
This commit is contained in:
parent
d6b778617d
commit
efd153853c
|
@ -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 HANDLE h_gdb_inferior; /* Handle of GDB inferior process. */
|
||||||
|
|
||||||
static void
|
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);
|
cygheap_fdenum cfd (false);
|
||||||
int fd;
|
int fd;
|
||||||
fhandler_base *replace_in = NULL, *replace_out = NULL, *replace_err = NULL;
|
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)
|
while ((fd = cfd.next ()) >= 0)
|
||||||
{
|
{
|
||||||
if (*in == cfd->get_handle () ||
|
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)
|
if (cfd->get_device () == (dev_t) myself->ctty)
|
||||||
{
|
{
|
||||||
fhandler_base *fh = cfd;
|
fhandler_base *fh = cfd;
|
||||||
fhandler_pty_slave *ptys = (fhandler_pty_slave *) fh;
|
if (*in == fh->get_handle ()
|
||||||
if (*in == ptys->get_handle ()
|
|| *out == fh->get_output_handle ()
|
||||||
|| *out == ptys->get_output_handle ()
|
|| *err == fh->get_output_handle ())
|
||||||
|| *err == ptys->get_output_handle ())
|
ptys = (fhandler_pty_slave *) fh;
|
||||||
ptys_nat = ptys;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!iscygwin && ptys_nat)
|
if (ptys)
|
||||||
ptys_nat->set_switch_to_nat_pipe ();
|
ptys->set_switch_to_nat_pipe ();
|
||||||
if (replace_in)
|
if (replace_in)
|
||||||
*in = replace_in->get_handle_nat ();
|
*in = replace_in->get_handle_nat ();
|
||||||
if (replace_out)
|
if (replace_out)
|
||||||
|
@ -280,8 +279,9 @@ CreateProcessA_Hooked
|
||||||
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
||||||
}
|
}
|
||||||
bool path_iscygexec = fhandler_termios::path_iscygexec_a (n, c);
|
bool path_iscygexec = fhandler_termios::path_iscygexec_a (n, c);
|
||||||
set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
|
if (!path_iscygexec)
|
||||||
&siov->hStdError, 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);
|
BOOL ret = CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
|
||||||
h_gdb_inferior = pi->hProcess;
|
h_gdb_inferior = pi->hProcess;
|
||||||
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
|
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
|
||||||
|
@ -318,8 +318,9 @@ CreateProcessW_Hooked
|
||||||
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
||||||
}
|
}
|
||||||
bool path_iscygexec = fhandler_termios::path_iscygexec_w (n, c);
|
bool path_iscygexec = fhandler_termios::path_iscygexec_w (n, c);
|
||||||
set_switch_to_nat_pipe (&siov->hStdInput, &siov->hStdOutput,
|
if (!path_iscygexec)
|
||||||
&siov->hStdError, 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);
|
BOOL ret = CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
|
||||||
h_gdb_inferior = pi->hProcess;
|
h_gdb_inferior = pi->hProcess;
|
||||||
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
|
DuplicateHandle (GetCurrentProcess (), h_gdb_inferior,
|
||||||
|
|
Loading…
Reference in New Issue