Re: trace for shared lib calles ?

Matthias Urlichs (smurf@work.smurf.noris.de)
26 Jul 1997 13:00:19 +0200


Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:
> >
> > but how do I create e.g. a function "malloc" for the preload/wrapper library
> > which then should call "malloc" from the real shared libc without generating
> > a recursive call to itself (the wrapper function) ?
>
> You can locate the original symbol using
> dlopen("libsomething");dlsym(,"malloc");
>
Don't do that, please.

The right way to say "original version" is dlsym(RTLD_NEXT,"malloc").

Otherwise you're going to run into difficulties when somebody uses two
preloaded libraries on top of each other.

> P.S. I don't think this is kernel-related at all.

Right...