1

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.

10
  • Stupid question: do you have write access to the D: drive? Commented Oct 5, 2021 at 7:48
  • the error is still there even when I do It on the c drive where windows is installed. I am newbie so sorry if I am asking stupid questions. Commented Oct 5, 2021 at 8:00
  • 1
    I didn't call your question stupid, it was my question in the comment above which was the stupid one, since it's a pretty obvious thing to check first of all :) Commented Oct 5, 2021 at 8:04
  • Anyway, some things to check: settings -> debugger -> GDB -> default. Is the path there correct? And below settings -> compiler -> Toolchain executables tab, you can click "auto detect" and all paths should get fixed. It should say Debugger: GDB in that same tab too. Commented Oct 5, 2021 at 8:11
  • I checked everything. The debugger path is C:\cygwin64\bin\gdb.exe and the compiler path after clicking auto detect is C:\cygwin64 and the debugger is GDB/CDB. Commented Oct 5, 2021 at 8:53

1 Answer 1

1

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

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

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.