This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Q: wrapper for malloc - possible?
- To: binutils at sources dot redhat dot com
- Subject: Q: wrapper for malloc - possible?
- From: Heiko Nardmann <h dot nardmann at secunet dot de>
- Date: Fri, 10 Aug 2001 10:05:12 +0200
- Organization: secunet Security Networks AG
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I want to trace calls to malloc using the LD_PRELOAD mechanism.
Is this possible?
Currently I tried to dlopen() the libc and get the symbol from it to have the
real pointer. But that fails because dlopen() itself uses malloc().
I also tried to use the '--wrap malloc' option of ld. dlopen() now works fine
but I do not see any output of my __wrap_malloc() function. Is it because the
application to be traced is not linked with '--wrap malloc'? How can I
circumvent this problem? Has anyone done such stuff?
Or do I have to copy the malloc() implementation of glibc to my source?
- --
Heiko Nardmann (Dipl.-Ing.), h.nardmann@secunet.de, Software Development
secunet Security Networks AG - Sicherheit in Netzwerken (www.secunet.de),
Weidenauer Str. 223-225, D-57076 Siegen
Tel. : +49 271 48950-13, Fax : +49 271 48950-50
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7c5W4pm53PRScYygRAukAAKCbq+imM8O0nYDl0tx7mW1KVuSdFACffRG0
HrEA52Y6hIOuHek5t7fjmsA=
=kQm1
-----END PGP SIGNATURE-----