简体   繁体   中英

Codeblocks doesn't stop at breakpoints

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 ?

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.

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.

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

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

Hope it helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM