> I am trying to run Valgrind on a Linux program which sets its own hooks for 
> certain libc functions (malloc, calloc and free among them).
> 
> To that effect, instead of using LD_PRELOAD, and for reasons I believe are 
> not really relevant for the discussion, the first bytes of the code from 
> these function are overwritten with a jump to a hijacking function.
  [snip]
> This hooking mechanism has been tested thoroughly in different architectures. 
> Additionally, the program runs just fine under Valgrind when disabling it. 
> Here is the output when running it under Valgrind (i686/Linux) with hijacking 
> enabled:

Read and understand valgrind's code for re-direction.  Apply some low-level 
debugger
such as gdb (or perhaps valgrind's internal vgdb) to see what actually happens.

Or, use LD_PRELOAD, which is the "blessed" mechanism for hooking.  It works!
and it takes only a few hours to try.
See the thread in [valgrind-users] Subject: __malloc_hook by Amir Szekely on 
2012-10-19,
my response on Oct.22, and Amir's confirmation of success on Oct.23 (which 
includes
his actual code.)

-- 


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to