On Wed, 2014-05-28 at 16:08 +0200, Ishwara wrote:
> Hi
> I'm new to valgrind. I wanted to change a default tool to e.g. helgrind by 
> setting VALGRIND_OPTS env variable.
> echo $VALGRIND_OPTS prints: --log-file=rrc.log --time-stamp=yes 
> --tool=helgrind
> But valgrind keeps running memcheck. Other arguments work, only tool is being 
> ignored.
> I get the same result when using .valgrindrc file.
> Anyone has any idea how to change the default tool? (not specifying it each 
> time)
Some options cannot be specified in VALGRIND_OPTS.
The reason is that the command line processing is done in two phases:
  a subset of the options is "pre-checked" (either by the launcher
        or by the tool itself)
  the rest of the options is parsed in a second phase.


The following options are determined during the first phase,
(without looking at ~/.valgrindrc, $VALGRIND_OPTS and ./.valgrindrc) :
--tool=
--command-line-only=
-d
--max-stackframe=
--main-stacksize=
--sim-hints=
--profile-heap=
--core-redzone-size=
--redzone-size=
--aspace-minaddr=


The (main) reason for this is that processing .valgrindrc and others
implies to have some parts of Valgrind initialised (e.g. the memory
management). And the initialisation of these parts implies to
have the value of the above arguments.
In summary, chicken and egg problem.

This could probably be fixed/changed by having the launcher
expanding .valgrindrc/VALGRIND_OPTS/... and inserting it into a new argv vector
before exec-ing the tool file.
Looks a nice small first change to try in valgrind, if you are interested :)

(the only possible difficulty I see is to avoid re-inserting these args
in case of a child process)

Philippe



------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to