View Single Post
  #3  
Old 10-04-2007, 12:09 AM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: How to know the function name by function pointer's address

On 10 Aug, 10:26, Chisin wrote:

> I use the gcc's compiler flag -finstrument-functions which will
> generate instrumentation calls for entry and exit to every
> functions.Just after function entry and just before function exit, the
> fol-
> lowing profiling functions will be called with the address of the
> current function and its call site.
>
> The prototype of function which shall be called afetr function entry
> is
> void __cyg_profile_func_enter (void *this_fn, void *call_site);
>
> the pointer this_fn is the address of callee function, and the
> call_site is the address of caller function.
>
> How do I know the function name by these addresses?


You can get it from the symbol table using libbfd, as nm utility does.
http://en.wikipedia.org/wiki/Binary_File_Descriptor

Reply With Quote