Re: Calling arbitrary guest functions
Derrick McKee <[email protected]>
| Newsgroups | gmane.comp.debugging.valgrind |
|---|---|
| Message-ID | <CAJoBWHyPKM0f8MeC5JwajVw=2ghmgEyjvq_xJyENSJVr2rrQyQ@mail.gmail.com> |
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 <[email protected]> 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 > [email protected] > https://lists.sourceforge.net/lists/listinfo/valgrind-users -- Derrick McKee Phone: (703) 957-9362 Email: [email protected]