Help using elfutils to get function and line number

Frank Ch. Eigler fche at redhat.com
Mon Mar 16 19:57:59 UTC 2009


Hi -

> I am trying to implement a library which substitutes libc (using
> LD_PRELOAD), in order to be able to inject errors into programs
> under test making standard library calls (e.g. fopen, malloc,
> etc.). I would like to log the backtrace when such a call is made,
> to see the execution path which lead to the error. [...]


(We're not quite there yet, but this sort of thing will be pretty
easy to express with systemtap, as in ...)

# inject a fault
probe process("/lib/libc.so.6").function("fread_unlocked").return { $fp->_flags |= 4 }
# print the backtrace
probe process("/lib/libc.so.6").function("fclose") { print_backtrace() }


- FChE


More information about the elfutils-devel mailing list