This is a known problem that has existed for the last 10 years and was finally fixed in the nightly build in August 2021.
There are two options to resolve this as follows:
1) Grab the latest nightly C::B build and use it
2) Grab my latest unofficial C::B installers. See
https://forums.codeblocks.org/index.php/topic,24592.0.html for info
If you still cannot get it working please supply the following info:
1) Cygwin install directory
2) When you last updated Cygwin
3) GDB version
4) Code::Blocks version
5) Code::Blocks build date
6) Code::Blocks type - x86 or x64