* 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:
@ -39,29 +39,30 @@ strace::activate (bool isfork)
|
||||
char buf[30];
|
||||
__small_sprintf (buf, "cYg%8x %x %d", _STRACE_INTERFACE_ACTIVATE_ADDR, &_active, isfork);
|
||||
OutputDebugString (buf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
strace::hello ()
|
||||
{
|
||||
if (active ())
|
||||
{
|
||||
char pidbuf[80];
|
||||
if (myself->progname[0])
|
||||
__small_sprintf (pidbuf, "(pid %d, ppid %d, windows pid %u)", myself->pid,
|
||||
myself->ppid ?: 1, GetCurrentProcessId ());
|
||||
else
|
||||
if (_active)
|
||||
{
|
||||
GetModuleFileNameW (NULL, myself->progname, sizeof (myself->progname));
|
||||
__small_sprintf (pidbuf, "(windows pid %d)", GetCurrentProcessId ());
|
||||
char pidbuf[80];
|
||||
WCHAR progname_buf[NT_MAX_PATH - 512];
|
||||
WCHAR *progname;
|
||||
if (myself)
|
||||
{
|
||||
__small_sprintf (pidbuf, "(pid %d, ppid %d, windows pid %u)", myself->pid,
|
||||
myself->ppid ?: 1, GetCurrentProcessId ());
|
||||
progname = myself->progname;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetModuleFileNameW (NULL, progname_buf, sizeof (myself->progname));
|
||||
__small_sprintf (pidbuf, "(windows pid %u)", GetCurrentProcessId ());
|
||||
progname = progname_buf;
|
||||
}
|
||||
prntf (1, NULL, "**********************************************");
|
||||
prntf (1, NULL, "Program name: %W %s", progname, pidbuf);
|
||||
prntf (1, NULL, "OS version: Windows %s", wincap.osname ());
|
||||
if (cygheap && cygheap->user_heap.chunk)
|
||||
prntf (1, NULL, "Heap size: %u", cygheap->user_heap.chunk);
|
||||
prntf (1, NULL, "**********************************************");
|
||||
}
|
||||
prntf (1, NULL, "**********************************************");
|
||||
prntf (1, NULL, "Program name: %W %s", myself->progname, pidbuf);
|
||||
prntf (1, NULL, "OS version: Windows %s", wincap.osname ());
|
||||
if (cygheap)
|
||||
prntf (1, NULL, "Heap size: %u", cygheap->user_heap.chunk);
|
||||
prntf (1, NULL, "**********************************************");
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +128,7 @@ mypid (char *buf)
|
||||
if (myself && myself->pid)
|
||||
__small_sprintf (buf, "%d", myself->pid);
|
||||
else
|
||||
__small_sprintf (buf, "(%d)", cygwin_pid (GetCurrentProcessId ()));
|
||||
__small_sprintf (buf, "(%d)", GetCurrentProcessId ());
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -224,13 +225,12 @@ strace::write (unsigned category, const char *buf, int count)
|
||||
}
|
||||
|
||||
void
|
||||
strace::write_childpid (child_info& ch, DWORD pid)
|
||||
strace::write_childpid (DWORD pid)
|
||||
{
|
||||
char buf[30];
|
||||
|
||||
if (!attached () || !being_debugged ())
|
||||
return;
|
||||
WaitForSingleObject (ch.subproc_ready, 30000);
|
||||
__small_sprintf (buf, "cYg%8x %x", _STRACE_CHILD_PID, pid);
|
||||
OutputDebugString (buf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user