使用 gdb 在问号中显示段错误进行调试 函数"?? ()"

Debugging with gdb showing segfault in question marks function "?? ()"

本文关键字:调试 函数 gdb 错误 显示 段错误 使用      更新时间:2023-10-16

我一直在尝试调试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...)

另一件值得注意的事情是,程序实际上在生成这个错误之前运行了几秒钟,这在程序的行为上下文中是相当不正常的。

感谢任何建议!提前感谢!

??()表示gdb找不到符号信息。这对于您的问题来说是不必要的,因为堆栈已经深入到库代码中,并且string/new/malloc已经经过了很好的测试。从SymbolCell::get_symbol的第6帧开始查找问题

edit:我刚刚注意到你实际上是在运行lisp代码,所以你可能遇到了lisp环境的一些问题,或者更有可能是内存不足。