strace -f fix

Christopher Faylor
Sat Jun 1 15:59:00 GMT 2002

On Sat, Jun 01, 2002 at 11:52:04PM +0100, Conrad Scott wrote:
>"Christopher Faylor" <> wrote:
>> On Sat, Jun 01, 2002 at 11:09:57PM +0100, Conrad Scott wrote:
>> >I've been playing around with the strace program some more and noticed a
>> >minor glitch: it's only meant to trace forked children if the -f flag is
>> >given on the command line. Unfortunately it currently always traces
>> >children, and the this flag has no effect.
>> What are you trying to fix?  AFAICT, the -f option is working correctly.
>Well, it doesn't work on my machine without the patch I sent in. That is,
>strace *always* traces child processes for me regardless of the -f flag.
>This is true of both the last release (1.3.10) and the current cvs source.
>I've also got a test program that shows exactly the same behaviour unless
>the CreateProcess() debug flags are used as per the patch I appended to the
>last email message. And I've checked that that patch does change the
>behaviour of strace with child processes (for me, on my machine, etc.).
>If it's working for you, I'm not quite sure where that leaves us: I'm
>running w2k (w/ latest service packs etc.), on a Pentium something-or-other
>box, nothing too wacky.
>Have you any idea? I'm befuddled now.

I normally  use XP and I just tried it on Windows 95 and Windows 98.  Perhaps
it is OS dependent.

If you read the MSDN description of DEBUG_ONLY_THIS_PROCESS, it sounds like
strace shouldn't even be using it at all:

If this flag is not set and the calling process is being debugged, the
new process becomes another process being debugged by the calling
process's debugger.  If the calling process is not a process being
debugged, no debugging-related actions occur.

Since strace.exe isn't normally being debugged, it doesn't sound like
this setting would have any effect.  Interestingly, it looks like I've
recently changed gdb to use the scheme that you propose.  I don't think
I did it on purpose, though.  I think it was just the result of a rewrite.

So, I'm not sure what to do.  Sounds like we need someone to check it on
NT4, maybe.


More information about the Cygwin-patches mailing list