* strace.cc (attach_process): Use NT_SUCCESS to figure out if
NtSetInformationProcess succeeded. (handle_output_debug_string): Put back DebugActiveProcess since it seems to still be needed (on my system at least). Detect new format _STRACE_INTERFACE_ACTIVATE_ADDR which informs whether this is a forked process or not. Use that to decide if forkdebug should be handled.
This commit is contained in:
parent
e553226cfa
commit
505bce274f
|
@ -1,3 +1,12 @@
|
||||||
|
2011-11-24 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
|
* strace.cc (attach_process): Use NT_SUCCESS to figure out if
|
||||||
|
NtSetInformationProcess succeeded.
|
||||||
|
(handle_output_debug_string): Put back DebugActiveProcess since it
|
||||||
|
seems to still be needed (on my system at least). Detect new format
|
||||||
|
_STRACE_INTERFACE_ACTIVATE_ADDR which informs whether this is a forked
|
||||||
|
process or not. Use that to decide if forkdebug should be handled.
|
||||||
|
|
||||||
2011-11-14 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-11-14 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* strace.cc (handle_output_debug_string): Disable code which attempted
|
* strace.cc (handle_output_debug_string): Disable code which attempted
|
||||||
|
|
|
@ -314,8 +314,8 @@ attach_process (pid_t pid)
|
||||||
/* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */
|
/* Try to turn off DEBUG_ONLY_THIS_PROCESS so we can follow forks */
|
||||||
/* This is only supported on XP and later */
|
/* This is only supported on XP and later */
|
||||||
ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT;
|
ULONG DebugFlags = DEBUG_PROCESS_DETACH_ON_EXIT;
|
||||||
NTSTATUS status = NtSetInformationProcess(h, ProcessDebugFlags, &DebugFlags, sizeof(DebugFlags));
|
NTSTATUS status = NtSetInformationProcess (h, ProcessDebugFlags, &DebugFlags, sizeof (DebugFlags));
|
||||||
if (status)
|
if (!NT_SUCCESS (status))
|
||||||
warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status);
|
warn (0, "Could not clear DEBUG_ONLY_THIS_PROCESS (%x), will not trace child processes", status);
|
||||||
|
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
|
@ -486,12 +486,16 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
|
||||||
|
|
||||||
if (special == _STRACE_CHILD_PID)
|
if (special == _STRACE_CHILD_PID)
|
||||||
{
|
{
|
||||||
|
DebugActiveProcess (n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (special == _STRACE_INTERFACE_ACTIVATE_ADDR)
|
if (special == _STRACE_INTERFACE_ACTIVATE_ADDR)
|
||||||
{
|
{
|
||||||
if (!WriteProcessMemory (hchild, (LPVOID) n, &strace_active,
|
s = strtok (NULL, " ");
|
||||||
|
if (*s && *s == '1' && !forkdebug)
|
||||||
|
/* don't activate since we are not following forks */;
|
||||||
|
else if (!WriteProcessMemory (hchild, (LPVOID) n, &strace_active,
|
||||||
sizeof (strace_active), &nbytes))
|
sizeof (strace_active), &nbytes))
|
||||||
error (0, "couldn't write strace flag to subprocess at %p, "
|
error (0, "couldn't write strace flag to subprocess at %p, "
|
||||||
"windows error %d", n, GetLastError ());
|
"windows error %d", n, GetLastError ());
|
||||||
|
|
Loading…
Reference in New Issue