Tuesday, February 3, 2009

backtrace and friends

Just some notes on instrumenting code using gcc.

Add hooks before and after function calls with "-finstrument-functions" (__cyg_profile_func_exit, ...).

Several ways to look up symbols:

backtrace, backtrace_symbols

libbfd (library used by nm)

create your own symbol table (have macro to map function pointer to name).


On mac, atos is useful.

More to come.