On Tue, Jan 14, 2014 at 10:14 AM, Samuel Quiring <
samuel_quir...@symantec.com> wrote:

> Greetings,
>
> I invoke my program as follows:
>
>      LD_PRELOAD=./libfakec.so ./my_app –e
>
> The LD_PRELOAD environment variable tells the loader that libfakec.so
> should be loaded BEFORE every other library including the C runtime,
> libc.so (see
> http://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick,
> for example).  I am substituting some of my own routines for standard
> library calls.  My app is working like I want, but the question is how to
> run the app under valgrind?  I tried this:
>
>     valgrind LD_PRELOAD=./libfakec.so ./my_app –e
>
> But valgrind gave and error saying that "LD_PRELOAD=./libfakec.so ./my_app
> –e" is not a valid path.  In theory, I could put the LD_PRELOAD before the
> valgrind invocation:
>
>     LD_PRELOAD=./libfakec.so  valgrind  ./my_app –e
>
> But then valgrind would also be using my special library routines and I am
> pretty sure that will not work.
>
>
Maybe you can do it with a shell-script wrapper? Eg:

run-me.sh:
#! /bin/sh
LD_PRELOAD=./libfakec.so ./myapp -e

Then run:

valgrind --trace-children=yes ./run-me.sh

-Mike
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to