使用-g和GCC -O2选项 [英] Using -g and -O2 options in gcc
问题描述
有谁经历过混合-g(调试符号)和-O2(最安全的优化)wuith gcc编译器?结果
我要分发到可以送我回去的核心文件最终用户发布程序的调试崩溃。结果
我一直习惯叫:
Does anybody experienced mixing -g (debugging symbols) and -O2 (best safe optimization) wuith gcc compiler?
I have to debug crashes of a release program distributed to final users that could send me back the core file.
I've always used to call:
&gdb的LT;< myprogram >><<核心文件>>
gdb << myprogram >> << core file >>
和看到的问题是。现在,我可以看到呼叫跟踪,但有我很麻烦没有调试符号。
and see where the trouble is. Now I can just see the call-trace but having no debugging symbols I'm quite in trouble.
任何想法?
推荐答案
我们在生产环境中,这使得调试容易得多,如果客户只看到一个崩溃一次同时使用两种。它给你一个pretty好主意,问题出在哪里(如果没有,这是一个内存破坏)。
We use both together in production environment, which makes debugging a lot easier if the customer have only seen a crash once. It gives you a pretty good idea where the problem is (not if it was a memory corruption).
在理论上增加-g真的不应该影响性能,虽然可执行文件变大。在嵌入式环境中,它是一个大的取舍。
In theory adding -g shouldn't really affect the performance, although the executable gets large. In embedded environment it is a big trade-off.
这篇关于使用-g和GCC -O2选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!