Am 04.09.2012 23:28, schrieb Ian Lance Taylor: > > I don't know anything about dwfl. But you haven't showed us the > important piece of information: where does addr come from in the call > to addr_print? > Both __cyg_profile_func_enter and __cyg_profile_func_exit have parameters 'void *this_fn' and 'void *call_site', the address of the current function and its call site (see http://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-finstrument_002dfunctions-2296). add_print is called with each of those two values, i.e. twice when an instrumented function is called and twice when it returns. I got the advice to call addr_print with 'call_site - 1' to get the "real" address of the calling statement. This works nicely, but I still find it strange that call_site is always "wrong". There must be a reason... To find the "real" address of the called function, I now use code copied from addr2line from the dwfl library to identify the subprogram DIE that 'this_fn' belongs to. The 'decl_line' attribute of that DIE is the line number that I was looking for. Malte