Description
When function tracing is enabled following tracing routines are called:
__func_trace_enter() is called on function entry. The line number passed to the routine is the line number of the first executable statement in the routine.
__func_trace_exit() is called just before the function exits.
__func_trace_catch() is called at the beginning of the C++ catch block when the exception occurs.
Declaration
extern "C" void __func_trace_enter(const char * const proc_name, const char * const file_name, const int line_no, void ** const id) extern "C" void __func_trace_exit(const char * const proc_name, const char * const file_name, const int line_no, void ** const id) extern "C" void __func_trace_catch(const char * const proc_name, const char * const file_name, int line_no, void ** const id)
Concept
To trace functions, you need to define the above tracing functions in your code. The body of the tracing functions are provided here as an example to use with your code. You can enable tracing in your code by compiling with the option -qfunctrace. e.g:
> cat main.cpp int main(){ int i=3; return i; } > xlC tracing_routines.cpp -c > xlC.dev -qfunctrace main.cpp tracing_routines.o > ./a.out { main (main.cpp:2) } main (main.cpp:3)