|
From: Tom H. <to...@co...> - 2005-08-17 11:50:10
|
In message <1124276546.3197.16.camel@localhost.localdomain>
Rob Holland <ti...@ge...> wrote:
> I've happily managed to replace fprintf and some others, but not
> printf.
That's odd, because I can see printf being replace in your log output
but not fprintf...
> Anyone know what's special about printf and why I can't replace it with
> VG_REPLACE_FUNCTION like I can the others?
You probably just haven't go the right name or something.
> It's not helped that I don't quite understand the syntax of the
> trace-redirs report.
I'll insert some comments to explain it...
> --30136-- Just loaded /usr/local/lib64/valgrind/vg_preload_core.so (soname=vg_preload_core.so),
We've loaded the preload library. Why is it vg_preload_core by the
way? Surely it should be vgpreload_<tool>.so?
> --30136-- resolving any unresolved redirs with it
> --30136-- Finished resolving
We checked if there were redirections pending for any symbols in
that library and (as expected) there weren't.
> --30136-- REDIR sym to addr: soname:libc.so.6:printf to 0x2571AF50
We found a redirection for printf in the vg_preload_core.so library
but as libc has not been loaded yet we can't resolve it.
> --30136-- Just loaded /usr/local/lib64/valgrind/vgpreload_formatcheck.so (soname=(null)),
Now we've loaded your tool preload library but it doesn't seem to
contain any redirections.
> --30136-- Just loaded /lib64/tls/libc-2.3.5.so (soname=libc.so.6),
Now we've loaded libc...
> --30136-- resolving any unresolved redirs with it
...and started resolving any pending redirections in it...
> --30136-- redir resolved (soname:libc.so.6:printf=0x2586FE60 -> 0x2571AF50)
...and found that pending redirection for printf and resolved it so
any call to printf should now get redirected.
> The code is of course available should anyone feel it would be helpful,
> but as it works fine for fprintf I'm assuming the code is ok and that
> printf is "special" in some way I'm unaware of.
Are you sure your test program is actually calling printf and that gcc
and/or the glibc headers haven't turned it into a call to some other
routine?
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|