User forums > Help

Project - compiler changes do not cause debugger to change

(1/4) > >>

AndrewCot:
On my PC I have Cygwin and MSYS2 (Mingw64), which I have both working with CB. I have created a options_msys2.xml for the MSYS2 migw64 and added it to the default.conf so I do not have to keep changing as the existing MSYS2 is for mingw32. This options and conf setup works in conjunction with multiple GDD configurations for the compilers as well, which is also in the default.conf.

I can use the one project file for both compilers and change the compiler in the Build Options, but when I swap between the two the GDB is not changed. The code does not reload the debugger on a compiler change.

Is this expected?

A work around is to change the compiler in the build options, save the project, close the project and then load it again.

Is the work around good enough or should the code be changed so that when you change compilers the debugger is also changed?

oBFusCATed:
The compiler can reference a debugger configuration.
And when you use Debug -> Active debugger -> Target's default this would be reflected correctly.
Or you can use this menu to select the debugger config you want to use.

AndrewCot:
Sorry, looks like I may not have been clear on the question.

If I load a project and then change the build option compiler, should CB change the debugger to the "new" debugger configured in the selected compiler?

If I load a project that is already configured for the CYGWIN compiler/debugger and then change the compiler via the build options to Mingw then the  Debug->Active debugger menu option is set to Target's default , BUT it still runs the Cygwin GDB and not the Mingw GDB that the MingW compiler is configured to use. I have attached the a screen snippet of the debugger options I have setup.


BTW: I have the Cygwin compiler configuration setup to use a Cygwin debugger configuration and the Mingw64 compiler configuration setup to use a Mingw64 debugger. These work correctly so long as I do NOT change between the two compiler configurations via the project's build options after loading the project without performing the work around.

oBFusCATed:
Works fine for me at least on linux with the CB project.
I have two compilers which have different debugger's configurations selected (settings -> compiler -> [my compiler] -> toolchain executables -> debugger) and if I switch and then use debug -> start it print the correct configuration in the log.

What are the exact steps to reproduce this problem?

AndrewCot:
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.

--- Code: ---cmdexe = GetActiveConfigEx().GetDebuggerExecutable();
--- End code ---


Navigation

[0] Message Index

[#] Next page

Go to full version