I am also interested in instrumenting the guest binary, as well as
change which guest function I execute at run time.  So LD_PRELOAD
won't help me here.

On Tue, Mar 3, 2020 at 10:41 AM John Reiser <jrei...@bitwagon.com> wrote:
>
> > I am trying to make a tool that intercepts the call to main, and then
> > call an arbitrary function within the guest with arbitrary function
> > arguments.
>
> This can be done without valgrind by using LD_PRELOAD environment variable
> and RTLD_NEXT (see "man dlsym"):
>
>      LD_PRELOAD=main_interceptor.so  ./my_app args...
>
> where main_interceptor.so is a shared library that has a function main()
> and that can call the original main() by using dlsym(RTLD_NEXT, "main").
>
>
>
>
>
>
>
> _______________________________________________
> Valgrind-users mailing list
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users



-- 
Derrick McKee
Phone: (703) 957-9362
Email: derrick.mc...@gmail.com


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

Reply via email to