There are 2 possible problems:
the target exe was not found (this contains the symbol table required for gdb too): In most cases this is because the path of the exe contains spaces and Code Blocks passed the absolute path as -args. A workaround is to set Settings->Debugger settings->Default->Arguments to: -args bin\Debug\*.exe. CB passes this to gdb (the -args with the absolute pass fails but is ignored). This works as CB starts in the absolute project starting dir the gcc creates the exe in this local subdir. Using *.exe instead of <target>.exe works and does not require future manual changes. I have only tested with 1 exe in the bin/Debug subdir.
the program path of gdb.exe contains spaces -> set the complete path in "". Settings->Debugger settings->Default->Executable path (incl. gdb.exe)
All verified in latest version 20.03 with MinGW installed.