From 5e0f482f2cac33d5ce758e4dc0f665a4e195f4e1 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 26 Jan 2004 18:52:02 +0000 Subject: * cygtls.cc (_threadinfo::init_thread): Add more local reent stdio initialization. * dcrt0.cc (initial_env): Can it really be true that XP doesn't allow attaching a debugger during DLL attach? Add temporary workaround. (dll_crt0_0): Ensure that _impure_ptr stdio is initialized before any threads. (dll_crt0_1): Move _impure_ptr initialization to dll_crt0_0. * exceptions.cc (try_to_debug): Reinstate old method for looping while debugging. * syscalls.cc (_cygwin_istext_for_stdio): Regularize debugging output. Remove hopefully extraneous check. (setmode_helper): Add debugging output for improbable case. Use "binary" rather "raw" for consistency. --- winsup/cygwin/dcrt0.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/dcrt0.cc') diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 6a08261c1..0cc5b96c6 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -547,8 +547,13 @@ initial_env (bool first) #ifdef DEBUGGING DWORD len; static bool NO_COPY did_debugging_stuff; +#if 0 if (did_debugging_stuff || (first && wincap.cant_debug_dll_entry ())) return; +#else + if (first) + return; +#endif did_debugging_stuff = true; if (GetEnvironmentVariable ("CYGWIN_SLEEP", buf, sizeof (buf) - 1)) @@ -757,10 +762,7 @@ dll_crt0_1 (char *) /* Initialize pthread mainthread when not forked and it is safe to call new, otherwise it is reinitalized in fixup_after_fork */ if (!user_data->forkee) - { - __sinit (_impure_ptr); - pthread::init_mainthread (); - } + pthread::init_mainthread (); #ifdef DEBUGGING strace.microseconds (); @@ -938,15 +940,18 @@ _dll_crt0 () main_environ = user_data->envptr; *main_environ = NULL; - if (child_proc_info && child_proc_info->type == _PROC_FORK) - user_data->forkee = child_proc_info->cygpid; - char padding[CYGTLS_PADSIZE]; _impure_ptr = &reent_data; _impure_ptr->_stdin = &_impure_ptr->__sf[0]; _impure_ptr->_stdout = &_impure_ptr->__sf[1]; _impure_ptr->_stderr = &_impure_ptr->__sf[2]; _impure_ptr->_current_locale = "C"; + + if (child_proc_info && child_proc_info->type == _PROC_FORK) + user_data->forkee = child_proc_info->cygpid; + else + __sinit (_impure_ptr); + initialize_main_tls (padding); dll_crt0_1 (padding); } -- cgit v1.2.3