-fno-omit-frame-pointer equivalent compiler option for clang

5.6k views Asked by At

I want to use DS-5 Streamline profiler to profile my code. In the documentation its mentioned that to be able to see call stacks, we need to compile code with compiler option -fno-omit-frame-pointer. This option is there in gcc. Is there an equivalent option for clang also?

-fno-omit-frame-pointer is not working for me with clang.

I have also tried setting the compiler optimization level to 0, but still I am not getting call stacks in streamline.

1

There are 1 answers

0
Jason C On

It looks like DS-5 is an ARM thing, so this might not be relevant, but I ran into a similar issue trying to get good stack traces out of a clang-compiled executable using Linux's perf profiler.

The problem ended up being that, on x86-64 Linux at least, Clang requires both -fno-omit-frame-pointer and -mno-omit-leaf-frame-pointer in order to get the same behavior that gcc gives with only -fno-omit-frame-pointer. See this LLVM bug: "Need both -fno-omit-frame-pointer and -mno-omit-leaf-frame-pointer to get a fp on linux on a leaf function"