Mac Is there any hook to access the names of the functions being called at runtime?

thelonelysaint

macrumors newbie
Original poster
Jul 29, 2010
1
0
Is there any hook to access the names of the functions being called at runtime in Xcode?

I'm just trying to log the names of all the functions that are called during the lifetime of the process. I have the necessary symbols for the application.

I can do it easily in Visual Studio using _penter() and _pexit() functions. But can't find a way to do it on Xcode.

It's a C++ project btw.

I'm using Xcode 3.1.2 on 10.5.8.

Any help is appreciated.

Thanks.
 

lloyddean

macrumors 65816
May 10, 2009
1,002
16
Des Moines, WA
'man g++' provides '−finstrument−functions'

Generate instrumentation calls for entry and exit to functions. Just after function entry and just before function exit, the following profiling functions will be called with the address of the current function and its call site. (On some platforms, __builtin_return_address does not work beyond the current function, so the call site information may not be available to the profiling functions otherwise.)
void __cyg_profile_func_enter (void *this_fn, void *call_site);
void __cyg_profile_func_exit (void *this_fn, void *call_site);

And the g++ macro '__PRETTY_FUNCTION__' expands to the name of the current function.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.