如何在Windows上设置gdb,以使其不允许具有断言失败的程序终止?我打算检查程序中的堆栈跟踪和变量。
例如,在gdb中运行使用MinGW编译的test.cpp程序'g++ -g test.cpp -o test
':
#include <cassert>
int main(int argc, char ** argv) { assert(1==2); return 0; }
提供:
$ gdb test.exe
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) r
Starting program: f:\code/test.exe
[New thread 4616.0x1200]
Error: dll starting at 0x77030000 not found.
Error: dll starting at 0x75f80000 not found.
Error: dll starting at 0x77030000 not found.
Error: dll starting at 0x76f30000 not found.
Assertion failed: 1==2, file test.cpp, line 2
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Program exited with code 03.
(gdb)
我希望能像Visual Studio的调试器和Linux上的gdb一样,停止程序立即终止。我已经搜索过一些关于捕获信号的内容,但似乎找不到一个好的帖子来设置gdb以实现这一点。