On 14 January 2014 16:14, 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?
What I did when I was in a similar situation was to have an initialization function ( marked __attribute__((constructor)) ) which checked the name of the executable to determine whether to use my versions of the functions or the libc ones. In my functions, I then had an if which either did the special things which was the reason for the LD_PRELOAD, or just delegated to the libc implementation of the function depending on whether the executable was the target one. But yes, the suggestions from Philippe Waroquiers and Mike Shal about passing variables would have made life a lot easier. BR Magnus Reftel ------------------------------------------------------------------------------ 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