Is there some way that I can load a shared library into the client
address space?  I am trying to do some dynamic analysis on shared
libraries, and I would like to have the dynamic loader load a
specified shared library into the client to run my analysis.

Have main() of the valgrind app (memcheck, drd, etc.) set the environment
variable LD_PRELOAD before invoking the PT_INTERP of the app-under-test.
This is the same as invoking the app-under-test with the bash-shell command 
line:
    LD_PRELOAD=/path/to/the/shared/library  app-under-test  args...
except that valgrind will supervise the execution.

In many cases setting LD_PRELOAD "commutes with" (can be set before) invoking 
valgrind:
    LD_PRELOAD=/path/to/the/shared/library  valgrind  app-under-test  args...
as long as the shared library does not interfere with valgrind or
any shared library that already is used by valgrind (typically, libc).

There may be complications if the app-under-test invokes child process(es).
The LD_PRELOAD will propagate to the child(ren).


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to