Search code examples
cdebugginggdbcodeblocks

CodeBlocks Debugger Not Working. Error Creating Process (error 2)


I installed the gnu gcc compiler for c and when I installed codeblocks everything was working fine except the debugger. The program even compiles and runs but the debugger wont start.

This is the message in the debugger tab. It ends with error 2.

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target: 
Debug
Adding source dir: D:\Projects\LearningC\
Adding source dir: D:\Projects\LearningC\
Adding file: D:\Projects\LearningC\bin\Debug\LearningC.exe
Changing directory to: D:/Projects/LearningC/.
Set variable: PATH=.;C:\cygwin64\bin;C:\cygwin64;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\aayus\AppData\Local\Microsoft\WindowsApps

[debug]Command-line: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet  -args D:/Projects/LearningC/bin/Debug/LearningC.exe
[debug]Working dir : D:\Projects\LearningC

Starting debugger: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet  -args D:/Projects/LearningC/bin/Debug/LearningC.exe
done

[debug]Reading symbols from D:/Projects/LearningC/bin/Debug/LearningC.exe...
[debug](gdb) 
[debug]> set prompt >>>>>>cb_gdb:

Setting breakpoints

[debug]>>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) (Cygwin 10.2-1) 10.2
[debug]Copyright (C) 2021 Free Software Foundation, Inc.
[debug]License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[debug]This is free software: you are free to change and redistribute it.
[debug]There is NO WARRANTY, to the extent permitted by law.
[debug]Type "show copying" and "show warranty" for details.
[debug]This GDB was configured as "x86_64-pc-cygwin".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<https://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]    <http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb (GDB) (Cygwin 10.2-1) 10.2

[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory D:/Projects/LearningC/
[debug]Source directories searched: /cygdrive/d/Projects/LearningC/D:/Projects/LearningC:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Error creating process /cygdrive/d/Projects/LearningC/D:/Projects/LearningC/bin/Debug/LearningC.exe, (error 2).
[debug]Starting program: /cygdrive/d/Projects/LearningC/D:/Projects/LearningC/bin/Debug/LearningC.exe 
[debug]>>>>>>cb_gdb:

Error creating process /cygdrive/d/Projects/LearningC/D:/Projects/LearningC/bin/Debug/LearningC.exe, (error 2).

[debug]> quit

Debugger finished with status 0

It would be really helpful if someone could help me. Its just a simple helloworld program.


Solution

  • It seems the issue is with the lastest gdb version. I went back to gdb 9.x and it was working fine.