|
From: Jason G. <jga...@la...> - 2003-08-19 00:40:44
|
Is it possible to actually link against a valgrind library, or can one only run it through the executable? Thanks, Jason |
|
From: Nicholas N. <nj...@ca...> - 2003-08-19 07:45:39
|
On Mon, 18 Aug 2003, Jason Gauthier wrote:
> Is it possible to actually link against a valgrind library, or can one only
> run it through the executable?
Let's see:
[~/grind/annelid] gcc a.o memcheck/vgskin_memcheck.so coregrind/valgrind.so
[~/grind/annelid] VG_ARGS=--suppressions=default.supp; a.out
==26034== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==26034== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==26034== Using valgrind-20030725, a program supervision framework for x86-linux.
==26034== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==26034== Estimated CPU clock rate is 1404 MHz
==26034== For more details, rerun with: -v
==26034==
==26034==
==26034== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==26034== malloc/free: in use at exit: 0 bytes in 0 blocks.
==26034== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==26034== For a detailed leak analysis, rerun with: --leak-check=yes
==26034== For counts of detected errors, rerun with: -v
So the answer seems to be yes, with some provisos:
- You have to link with a particular skin. I linked with Memcheck
above.
- You have to put the skin .so before valgrind.so when linking.
- You have to setup $VG_ARGS, by adding a --suppressions= entry, at the
least.
I'd be interested to know why you want to do this.
N
|
|
From: Rob L. <ro...@te...> - 2003-08-25 04:22:07
|
On Tue, Aug 19, 2003 at 08:45:35AM +0100, Nicholas Nethercote wrote: > I'd be interested to know why you want to do this. using valgrind with prorams using MPICH, for one :> mpich-1.2.x uses an 'mpirun' script, which takes care of launching the job on the differnt nodes of the job. it also happens to permute the order of the command line arguments and adds a few more. this works fine for mpirun -np 3 cpi but not so well for mpirun -np 3 valgrind cpi linking against valgrind is a lot easier than the current solution: acking a one-off shell script to do mpiruns work for you. this sound like something fun to play with. thanks. ==rob -- Rob Latham Chicago, IL USA |