summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <cgf@redhat.com>2004-01-26 18:52:52 +0000
committerChristopher Faylor <cgf@redhat.com>2004-01-26 18:52:52 +0000
commit87fa5fcd975b3f2c9554a4b1afcd1199f3c15fc9 (patch)
tree49d6a379fb2b4dcd9ffad40e3d55b87e7d652cc3
parent5a6652bc830305fe04587bf98cf2e4f110a10a1d (diff)
downloadgdb-87fa5fcd975b3f2c9554a4b1afcd1199f3c15fc9.tar.gz
* 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.
-rw-r--r--winsup/cygwin/ChangeLog16
-rw-r--r--winsup/cygwin/cygtls.cc2
-rw-r--r--winsup/cygwin/dcrt0.cc19
-rw-r--r--winsup/cygwin/exceptions.cc3
-rw-r--r--winsup/cygwin/syscalls.cc25
5 files changed, 46 insertions, 19 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 26f3f92b414..a2d027861c0 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,19 @@
+2004-01-26 Christopher Faylor <cgf@redhat.com>
+
+ * 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.
+
2004-01-25 Christopher Faylor <cgf@redhat.com>
* fhandler.cc (fhandler_base::fhaccess): Avoid always setting errno to
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index bb1b43a5e0e..352095dde8e 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -107,6 +107,8 @@ _threadinfo::init_thread (void *x, DWORD (*func) (void *, void *))
local_clib._stderr = _GLOBAL_REENT->_stderr;
local_clib.__sdidinit = _GLOBAL_REENT->__sdidinit;
local_clib.__cleanup = _GLOBAL_REENT->__cleanup;
+ local_clib.__sglue._niobs = 3;
+ local_clib.__sglue._iobs = &_GLOBAL_REENT->__sf[0];
}
local_clib._current_locale = "C";
locals.process_logmask = LOG_UPTO (LOG_DEBUG);
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 763677e3f5f..475d0f1aaa9 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))
@@ -752,10 +757,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 ();
@@ -933,15 +935,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);
}
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 883e88eec3c..9889d4d260b 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -383,7 +383,8 @@ try_to_debug (bool waitloop)
return 1;
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE);
while (!being_debugged ())
- low_priority_sleep (0);
+ Sleep (0);
+ Sleep (2000);
small_printf ("*** continuing pid %u from debugger call\n",
cygwin_pid (GetCurrentProcessId ()));
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index c8a7129e67a..e2f6faaa2c0 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1599,33 +1599,34 @@ ctermid (char *str)
extern "C" int
_cygwin_istext_for_stdio (int fd)
{
- syscall_printf ("_cygwin_istext_for_stdio (%d)", fd);
if (CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING)
{
- syscall_printf (" _cifs: old API");
+ syscall_printf ("fd %d: old API", fd);
return 0; /* we do it for old apps, due to getc/putc macros */
}
cygheap_fdget cfd (fd, false, false);
if (cfd < 0)
{
- syscall_printf (" _cifs: fd not open");
+ syscall_printf ("fd %d: not open", fd);
return 0;
}
+#if 0
if (cfd->get_device () != FH_FS)
{
- syscall_printf (" _cifs: fd not disk file");
+ syscall_printf ("fd not disk file. Defaulting to binary.");
return 0;
}
+#endif
if (cfd->get_w_binary () || cfd->get_r_binary ())
{
- syscall_printf (" _cifs: get_*_binary");
+ syscall_printf ("fd %d: opened as binary", fd);
return 0;
}
- syscall_printf ("_cygwin_istext_for_stdio says yes");
+ syscall_printf ("fd %d: defaulting to text", fd);
return 1;
}
@@ -1639,10 +1640,12 @@ static int
setmode_helper (FILE *f)
{
if (fileno (f) != setmode_file)
- return 0;
- syscall_printf ("setmode: file was %s now %s",
- f->_flags & __SCLE ? "text" : "raw",
- setmode_mode & O_TEXT ? "text" : "raw");
+ {
+ syscall_printf ("improbable, but %d != %d", fileno (f), setmode_file);
+ return 0;
+ }
+ syscall_printf ("file was %s now %s", f->_flags & __SCLE ? "text" : "binary",
+ setmode_mode & O_TEXT ? "text" : "binary");
if (setmode_mode & O_TEXT)
f->_flags |= __SCLE;
else
@@ -1700,7 +1703,7 @@ setmode (int fd, int mode)
setmode_file = fd;
_fwalk (_REENT, setmode_helper);
- syscall_printf ("setmode (%d<%s>, %p) returns %s", fd, cfd->get_name (),
+ syscall_printf ("(%d<%s>, %p) returning %s", fd, cfd->get_name (),
mode, res & O_TEXT ? "text" : "binary");
return res;
}