本文介绍了-fno-omit-frame-pointer相当于clang的编译器选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 DS-5 Streamline Profiler 来分析我的代码。在其文档中提到要能够看到调用堆栈,我们需要使用编译器选项 -fno-omit-frame-pointer 来编译代码。此选项在gcc中。
还有clang的等效选项吗?

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

我也尝试将编译器优化级别设置为0,但仍然无法简化调用堆栈。

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

推荐答案

DS-5似乎是ARM的东西,因此可能不相关,但是我遇到了类似的问题,试图获得良好的堆栈使用Linux的来跟踪使用clang编译的可执行文件。

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.

问题最终是,至少在x86-64 Linux上,Clang需要 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer 以获得与gcc仅使用 -fno-omit-框架指针。看到以下LLVM错误:

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"

这篇关于-fno-omit-frame-pointer相当于clang的编译器选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 16:02