Codeblocks doesn't stop at breakpoints

不羁岁月 提交于 2019-12-31 22:23:32

问题


I am trying to debug C++ project in Codeblocks, but it's not stopping at breakpoints. I read the other answers and have tried the following things so far:

  1. (Build Options > Compiler Settings) Produce debugging symbols is checked, strip all symbols is unchecked.
  2. No spaces/non-ascii values in my file path.
  3. Running the debug version.
  4. Debugger in (Settings > Compiler > Toolchain Executables) set to GDB/CDB Debugger:Default
  5. Executable path in (Settings > Debugger > GDB/CDB Debugger:Default) is C:\MinGW\bin\gdb.exe.

Its still not stopping at breakpoints and the debugger log is mentioning that no debugging symbols found What am I missing here ?


回答1:


While trying to fix this,I came across a lot of similar questions where CodeBlocks is ignoring breakpoints during debugging, so here's the fixes I have came across so far.

1.Clean and rebuild.
2.Ensure that (Build Options > Compiler Settings) Produce debugging symbols is checked, strip all symbols is unchecked. Please ensure this is done in global settings AND project settings.This fixed it for me.
3.Check so that there are no spaces/non-ASCII values in the project file path.
4.Check if you are running the debug version, not release.The executable from Release build will be \bin\Release , and the executable from a Debug build will be in \bin\Debug .
5. Check that Debugger in (Settings > Compiler > Toolchain Executables) is set to GDB/CDB Debugger:Default.
6.Check that executable path in (Settings > Debugger > GDB/CDB Debugger:Default) is valid gdb path like (C:\MinGW\bin\gdb.exe).
7.Update Codeblocks(last resort).
Please add in comments anything else that worked for you.




回答2:


I had this problem too, however, it was because a long time ago I'd set

Settings > Debugger > GDB / CDB Debugger > Default > Debugger initialization commands

to

"set follow-fork-mode child"

so GDB was actually debugging another program entirely.




回答3:


The only thing which worked for me:

Path with spaces

Breakpoints could not work if the path/folder you've placed your project contains spaces or other special characters. To be safe use English letters, digits and '_'.

Source: Debugging with Code::Blocks

Also you can check menu: Build->Select target->Debug




回答4:


For me the thing which worked was, to delete the file main.o, which is contained in obj/Debug.

Hope it helps someone.



来源:https://stackoverflow.com/questions/26481928/codeblocks-doesnt-stop-at-breakpoints

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!