This is a feature request to update operf to use additional information provided by the kernel via the PERF_SAMPLE_STACK_USER sample type. If this sample type is supported (kernel version 3.7?), then operf can pass the additional kernel data to libunwind to accurately ascertain the caller of a function.
Use the val4.c testcase to reproduce problems with callgraph which are hinted at in http://oprofile.sourceforge.net/doc/interpreting-callgraph.html. The logic flow in val4.c is:
main -> fn2 -> fn1
Steps to reproduce:
1. On Intel/RHEL 6.4, use stock gcc and compile thusly:
gcc -O1 val4.c -o val4_O1_stock
2. Then run 'operf -g ./val4_O1_stock'
3. Then 'opreport -c' will show an incorrect callgraph:
^^^^^^^^^^^^^^^
Compiling val4.c with either 'O0' or 'O1 -fno-omit-frame-pointer' seems to resolve or at least ameliorate the problem.
Last edit: Maynard Johnson 2013-10-16