我的 C++ 程序挂起,我将它附加到调试器并找到了这个堆栈跟踪,第 0 帧永远不会完成。这里出现问题的可能问题是什么?如果我可以收集更多信息,我仍然可以在调试器中使用它。还有其他线程。
#0 0xffffe410 in __kernel_vsyscall ()
#1 0x0083929b in write () from /lib/libc.so.6
#2 0x007d9cd4 in _IO_new_file_write () from /lib/libc.so.6
#3 0x007d9995 in new_do_write () from /lib/libc.so.6
#4 0x007d9c7f in _IO_new_do_write () from /lib/libc.so.6
#5 0x007da56e in _IO_new_file_overflow () from /lib/libc.so.6
#6 0x007d9b6c in _IO_new_file_xsputn () from /lib/libc.so.6
#7 0x007d012f in fwrite () from /lib/libc.so.6
#8 0x009a96f6 in ?? () from /usr/lib/libstdc++.so.6
#9 0x009ac66b in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) () from /usr/lib/libstdc++.so.6
#10 0x0822aa2c in printErrorMsg (format=0x848675f "#%2i %s: %s(...) %s [%p]\n") at myAssert.cpp:66
第 10 帧源代码为:
void
printErrorMsg(const char *format, ...)
{
va_list ap;
const int size = 4096;
char buffer[size];
va_start(ap, format);
vsnprintf(buffer, size, format, ap);
va_end(ap);
std::clog << buffer;
std::cout << buffer; // Code is hung here in frame 10.
}
该代码正在尝试打印堆栈跟踪。