The below wrapping functions must be in code which is part
of the guest code. That can be either directly in the guest
program/libraries, or alternatively in a valgrind preloaded
lib.
The assert below indicates that the address of the provided
wrapping function is not a valid guest address (because
it will be a piece of code part of valgrind itself).
The best is to follow the framework/structure like
what is done by existing tools.
Philippe
On Mon, 2018-07-30 at 12:13 +0800, shuai xi wrote:
> Hello developers:
> I want to write a tool for valgrind base on memcheck. I use the '_WRAP_ macros' to wrap malloc in libc, but there show me an error:
>
> valgrind: m_redir.c:638 (vgPlain_redir_notify_new_DebugInfo): Assertion 'is_plausible_guest_addr(sym_avmas.main)' failed.
> Segmentation fault (core dumped)
>
> The code i add to 'mc_main.c' is:
> long I_WRAP_SONAME_FNNAME_ZU(libcZdsoZd6,malloc) ( long n )
> {
> char * r;
> OrigFn fn;
> VALGRIND_GET_ORIG_FN(fn);
> CALL_FN_W_W(r, fn, n);
> //cloak_malloc_addr = r;
> return r;
> }
>
> (I has already disable the malloc replacement by deleting vgpreload_memcheck-amd64-linux.so.)
>
> Thanks
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Valgrind-users mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
|