Bug 218689 - Need finer control of which child processes to trace
Summary: Need finer control of which child processes to trace
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-14 20:30 UTC by Dan Kegel
Modified: 2011-03-02 15:56 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch to add option for skip tracing children (4.37 KB, patch)
2010-01-15 23:16 UTC, leiz
Details
patch to try matching against all arguments and not just the exe name (4.59 KB, patch)
2010-01-16 04:02 UTC, leiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Kegel 2009-12-14 20:30:47 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

http://blog.mozilla.com/nnethercote/2009/04/30/making-valgrind-easier-to-use-with-multi-process-programs/
describes proposals for finer control of which child
processes to trace.

In my case, I would like to exclude tracing /bin/sh,
but also wine valgrind.  i.e. the decision can't be
made just on argv[0], but has to take argv[1] into
account, too.   Perhaps if the blacklist and whitelist
options accepted regexps, and operated on the whole
commandline somehow, that would do.

Having this would make my runs considerably faster.
I may hack in a hardcoded "don't valgrind python" kludge
of my own in the meantime.
Comment 1 leiz 2010-01-15 23:16:06 UTC
Created attachment 39929 [details]
patch to add option for skip tracing children

Here is a patch that adds --trace-skip=STR. This disables --trace-chidren for cases where the child's argv contains an argument that's equal to STR. The matching is just a simple strcmp(), no fancy regexp. You can pass multiple --trace-skip arguments to valgrind the same way you pass --suppression.
Comment 2 Julian Seward 2010-01-15 23:28:35 UTC
(In reply to comment #1)
> Created an attachment (id=39929) [details]
> patch to add option for skip tracing children
> 
> Here is a patch that adds --trace-skip=STR. This disables --trace-chidren for
> cases where the child's argv contains an argument that's equal to STR. 

Er, I think we already have this functionality in the trunk now:

    --trace-children-skip=patt1,patt2,...    specifies a list of executables
                              that --trace-children=yes should not trace into

Is that what you were after?  Or do I misunderstand?
Comment 3 leiz 2010-01-15 23:38:43 UTC
Yes, that's what I'm after. I guess Dan K should close this bug as a duplicate of bug 148932.
Comment 4 leiz 2010-01-16 00:56:16 UTC
Oh, looks like--trace-children-skip doesn't quite do what I want. In our test case, we're running the command:

/path/to/wine-preloader /path/to/wine Z:\\path\\to\\python.exe.

My patch examines all the arguments whereas --trace-children-skip only examines the first argument. That's not fine-grained enough because every command is /path/to/wine-preloader /path/to/wine foo.exe.
Comment 5 leiz 2010-01-16 04:02:52 UTC
Created attachment 39931 [details]
patch to try matching against all arguments and not just the exe name
Comment 6 Bart Van Assche 2011-03-02 12:50:51 UTC
(In reply to comment #4)
> Oh, looks like--trace-children-skip doesn't quite do what I want. In our test
> case, we're running the command:
> 
> /path/to/wine-preloader /path/to/wine Z:\\path\\to\\python.exe.
> 
> My patch examines all the arguments whereas --trace-children-skip only examines
> the first argument. That's not fine-grained enough because every command is
> /path/to/wine-preloader /path/to/wine foo.exe.

I guess that --trace-children-skip-by-arg=... does provide the desired functionality ?
Comment 7 Dan Kegel 2011-03-02 15:56:05 UTC
Yes, probably, thanks.