Code::Blocks - GDB does not see breakpoints in the CMake project

Continuing to get acquainted with Code:: Blocks came across an incomprehensible behavior. If the project is created using CMake-GDB does not see breakpoints in the project, выполнить до текущей позиции also does not work.. Executes all code, non-stop.

enter a description of the image here

What does GDB write about this?:

Starting debugger: C:\MSVS\CodeBlocks\MinGW\bin\gdb32.exe -nx -fullname -quiet  -args C:/__BuildSorce/T-CMAKE/t1/winext/codeblock/TestWchar2ext.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.9.1
No source file named C:/__BuildSorce/T-CMAKE/t1/test/check_wchar2_MSVC.c.
Temporary breakpoint 3 ("C:/__BuildSorce/T-CMAKE/t1/test/check_wchar2_MSVC.c:150") pending.
Child process PID: 3408
[Inferior 1 (process 3408) exited normally]
Debugger finished with status 0

Just in case, I added the path to the source of the executable file, it is actually one, it did not help..

enter a description of the image here

Apparently he can't find the source code after all check_wchar2_MSVC.c, how else can I tell him where to look?

Author: NewView, 2018-07-28

1 answers

If the debugger does not see breakpoints, it means that information about them did not get into the compiled executable file.

In order for the program to be debugged (and this is not only breakpoints, but also step-by-step tracing and viewing variable values), you need to pass the following command-line parameters to the compiler:

  • -g - provide the executable file with debugging information that the debugger can use to map machine instructions to source code strings. the code.
  • -Og - cancel all previously declared -O-parameters and enable a minimal set of optimizations that do not interfere with debugging. Since Code:: Blocks adds custom parameters to the end of the compiler command line, after its own, this flag allows you to temporarily override the project settings during debugging.
 2
Author: Arhadthedev, 2018-07-29 08:25:30