【发布时间】:2014-05-07 11:29:58
【问题描述】:
我一直在尝试使用 gdb 调试段错误,但它显示“?? ()”步骤中出现错误,我无法弄清楚其含义。任何人都可以提示这是什么意思?
相关的回溯贴在下面。
(gdb) run
> (list-partition gt3 (quote (1 2 3 4 5)))
Program received signal SIGSEGV, Segmentation fault. 0xb7d900ac in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) bt 10
#0 0xb7d900ac in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xb7d92dec in malloc () from /lib/i386-linux-gnu/libc.so.6
#2 0xb7f8d627 in operator new(unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#3 0xb7f727d4 in std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#4 0xb7f74a48 in char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0xb7f74bb6 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0x080527fa in SymbolCell::get_symbol (this=0x80641e0) at SymbolCell.cpp:63
#7 0x080524c2 in SymbolCell::get_value (this=0x80641e0) at SymbolCell.cpp:88
#8 0x08053c20 in ConsCell::get_value (this=0x8064190) at ConsCell.cpp:195
#9 0x0804f287 in eval_pure (c=0x8064190) at eval_util.cpp:683 (More stack frames follow...)
还有一点值得注意的是,程序实际上运行了几秒钟才产生这个bug,这在程序的行为上下文中是相当不正常的。
感谢任何建议!提前致谢!
【问题讨论】:
-
你的等级太低了。往上走几帧,你会看到问题从
SymbolCell::get_symbol开始。专注于此,因为malloc和您的操作系统不是罪魁祸首! -
看看这里:stackoverflow.com/questions/1441017/… 可能您的堆已损坏。对于 ??,它只是意味着没有链接到调试信息来查找地址 0xb7d900ac 处的函数名称
-
@LightnessRacesinOrbit 谢谢!肯定是我的程序有问题,而不是我知道的库。
标签: c++ gdb segmentation-fault