我用g++编写了一个简单的测试程序:
int main()
{
try
{
printf("before\n");
throw 1;
}
catch(int i)
{
printf("catched int\n");
}
catch(...)
{
printf("catched(...)\n");
}
}通常包括调试信息或不包含调试信息的情况下工作正常。但是当使用gdb进行调试时,它总是挂在“抛出1;”行上,因此我无法调试程序,这通常会引发异常。调试器的最后一个信息是:
Catchpoint 1 (exception thrown), 0x00007ffff7b8f9e0 in __cxa_throw () from /usr/lib/libstdc++.so.6我的汇编和链接选项:
g++ -Wshadow -Wunreachable-code -Wswitch-enum -Wswitch-default -Wextra -Wall -pg -g -m64 -c main.cpp
g++ -o exec/exception_problem obj/main.o -pg我的环境:Ubuntu10.10,64位;g++/gcc 4.4.5;gdb 7.2;在代码块svn rev 7440下调试
有什么问题吗?
其他信息: gdb日志的最后两行是:
Catchpoint 1 (exception thrown), 0x00007ffff7b8f9e0 in __cxa_throw () from /usr/lib/libstdc++.so.6
>>>>>>cb_gdb:日志中的最后一个字符是冒号。gdb命令行:
/usr/bin/gdb -nx -fullname -quiet -args exec/exception_problem 我在主目录中没有找到任何* gdbinit *;全局gdbinit是空的。是否有可能代码块准备特定的gdbinit并将其放到gdb中?
向大家致以最良好的祝愿。
发布于 2011-11-20 17:25:20
Catchpoint 1 (exception thrown) ...
你的.gdbinit里有什么你没告诉我们的吗?(也许是catch throw ?)
Catchpoint 1真的是GDB打印的最后一行吗?以下是我所看到的:
Reading symbols from /tmp/a.out...done.
Catchpoint 1 (throw)
(gdb) run
before
Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0x602090, tinfo=0x601060, dest=0) at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:70
70 ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc: No such file or directory.
in ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc
(gdb) c
catched int
[Inferior 1 (process 16008) exited normally]
(gdb) qhttps://stackoverflow.com/questions/8203194
复制相似问题