* cygthread.h (cygthread::name): Default name to "main" if we are early in the

process of setting up the DLL and no name is known.
* dcrt0.cc (initial_env): Remove CYGWIN_SLEEP stuff.
(get_cygwin_startup_info): Activate strace here as appropriate.
(dll_crt0_0): Move get_cygwin_startup_info as early as possible to avoid
missing strace output.
* fork.cc (frok::child): Move debugging statement to point where ppid will be
set.
* pinfo.cc (pinfo::thisproc): Remove obsolete call to strace.hello.  Tweak
debug output slightly.
* select.cc (select_stuff::wait): Allow APCS to be triggered while waiting
since we use them now.  Report when that happens.
* sigproc.cc (child_info::child_info): Use strace.active() rather than
strace.attached().
* spawn.cc (child_info_spawn::worker): Only write strace child pid when we know
it's a cygwin process.  Accommodate change to write_child argument list.
* strace.cc (strace::hello): Delete.  Move functionality...
(strace::activate): ...to here.
(mypid): Just use raw GetCurrentProcessId () if myself isn't set.
(strace::write_childpid): Don't wait for subproc_ready.  Remove arg which was
required for it.
* include/sys/strace.h (strace::hello): Delete.
(strace::write_childpid): Delete first argument.
This commit is contained in:
Christopher Faylor
2011-11-24 21:36:53 +00:00
parent 8942ed09ac
commit ef8bff85be
9 changed files with 75 additions and 53 deletions

View File

@@ -474,17 +474,8 @@ initial_env ()
_cygwin_testing = 1;
#ifdef DEBUGGING
char buf[NT_MAX_PATH];
DWORD len;
if (GetEnvironmentVariableA ("CYGWIN_SLEEP", buf, sizeof (buf) - 1))
{
DWORD ms = atoi (buf);
console_printf ("Sleeping %d, pid %u %P\n", ms, GetCurrentProcessId ());
Sleep (ms);
if (!strace.active () && !dynamically_loaded)
strace.hello ();
}
char buf[NT_MAX_PATH];
if (GetEnvironmentVariableA ("CYGWIN_DEBUG", buf, sizeof (buf) - 1))
{
char buf1[NT_MAX_PATH];
@@ -506,7 +497,6 @@ initial_env ()
}
}
#endif
}
child_info *
@@ -519,7 +509,10 @@ get_cygwin_startup_info ()
if (si.cbReserved2 < EXEC_MAGIC_SIZE || !res
|| res->intro != PROC_MAGIC_GENERIC || res->magic != CHILD_INFO_MAGIC)
res = NULL;
{
strace.activate (false);
res = NULL;
}
else
{
if ((res->intro & OPROC_MAGIC_MASK) == OPROC_MAGIC_GENERIC)
@@ -545,8 +538,7 @@ get_cygwin_startup_info ()
multiple_cygwin_problem ("fhandler size", res->fhandler_union_cb, sizeof (fhandler_union));
if (res->isstraced ())
{
res->ready (false);
for (unsigned i = 0; !being_debugged () && i < 1000000; i++)
while (!being_debugged ())
yield ();
strace.activate (res->type == _CH_FORK);
}
@@ -657,6 +649,7 @@ init_windows_system_directory ()
void
dll_crt0_0 ()
{
child_proc_info = get_cygwin_startup_info ();
init_windows_system_directory ();
init_global_security ();
initial_env ();
@@ -683,7 +676,6 @@ dll_crt0_0 ()
do_global_ctors (&__CTOR_LIST__, 1);
cygthread::init ();
child_proc_info = get_cygwin_startup_info ();
if (!child_proc_info)
memory_init (true);
else