CB Setup Background:1. Configure a MSYS2 debugger configuration to use the C:\msys64\mingw64\bin\gdb.exe executable
2. Configure a Cygwin debugger to use the C:\cygwin64\bin\gdb.exe executable
3. Update the existing Cygwin compiler setup to use the Cygwin configuration from step 2)
4. Copy the existing GCC GNU compiler to "MSYS2 GNN GCC Compiler" and then modify it as follows:
4a. Change the install directory to C:\msys64\mingw64
4b. Change the exe filenames to match the "standard" GNU exe. Change the names to use the !windows config options from the options_gcc.xml fie with the exception of the db,windres and make as per the following snippet:
<Program name="C" value="gcc"/>
<Program name="CPP" value="g++"/>
<Program name="LD" value="g++"/>
<Program name="LIB" value="ar"/>
The windres and make are not changed, but the db is changed to reference the db from step 1) above
Create working CB Projects:1. Create a project for a simple hello world program configured for say Cygwin. Call the project as say "CygwinTest.cbp"
2. Start CB and load the project
3. Rename the C:\msys64 to c:\msys64.old
4. Build the project. If it fails then it is configured for msys2. Fix this and try building again
5. Run the debugger. If it fails then it is configured incorrectly or configured for MSYS2. Fix it and try again.
6. Save the project.
7. Rename the C:\msys64.old to c:\msys64
8. Save the project as as say "Msys2Test.cbp"
9. Select Project->Properties menu option.
10. Change the Title to "MSYS2 Test"
11. Select the Ok" button
12. Select Project->Build Options menu option.
13. Select default target on the left pane.
14. Change the selected compiler to MSYS2
15. Say "Yes" to the pop up dialogs
16. Save the project.
17. Rename the C:\cygwin64 to c:\cygwin64.old
18. Build the project. If it fails then it is configured for Cygwin. Fix this and try building again
19. Run the debugger. If it fails then it is configured incorrectly or configured for Cygwin. Fix it and try again.
20. Save the project.
21. Rename the C:\cygwin64.old to c:\cygwin64
Reproduce CB Debugger bug:1. Close CB
2. Load the "CygwinTest.cbp"
3. Build and run the debuger
4. In the debugger log check that the C:\cygwin64\bin\gdb.exe debugger was used.
5. Select Project->Build Options menu option.
6. Select default target on the left pane.
7. Change the selected compiler to MSYS2
8. Say "Yes" to the pop up dialogs
9. Rebuild the project
10. Run the debuger
11. In the debugger log check that the C:\cygwin64\bin\gdb.exe debugger was still used. This should have changed to C:\msys64\mingw64\bin\gdb.exe, but it did not!!!!
Notes:1. Be aware that the Cygwin and MSYS2 debuggers can debug both exe's produced.
Current Debugging Status:So far I have tracked the problem to debuggergdb.cpp following line that loads the wrong GDB.exe. The code above it correctly loads the currently selected compiler, which in the "Reproduce CB Debugger bug:" is the MSYS2 compiler.
cmdexe = GetActiveConfigEx().GetDebuggerExecutable();