From 15dd70a18ecbd8bdfccfd6ed2f179090f03de825 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Sun, 29 May 2011 20:03:54 -0400 Subject: [PATCH] ide: tweaked code related to managing (or not) debug session when compiling. fixed writing target while loaded in gdb. related to mantis issues 592, 589, 435. --- ide/src/debugger/Debugger.ec | 9 ++------- ide/src/ide.ec | 2 +- ide/src/project/Project.ec | 20 ++++++++++++++++++++ ide/src/project/ProjectView.ec | 8 ++++---- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ide/src/debugger/Debugger.ec b/ide/src/debugger/Debugger.ec index 8364573..977e759 100644 --- a/ide/src/debugger/Debugger.ec +++ b/ide/src/debugger/Debugger.ec @@ -621,13 +621,8 @@ class Debugger // PUBLIC MEMBERS - property bool isActiveForCurrentConfig - { - get - { - return ide.project && ide.project.config == prjConfig && (state == running || state == stopped) ? true : false; - } - } + property bool isActive { get { return state == running || state == stopped; } } + property bool isPrepared { get { return state == loaded || state == running || state == stopped; } } void Resume() { diff --git a/ide/src/ide.ec b/ide/src/ide.ec index fd926d1..0c08878 100644 --- a/ide/src/ide.ec +++ b/ide/src/ide.ec @@ -1545,7 +1545,7 @@ class IDE : Window bool DontTerminateDebugSession(char * title) { - if(debugger.isActiveForCurrentConfig) + if(debugger.isActive) { if(MessageBox { type = yesNo, master = ide, contents = "Do you want to terminate the debugging session in progress?", diff --git a/ide/src/project/Project.ec b/ide/src/project/Project.ec index cbe594d..63d87f2 100644 --- a/ide/src/project/Project.ec +++ b/ide/src/project/Project.ec @@ -855,6 +855,26 @@ private: } //SetBool excludeFromBuild; + property bool configIsInActiveDebugSession + { + get + { +#ifndef MAKEFILE_GENERATOR + return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isActive; +#endif + } + } + + property bool configIsInDebugSession + { + get + { +#ifndef MAKEFILE_GENERATOR + return ide.project == this && ide.debugger && ide.debugger.prjConfig == config && ide.debugger.isPrepared; +#endif + } + } + void SetPath(bool projectsDirs) { #ifndef MAKEFILE_GENERATOR diff --git a/ide/src/project/ProjectView.ec b/ide/src/project/ProjectView.ec index 1735968..f87f5bb 100644 --- a/ide/src/project/ProjectView.ec +++ b/ide/src/project/ProjectView.ec @@ -822,7 +822,7 @@ class ProjectView : Window ~ProjectView() { - ide.debugger.Stop(); + DebugStop(); ide.DestroyTemporaryProjectDir(); if(project) { @@ -982,7 +982,7 @@ class ProjectView : Window if(node) prj = node.project; } - if(prj != project || !ide.DontTerminateDebugSession("Project Build")) + if(/*prj != project || */!prj.configIsInDebugSession || !ide.DontTerminateDebugSession("Project Build")) BuildInterrim(prj, build, false); return true; } @@ -1247,8 +1247,8 @@ class ProjectView : Window { DirExpression targetDir = prj.targetDir; - if(buildType != run && prj == project && ide.debugger.isActiveForCurrentConfig) - ide.debugger.Stop(); + if(buildType != run/* && prj == project*/ && prj.configIsInDebugSession) + DebugStop(); // TODO: Disabled until problems fixed... is it fixed? if(buildType == rebuild || (prj.config && prj.config.compilingModified)) -- 1.8.3.1