问题
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:
- (
Build Options > Compiler Settings
)Produce debugging symbols
is checked,strip all symbols
is unchecked. - No spaces/non-ascii values in my file path.
- Running the debug version.
- Debugger in (
Settings > Compiler > Toolchain Executables
) set toGDB/CDB Debugger:Default
- Executable path in (
Settings > Debugger > GDB/CDB Debugger:Default
) isC:\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