On Windows on an initial install (or if you delete the %appdata%/CodeBlocks directory) GDB.exe is not auto detected. It would be nice for newbies to have this feature.
I would hope the auto detection of GDB could be done after the user selected a default compiler so the default compiler path can then be used to detect GDB.exe if the debugger is not all ready setup. When the solution is coded it may need an additional executable name in the options*.XML file for the debugger executable to use instead of trying to guess it.
I have not checked, but I expect that this may also affect Linux.
The code changes to resolve this ticket is available from the following github branch:
https://github.com/acotty/codeblocks_sf/tree/AC-GDB_AutoDetect
I have locally applied the changes and resolved issues found against the latest C::B SF code (12648 from 14JAN2022), but due to a problem with a potential issue with config saving as per the https://forums.codeblocks.org/index.php?topic=24800.msg169102;topicseen#msg169102 forum post I will be waiting for responses to the post before attaching the patch. This is because the patch requires changes that are in the forum post, but other developers may have a better way of resoling the potential problem.
Please find attached two patches for feedback. This includes files changes for ticket https://sourceforge.net/p/codeblocks/tickets/1179/ as these changes are required for the updated config data to be saved correctly. Once 1179 has been applied I will generate another patch without the changes in it that can then be applied.
The two patches are:
SF_1114_GDB_Autodetect_code_v1.patch
SF_1114_GDB_Autodetect_configxml_v1.patch
The code patch has the code changes and the configxml has the src/plugins/compilergcc/resources/compilers/options_*.xml changes to hopefully make it a bit easier to review the changes.