1

The title says it all.

This question is quite the same with this question. However, the difference is that now it is 2 years and 4 major versions of cygwin gdb later. I want to believe that keeping gdb at version 9 "forever", ignoring the updates done by its developers, is bad practice.


Background info: I was forced to switch to Cygwin C compiler, because MinGW compilers have sizeof(unsigned long) == 32, instead of my need (==64). That makes a great difference when paired with the GNU GMP library.

Until now, I used whatever compiler was available. And I actually preferred one of the MinGW packages, for having a working conio.h (but overall less important, and now I lost it). And changing the compiler / debugger to cygwin, I lost the ability to debug.

Of course, I would prefer to not recompile Codeblocks from sources, or do other hacks, if possible. :)

Debugger output (from debugger window in Codeblocks:

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: Z:\_progs\_progsData\cb\myprog\
Adding source dir: Z:\_progs\_progsData\cb\myprog\
Adding file: Z:\_progs\_progsData\cb\myprog\bin\Debug\myprog.exe
Changing directory to: Z:/_progs/_progsData/cb/myprog/.
Set variable: PATH=.;Z:\_progs\cygwin\bin;Z:\_progs\cygwin;Z:\_progs\cb_25_03\MinGW\bin;Z:\_progs\cb_25_03\MinGW;C:\ProgramData\Oracle\Java\javapath;C:\ORACLE\Oracle920\bin;C:\ORACLE\ORANT\BIN;C:\ORACLE\ORADEV6i\BIN;C:\ORACLE\ORADEV6i\jdk\bin;C:\Program Files (x86)\Oracle\jre\1.1.8\bin;C:\Program Files (x86)\Oracle\jre\1.3.1\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\y147694\AppData\Local\Microsoft\WindowsApps
Starting debugger: Z:\_progs\cygwin\bin\gdb.exe -nx -fullname -quiet  -args Z:/_progs/_progsData/cb/myprog/bin/Debug/myprog.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) (Cygwin 14.2-1) 14.2
Error creating process /cygdrive/z/_progs/_progsData/cb/myprog/Z:/_progs/_progsData/cb/myprog/bin/Debug/myprog.exe, (error 2: The system cannot find the file specified.)
Debugger finished with status 0

Codeblocks info (help -> about)

Name                    : Code::Blocks
Version                 : 25.03-r13644
SDK Version             : 2.25.0
Scintilla Version       : 3.7.5
Author                  : The Code::Blocks Team
E-mail                  : [email protected]
Website                 : https://www.codeblocks.org
OS                      : Windows 10 (build 19045), 64-bit edition
Scaling factor          : 1.000000
Detected scaling factor : 1.000000
Display PPI             : 96x96
Display count           : 2
Display 0 (\\.\DISPLAY1): XY=[0,0]; Size=[1920,1080]; Primary
Display 1 (\\.\DISPLAY2): XY=[1920,-115]; Size=[1920,1200];

wxWidgets Library (wxMSW port)
Version 3.2.7 (Unicode: wchar_t, debug level: 1),
compiled at Mar 25 2025 17:16:27

Runtime version of toolkit used is 10.0.19045.

Environment:

  • Windows 10 Pro, 22H2, 8 GB RAM

  • cygwin - up-to-date (all installed packages - also up-to-date)

  • cygwin setup: 2.934 (x86_64)

  • cygwin gdb (from the setup window): 14.2-1

  • mirror: mirrors.kernel.org (I used previously another mirror, but it had missing packages which I needed, changing the mirror fixed my problems)

3
  • I wonder why you need sizeof(unsigned long) == 64, and how GNU GMP plays into this. Commented Jul 22 at 13:55
  • @ssbssa: GNU GMP because I want to play with numbers bigger that can be handled by any current processor. And GNU GMP uses unsigned long as the integer type. So I cannot pass to GMP any number bigger than 2 ^ 32 - 1. And 64-bit processors were created for very good reasons. NOTE: that is "raise to power", not XOR. Commented Jul 22 at 14:30
  • Can you not debug cygwin applications with a mingw gdb? Commented Jul 23 at 12:30

1 Answer 1

1

This might not be a real answer, but was a little long for a comment.

I'm not a Cygwin user, but following the code through, I think the problem is this block here. This is the code that tells GDB if a path is absolute or not. I'm guess that this check (defined(_WIN32) && ! defined(__CYGWIN__)) means that GDB picks up the unix based logic rather than the DOS based logic.

What this means is that Z:/_progs/_progsData/cb/myprog/bin/Debug/myprog.exe is not seen as an absolute path (it doesn't start with /) and so GDB concatenates what it sees as a relative filename onto the current directory name, creating /cygdrive/z/_progs/_progsData/cb/myprog/Z:/_progs/_progsData/cb/myprog/bin/Debug/myprog.exe, which is clearly not right.

I know you are starting all of this via an IDE, so you might not have full control over all of these settings, but the easiest solution, which will work right away, would be to remove all DOS drive letters from your configuration, and switch to the cygwin, unix like paths, i.e. replace Z: with /cygdrive/z everywhere. I notice in the output you posted, it's not just the executable name that includes the drive letter. I'd assume that everywhere you see Z: that's a problem waiting to bite you.

Unfortunately, there's no way to make GDB accept the drive letters on Cygwin right now. This is going to require patches to the GDB source. There is already an upstream bug report here that looks into the background of why things are they way that are.

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

7 Comments

So it is not a bug, it is 2 features!! :)) One in Codeblocks and one in GDB...
The idea to use cygwin absolute paths is great, I will try it. But I have a hunch that Codeblocks will not accept them.
It would be great if Codeblocks would operate with relative paths, but it does not :( And Codeblocks runs outside of the cygwin environment, which means cygwin paths are unacceptable. And the root cause of everything seems to be the handshake between codeblocks and gdb :( - both of them make unverified assumptions.
The facepalm: The Windows paths on Windows are an "edge-case" and cygwin (traditional *nix program never intended to run on Windows, d'oh!) is not really at fault... No other comments.
I do not fully agree with your first statement - Windows but not cygwin == MinGW, AFAIK. I used MinGW, and it worked.
|

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.