更改gcc / g ++版本会导致segfault [英] Changing gcc/g++ version causes segfault
问题描述
似乎将使用的gcc版本从 gcc 4.7.3
更改为 gcc 4.9.2
It seems that changing the version of gcc I use from gcc 4.7.3
to gcc 4.9.2
causes a segfault for my project (after a clean build and run).
在一个不幸的事件中, gdb
是一个不完整的事件断开在服务器上我是
得到这个错误,现在不能使用它。任何已知的变化在gcc本身,可能会导致这个?我怀疑这个问题可能是由双重释放引起的。
In an unfortunate turn of events gdb
is broken on the server I am
getting this error on and can't use it for now. Any known changes in gcc itself that could cause this? I suspect the issue is potentially caused by a double free.
推荐答案
您应该尝试使用valgrind。
You should try to use valgrind.
Valgrind是一个调试工具,只需要使用-g标志来编译代码。这是在程序或任何内存泄漏时发现分段错误的最佳方法。
Valgrind is a debugging tool only requiring for your code to be compiled with the -g flag. It's the best way to spot segmentation fault over a program, or any memory leak.
想想在调试时使用valgrind选项(它在valgrind报告的底部)像leak-checkfull(我现在不能运行valgrind,所以我不能告诉你它是什么)。
Think about using valgrind options while debugging (it's at the bottom of the valgrind report) something like leak-checkfull (I'm not able to run valgrind right now so I can't tell you exactly what it is).
但是每当我编译我的代码,我使用valgrind与它检查每一个可能的失败。考虑甚至在您的Makefile规则中添加VG以更简单。
But whenever I compile my code, I use valgrind with it to check every possible failure. Consider even putting VG in your Makefile rules for more simplicity.
这篇关于更改gcc / g ++版本会导致segfault的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!