This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
strace -f fix
- From: "Conrad Scott" <Conrad dot Scott at dsl dot pipex dot com>
- To: <cygwin-patches at cygwin dot com>
- Date: Sat, 1 Jun 2002 23:09:57 +0100
- Subject: strace -f fix
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.
Having read the MS documentation, I fully understand this: the documentation
of the relevant flag (DEBUG_ONLY_THIS_PROCESS) is at the least utterly
ambiguous and most likely contradictory.
Anyhow, the upshot is that the DEBUG_PROCESS flag should be given to
CreateProcess() only if children are to be debugged; otherwise the
DEBUG_ONLY_THIS_PROCESS flag should be given. This isn't the scheme in
utils/strace.cc, so I've appended a tiny patch. As it's a trivial patch and
my assignment form has probably yet to reach RedHat, please make what use
you can of it.
// Conrad
diff -u -u -r1.20 strace.cc
--- strace.cc 27 May 2002 01:49:08 -0000 1.20
+++ strace.cc 1 Jun 2002 21:39:39 -0000
@@ -314,8 +314,8 @@
/* cygwin32_conv_to_win32_path (exec_file, real_path); */
- flags = forkdebug ? 0 : DEBUG_ONLY_THIS_PROCESS;
- flags |= CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
+ flags = forkdebug ? DEBUG_PROCESS : DEBUG_ONLY_THIS_PROCESS;
+ flags |= CREATE_DEFAULT_ERROR_MODE;
flags |= (new_window ? CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP :
0);
make_command_line (one_line, argv);