This program more or less implements a debugger, using ptrace to attach to its target, suspend it, then trampoline through malloc and dlopen (the routines a program would use to load dynamic libraries on its own behalf). This isn't far from what gdb would do if you used "call" to dlopen a library.
People here seem to not know of the many existing implementations of this concept, including LCITK[1] and libhijack[2].<p>[1] <a href="https://github.com/planetbeing/lcitk" rel="nofollow">https://github.com/planetbeing/lcitk</a><p>[2] <a href="http://0xfeedface.org/category/tags/libhijack" rel="nofollow">http://0xfeedface.org/category/tags/libhijack</a>
Wow. That'd be fun to mix with labrea: <a href="http://dustin.github.com/2010/12/03/labrea.html" rel="nofollow">http://dustin.github.com/2010/12/03/labrea.html</a>