|
From: Rob J. <ja...@cs...> - 2012-08-20 16:25:09
|
All, I wrote a discrete-event simulator that requires intercepting several system calls via LD_PRELOAD. (https://shadow.cs.umn.edu). When I intercept malloc, and run my program through valgrind, it barfs with the error: "valgrind: Cannot continue: malloc of new_line failed." My command is something like: LD_PRELOAD=/path/to/mypreload.so /usr/bin/valgrind /path/to/myprogram... where mypreload.so contains the malloc() that I am intercepting. The printf() in my implementation of malloc never gets triggered. $ uname -a Linux thor 3.4.6-2.fc17.x86_64 #1 SMP Thu Jul 19 22:54:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ valgrind --version valgrind-3.7.0 I am wondering if there is a way to tell valgrind that I want to set a library in the LD_PRELOAD env variable AFTER the valgrind initialization is done but BEFORE my program is run. It seems like this could be a useful feature for programs that intercept malloc(). What are the options for programs that want to LD_PRELOAD malloc and run valgrind at the same time? Regards, Rob |