From 3c4f2024a1c4cddd0fc4239827de4f83528c17f7 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 3 Jul 2009 18:05:51 +0000 Subject: * dcrt0.cc (jit_debug): New global. (initial_env): Set jit_debug when we are automatically starting a gdb process. * dtable.cc (dtable::get_debugger_info): Don't tty tricks when we are being debugged by our own captive gdb, as determined by jit_debug == true. (dtable::init_std_file_from_handle): Detect errors when initializing a tty early rather than at random points later. * fhandler.h (fhandler_*::init): Return int to indicate success/failure. * fhandler.cc (fhandler_base::init): Reflect change in return value. * pipe.cc (fhandler_pipe::init): Ditto. (fhandler_pipe::create_selectable): Don't say we're retrying when we aren't. * fhandler_console.cc (fhandler_console::init): Ditto. Return success/failure. * fhandler_serial.cc (fhandler_serial::init): Ditto. * fhandler_tty.cc (fhandler_tty_slave::init): Ditto. (fhandler_tty_slave::open): Make debugging output more detailed. * tty.cc (tty_list::terminate): Don't close I/O handles before all slaves have checked in. (tty::slave_alive): Make a non-inlined function. Check if tty pipe handles can be created as an additional exists check. * tty.h (tty::slave_alive): Just define here. --- winsup/cygwin/dtable.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/dtable.cc') diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e63a9b5e1..08b04f091 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -109,7 +109,8 @@ dtable::extend (int howmuch) void dtable::get_debugger_info () { - if (being_debugged ()) + extern bool jit_debug; + if (!jit_debug && being_debugged ()) { char std[3][sizeof ("/dev/ttyNNNN")]; std[0][0] = std[1][0] = std [2][0] = '\0'; @@ -383,9 +384,11 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) This needs further investigation but the workaround not to close the handles will have a marginal hit of three extra handles per process at most. */ - fh->init (dev == FH_CONSOLE && wincap.has_console_handle_problem () - ? INVALID_HANDLE_VALUE : handle, access, bin); - set_std_handle (fd); + if (fh->init (dev == FH_CONSOLE && wincap.has_console_handle_problem () + ? INVALID_HANDLE_VALUE : handle, access, bin)) + set_std_handle (fd); + else + api_fatal ("couldn't initialize fd %d for %s", fd, fh->get_name ()); paranoid_printf ("fd %d, handle %p", fd, handle); } } -- cgit v1.2.3