diff --git a/ide/src/ide.ec b/ide/src/ide.ec index 0c0887878e..9a850ea19b 100644 --- a/ide/src/ide.ec +++ b/ide/src/ide.ec @@ -1462,6 +1462,7 @@ class IDE : Window projectRegenerateItem.disabled = !projectView; projectCompileItem.disabled = !projectView; + /* What is this? This completely ignore the debugger's state! debugStartResumeItem.disabled = !projectView; // && project.targetType == executable); debugRestartItem.disabled = true; debugBreakItem.disabled = true; @@ -1474,6 +1475,8 @@ class IDE : Window debugSkipStepOverItem.disabled = true; debugSkipStepOutItem.disabled = true; debugSkipRunToCursorItem.disabled = true; + */ + DebugUpdateMenus(ide.debugger.state, false); viewProjectItem.disabled = !projectView; } diff --git a/ide/src/project/ProjectView.ec b/ide/src/project/ProjectView.ec index c6e32bea28..0d6cda34db 100644 --- a/ide/src/project/ProjectView.ec +++ b/ide/src/project/ProjectView.ec @@ -1273,8 +1273,29 @@ class ProjectView : Window { DirExpression targetDir = prj.targetDir; - if(buildType != run/* && prj == project*/ && prj.configIsInDebugSession) - DebugStop(); + // TOFIX: DebugStop is being abused and backfiring on us. + // It's supposed to be the 'Debug/Stop' item, not unloading executable or anything else + + // configIsInDebugSession seems to be used for two OPPOSITE things: + // If we're debugging another config, we need to unload the executable! + // In building, we want to stop if we're debugging the 'same' executable + if(buildType != run) ///* && prj == project*/ && prj.configIsInDebugSession) + { + if(buildType == debug) + { + if(ide.debugger && ide.debugger.isPrepared) + { + DebugStop(); + } + } + else + { + if(ide.project == prj && ide.debugger && ide.debugger.prjConfig == prj.config && ide.debugger.isPrepared) + { + DebugStop(); + } + } + } // TODO: Disabled until problems fixed... is it fixed? if(buildType == rebuild || (prj.config && prj.config.compilingModified))