Fix strace tracing of forked processes when attaching to a process with --pid
Tue Sep 13 12:05:00 GMT 2011
At the moment, --trace-children (enabled by default) only works when the
straced process is started by using strace with a command line.
This patch uses the undocumented NtSetInformationProcess(ProcessDebugFlags)
call to make --trace-children work when attaching to a process with --pid
This patch removes the explicit DebugActiveProcess() on each child process: In
my testing this was not needed when the process was created using
CreateProcess() with the DEBUG_PROCESS flag, and failed error 87 when a
process had been attached to with DebugActiveProcess() and then had the
DEBUG_ONLY_THIS_PROCESS flag cleared.
In the alternative, the man page should be fixed to mention that tracing
child processes is only possible when using a command line and not with --pid.
2011-09-12 Jon TURNEY <firstname.lastname@example.org>
* strace.cc (attach_process): Try to turn off DEBUG_ONLY_THIS_PROCESS
if attaching to a process with the forkdebug flag set.
(handle_output_debug_string): Apparently we don't need to explicitly
attach for debugging when a child process starts
* Makefile.in (strace.exe): Link with ntdll
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the Cygwin-patches