It was said that GDB 11 or above does not work well with Eclipse with Cygwin. The true reason seems to be that Eclipse sends Windows-style path of your executable to GDB of Cygwin, while GDB of cygwin does not recognize “C:\” as beginning of an absolute path. So GDB will start end up some ugly combined path like

/cygdrive/c/Users/yourname/Desktop/C:/store/your-project-name/C:/store/your-project-name/Debug/your-project-name.exe

I haven’t found a beautiful way to work around it as GDB does not fix this problem, and Eclipse developers insist this as a problem of GDB. So, stalemate.

But, I am not going to get jammed here. GDB wants that path? I give GDB the path.

So, under Cygwin, I make a symbolic link like the following:

mkdir -p "/cygdrive/c/Users/yourname/Desktop/C:/store/your-project-name/C:"
cd "/cygdrive/c/Users/yourname/Desktop/C:/store/your-project-name/C:"
ln -s /cygdrive/c/store store

This will let GDB find your executable.

What if you cannot be sure the path that GDB is looking at? Don’t worry! Follow this operation path. Window > Preferences > C/C++ > Debug > GDB, check “Show the GDB traces consoles with character limit:”. Run debugging again. Then in the console tab, open the console named “… gdb traces”. The path that GDB looks for will be in it.

Eclipse cannot find source files when debugging? Don’t worry! I bet you see window reporting “Can’t find a source file at …”. Then click the “Edit Source Lookup Path …” button. Then Add > Path Mapping > OK >(enter a new mapping name, e.g. “cygwin”) > Add . Enter “/cygdrive/c/” as the “Compilcation path”, select “C:\” as Local file system path. Repeat this adding operation until all source files are found.

By the way, if you get some strange exit code when starting GDB, like 0xc0000135 or something alike, be sure to look into environment variable settings. Your system PATH variable, project environment variables in Debug settings. Be sure to set a complete list of paths or nothing.

But there is still a drawback. I still have not found how to make breakpoint work. …

So, the better solution may still be installing gdb 9.2-1. If you cannot find it in your Cygwin setup program, try using another mirror.