whocalls is a simple example of a utility based on the Link-Auditing library, which permits the tracking of a given function call. See Linker and Libraries Guide The executable is run as normal. Each time the procedure funcname is called, both the arguments to that procedure and a stack trace are displayed on standard output.
This examples tracks the calls to printf( ) made by a simple hello_world program
% whocalls printf hello printf(0x106e4, 0xef625310, 0xef621ba8) hello:main+0x10 hello:_start+0x5c hello %
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|