Lolo
Lolo

Reputation: 4169

How to lookup the function addresses of ALL functions instrumented with gcc -finstrument-functions flag?

This option, as described in the documentation, adds instrumentation calls at the entry and exit of functions. These calls pass the start address of the function, which I then lookup with dladdr to determine the function name from the address that was passed.

My issue is that occasionally there is no match found when using dladdr. That is case because -finstrument-functions will also add instrumentation before and after a call to a function when it doesn't have access to its source. This is the case for example with a function library like memset.

How can I look up the address for those functions to retrieve their name when dladdr fails to find a match? The doc says that all addresses "may be looked up exactly in the symbol table" but as far as I can tell the symbol table (using -t option of objdmp) doesn't provide lookup info for library functions.

Upvotes: 1

Views: 35

Answers (0)

Related Questions