ide/debugger: fixed problem where debugging a different config would still run the...
authorJerome St-Louis <jerome@ecere.com>
Mon, 6 Jun 2011 04:41:44 +0000 (00:41 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 6 Jun 2011 04:41:44 +0000 (00:41 -0400)
ide/src/ide.ec
ide/src/project/ProjectView.ec

index 0c08878..9a850ea 100644 (file)
@@ -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;
    }
index c6e32be..0d6cda3 100644 (file)
@@ -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))