This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: Fix strace tracing of forked processes when attaching to a process with --pid
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 13 Sep 2011 11:31:12 -0400
- Subject: Re: Fix strace tracing of forked processes when attaching to a process with --pid
- References: <4E6E0710.4000909@dronecode.org.uk> <4E6F46E7.5080108@dronecode.org.uk>
- Reply-to: cygwin-patches at cygwin dot com
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