* 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.
This commit is contained in:
Christopher Faylor
2004-01-26 18:52:02 +00:00
parent d7231d7224
commit 5e0f482f2c
5 changed files with 46 additions and 19 deletions

View File

@@ -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);
}