15

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 ?

4
  • You should also use optimisation -O0 (or maybe -O1). Verify if the function is called or the function calling your function is called somewhere. Linker may wipe out all unused code. Commented Oct 21, 2014 at 9:05
  • @j123b567: Thanks for the suggestion.I tried it,but got this - "Compiler Warning:You have debugging symbols enabled. This is not a good thing while optimizing." Also,Codeblocks is still ignoring breakpoints. Commented Oct 21, 2014 at 9:22
  • Can you step into your your function by clicking "step into" from the begining of the execution? Can you provide code snippet and highlited line you want to break? Commented Oct 22, 2014 at 12:42
  • No. However,making the global settings same as project settings and rebuilding the project fixed this for me. Commented Oct 24, 2014 at 4:10

4 Answers 4

20

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 <project_dir>\bin\Release , and the executable from a Debug build will be in <project_dir>\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. 8.See if you have another MinGW, if yes then see which MinGW is the correct one to use with your code bloks. You can change them by accesing Settings > Compiler > Toolchain Executables > Compiler's installation directory.

Sign up to request clarification or add additional context in comments.

4 Comments

My problem is that debugger actually stops at the breakpoint but C::B still thinking that the program is running, so it doesn't stop. Do you have any solution for that?
My path has greek characters. Solved with 3. (statistics).
My path has Chinese characters (but no space). Solved with 3. (for statistics).
Out of curiosity, since number two fixed it for you, what is your policy set to. I have mine set to "Append Target Options to Project Options".
3

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.

Comments

1

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

Comments

0

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

Hope it helps someone.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.