|
From: Nicholas N. <n.n...@gm...> - 2009-04-23 05:34:45
|
On Mon, Apr 20, 2009 at 4:44 AM, Dan Kegel <da...@ke...> wrote:
>
> Here's the same patch, updated slightly to apply to svn (it's
> been dragged through the mud a bit, but I think these are
> the right bits).
I think it would be better to separate out the commas at command-line
processing time, rather than later. Alternatively, we could avoid the
commas by allowing the option to be specified multiple times, as is done for
--alloc-fn in Massif.
As for whitelists vs. blacklists, I think whitelists don't make much sense.
For example, if we have this tree of processes:
A --> B --> C
--> D --> C
--> E
Ie:
- A spawns B which spawns C
- A subsequently spawns D which spawns C (the same program as the earlier C,
but a different invocation of it)
- A subsequently spawns E.
We have to trace A. It makes sense to blacklist C, for example. But it
doesn't make sense to whitelist C; in order to trace C we have to trace A,
B and D, and we don't know ahead of time that B and D will spawn C
processes. And if you blacklist something, obviously you won't trace any of
its descendents, (eg. if you blacklist B you won't get the first C).
Another idea is to match not the executable name, but rather the entire
command line, ie. the executable plus the arguments. If we allow wildcards
(which m_seqmatch.c supports) then this can be done easily. I had a case
just this morning where I wanted to skip one 'js' subprocess, but not
another, so an executable-only blacklist wouldn't have sufficed.
Examples:
--skip-children='*' # skip all subprocesses (default)
--skip-children='/usr/bin/python *' # skip all python subprocesses
--skip-children='/usr/bin/python *-v*' # skip all python
subprocesses invoked with -v
--skip-children='' # skip no subprocesses
(equivalent to --trace-children=yes)
(Note that the '*' here is a shell-style wildcard -- this pattern is
not a regular expression. The docs would make that clear.)
If you specify multiple --skip-children options, you'd skip a child if any
of the patterns matched.
With that in place, you don't really need --trace-children any more; you
could make --skip-children='*' the default, and if you specify any
--skip-children options yourself they would clobber the initial
--skip-children='*'. Alternatively, we could make --skip-children='' the
default, and then user-specified ones wouldn't need to clobber... I wonder
if tracing all children is a better default than tracing no children. In my
experience tracing no children is rarely if ever useful.
I suppose for generality it might make sense to blacklist the top process,
eg. "valgrind --trace-children-skip='/home/njn/foo' /home/njn/foo" would run
/home/njn/foo natively. But maybe that's not worth bothering with.
Anyway, for those of you who've made it far, congratulations. I'll work on
a patch implementing this more powerful version.
Nick
|