Fix strace tracing of forked processes when attaching to a process with --pid

Christopher Faylor
Tue Sep 13 15:31:00 GMT 2011

On Tue, Sep 13, 2011 at 01:04:55PM +0100, Jon TURNEY wrote:
>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 
>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  <>
>	* (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
>	* (strace.exe): Link with ntdll

Looks good.  Please check in.



More information about the Cygwin-patches mailing list