This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 
>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  <jon.turney@dronecode.org.uk>
>
>	* 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
>

Looks good.  Please check in.

Thanks.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]