最近使用CodeLite(我使用的TDM-GCC 5.1.0版本编译器)写了个简单的C++程序,调试的时候发现,程序不进断点运行完就退出了,可编译器和调试器的设置都是对的啊。更诡异的是在命令行使用CodeLite调用的GDB程序直接调试程序却能正确的捕捉到断点。因而上网搜索,在StackOverflow上获得了一个回答,是这样说的:html
尝试打开Settings -> Debugger Settings -> GNU gdb debugger -> Misc -> Enable debugger full logging选项来获取更详细的CodeLite与GDB之间的交互信息,这样就能够知道GDB中止运行的缘由。输出的日志会打印在"Debugger"面板的"Output"标签页。git
因而去勾选上调试器设置的“Enable debugger full logging”选项github
F5调试源程序,在output标签中得到下面的日志输出redis
Debug session started successfully! GNU gdb (GDB) 7.9.1 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type "show copying"\nand "show warranty" for details. This GDB was configured as "x86_64-w64-mingw32".\nType "show configuration" for configuration details. \nFor bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./CppTest... done. >> Debuggee process ID: 6956 [New Thread 6956.0x1b8] Continuing... [New Thread 6956.0x34cc] \nTemporary breakpoint 1, main () at F:/codes/CodeLite/CppTest/main.cpp:18 18\t\tX x; Internal breakpoint was hit (id=1), Applying user breakpoints and continuing C:/crossdev/src/gdb-7.9.1/gdb/cp-namespace.c:341: internal-error: cp_search_static_and_baseclasses: Assertion `name[prefix_len + 1] == ':'' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nQuit this debugging session? (y or n) [answered Y; input not from terminal] C:/crossdev/src/gdb-7.9.1/gdb/cp-namespace.c:341: internal-error: cp_search_static_and_baseclasses: Assertion `name[prefix_len + 1] == ':'' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nCreate a core file of GDB? (y or n) [answered Y; input not from terminal] Debug session ended
注意到错误信息 internal-error: cp_search_static_and_baseclasses: Assertion `name[prefix_len + 1] == ':'' failed.\n,根据这条错误信息咱们查到了下面的相关的地址session
https://github.com/eranif/codelite/issues/873ui
经过这两个网页获得的信息,咱们知道了是TDM-GCC 5.1.0带着的7.9.1版本的GDB的BUG,切换到之前的版本的GDB就好了。并且经试验当前最新的7.12版本也没有这个问题。至此,问题解决。spa