Hello, I need some help with tracing function calls using function instrumentation (__cyg_profile_func_enter and __cyg_profile_func_exit) as suggsted in the GDB FAQ (http://sourceware.org/gdb/wiki/FAQ#line-62). Jan Kratochvil's itrace mentioned in the FAQ can be used to print the names of both the called function and the calling function. It uses the elfutls/dwfl library to retrieve the DWARF information. I tried to extend itrace to also give the name of the source file and the line numbers for each function call. But I found that the line numbers always seems to refer to the "next" unit in the source code, e.g. to the compound statement instead of to the declarator for this_fn (the caller) and to the statement after the actual function call for the call_site (callee). This effect might be caused to the way instrumentation works. I don't suspect the DWARF information and the dwfl library to be wrong. But of course there could easily be a flaw in my use of the dwfl library. Here is - without most declarations and all error checking (some return values can be NULL) - how I try to retrieve the source information for 'this_fn' and 'call_site': static const char *addr_print (void *addr) { Dwarf_AAdrr address = (ptrdiff_t) addr; Dwfl *dwfl = dwfl_get (); ... mod = dwfl_addrmodule (dwfl, address); name = dwfl_module_addrname (mod, address); line = dwfl_module_getsrc (mod, address); fname = dwfl_lineinfo (line, NULL, &lineno, &colno, NULL, NULL); ... } If the is a value written to 'lineno at' all, it is "off by one". Finding the "real" line number for a function definiton given the line number of its statement block should be easy. Finding the "real" line number of the statement with the function call given the line number of the next statement might be much harder. So, two questions: Are the source references really "off by one" or is it all my fault? And if it is not my fault: How do I get the correct line numbers (in order to link into the Doxygen documentation). Thanks, Malte