User forums > Help

Project - compiler changes do not cause debugger to change

<< < (2/4) > >>

AndrewCot:
Debugging analysis update below on what I have found in addition to the previous posts is below:

The root cause of the issue is that the current CB code does not call eventually call the cbDebuggerPlugin::SetActiveConfig(int index) in cbpplugin as this changes the CB debugger that is to be used when you start the debugger. This causes the debug config to not update, which then causes the cmdexe = GetActiveConfigEx().GetDebuggerExecutable(); line to return the previous exectable file!!!!

I have been able to proof this be hacking the code by adding the following lines to the derbuggergdb.cpp before the cmdexe = GetActiveConfigEx().GetDebuggerExecutable(); line:

--- Quote ---    CodeBlocksEvent event2(cbEVT_SETTINGS_CHANGED);
    event2.SetInt(cbSettingsType::Compiler);
    Manager::Get()->ProcessEvent(event2);
--- End quote ---

THIS IS A HACK AS POC that my conclusion about calling SetActiveConfig(..) is correct.

This code is not correct in that it should be somewhere else in the code and potentially be a different block of code that fits better where the change should be done, but the code should still  end up calling the void DebuggerManager::FindTargetsDebugger() function as this is the function that I have found that should be called when you change the compiler based on my findings as it changes the debugger associated with the new compiler settings.  Be aware that I am not familiar with the Cb code and the correct function to call could be some other function.

AndrewCot:
I have found in the \src\plugins\compilergcc\compileroptionsdlg.cpp file in the void CompilerOptionsDlg::ProjectTargetCompilerAdjust() function if I add the following block at the end of the function and set the new boolean to true only when the code calls either of the SetCompilerID(...) function calls then I can change the compiler from MSYS2 to Cygwin or vice versa as many times I want in the project build options and the correct debugger executable is then called.


--- Code: ---    if (bNotifyUpdate == true)
    {
        CodeBlocksEvent event2(cbEVT_SETTINGS_CHANGED);
        event2.SetInt(cbSettingsType::Compiler);
        Manager::Get()->ProcessEvent(event2);
    }
--- End code ---


Is this an acceptable solution? If not point me in the right direction please.

oBFusCATed:
Nope, this is not acceptable, because cbEVT_SETTINGS_CHANGED is something related to the global settings.
I suppose the problem happens because m_activeDebugger in DebuggerMenuHandler and DebuggerManager are not updated appropriately.

Probably this is the same issue as this one: https://sourceforge.net/p/codeblocks/tickets/611/

AndrewCot:
Thanks for the feedback. How about the following as a solution:

--- Code: ---    if (bNotifyUpdate == true)
    {
        Manager::Get()->GetDebuggerManager()->SetTargetsDefaultAsActiveDebugger();
    }
--- End code ---

Ticket 611 is different to this as ticket 611 is if I have read it correctly is that the devs have changed the compiler paths manually, but no the debugger exe and as such the debugger exe is referencing a non existent executable and then when they run the debugger the code  cmdexe = GetActiveConfigEx().GetDebuggerExecutable() loads the non existent directory into the cmdexe variable, but it is not checked to see if it is valid in the cbplug.cpp between lines approx 771 and line 943 where the debugger is launched.

My issue and ticket 611 are different, but related in that the symptom may be interpreted as the same as the debugger does not work, but they are not the same.

oBFusCATed:
Nope, I'll post a patch later...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version