Changeset 4947 for branches/HeuristicLab.DebugEngine
- Timestamp:
- 11/26/10 17:14:16 (14 years ago)
- Location:
- branches/HeuristicLab.DebugEngine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DebugEngine/DebugEngine.cs
r4946 r4947 48 48 Log = cloner.Clone(original.Log); 49 49 ExecutionStack = cloner.Clone(original.ExecutionStack); 50 OperatorTrace = cloner.Clone( OperatorTrace);50 OperatorTrace = cloner.Clone(original.OperatorTrace); 51 51 operatorParents = original.operatorParents.ToDictionary(kvp => cloner.Clone(kvp.Key), kvp => cloner.Clone(kvp.Value)); 52 52 pausePending = original.pausePending; … … 94 94 95 95 [Storable] 96 private bool ignoreNextBreakpoint;97 98 [Storable]99 96 private IOperation currentOperation; 100 97 public virtual IOperation CurrentOperation { … … 122 119 private Dictionary<IAtomicOperation, IAtomicOperation> operatorParents; 123 120 121 public virtual bool CanContinue { 122 get { return CurrentOperation != null || ExecutionStack.Count > 0; } 123 } 124 125 public virtual bool IsAtBreakpoint { 126 get { return CurrentAtomicOperation != null && CurrentAtomicOperation.Operator != null && CurrentAtomicOperation.Operator.Breakpoint; } 127 } 128 124 129 #endregion 125 130 … … 140 145 base.Prepare(); 141 146 ExecutionStack.Clear(); 142 ignoreNextBreakpoint = false;143 147 CurrentOperation = null; 144 148 OperatorTrace.Clear(); … … 151 155 if (initialOperation != null) 152 156 ExecutionStack.Add(initialOperation); 153 ignoreNextBreakpoint = false;154 157 CurrentOperation = null; 155 158 OperatorTrace.Clear(); … … 165 168 OnStarted(); 166 169 lastUpdateTime = DateTime.Now; 167 ignoreNextBreakpoint = true;168 170 timer.Start(); 169 171 ProcessNextOperation(); … … 172 174 timer.Stop(); 173 175 ExecutionTime += DateTime.Now - lastUpdateTime; 174 ignoreNextBreakpoint = false;175 176 OnPaused(); 176 177 } … … 202 203 stopPending = true; 203 204 if (currentOperator != null) currentOperator.Abort(); 204 ignoreNextBreakpoint = false;205 205 if (ExecutionState == ExecutionState.Paused) OnStopped(); 206 206 } … … 222 222 lastUpdateTime = DateTime.Now; 223 223 timer.Start(); 224 while (!pausePending && !stopPending && CanContinue) {224 if (!pausePending && !stopPending && CanContinue) 225 225 ProcessNextOperation(); 226 } 226 while (!pausePending && !stopPending && CanContinue && !IsAtBreakpoint) 227 ProcessNextOperation(); 227 228 timer.Stop(); 228 229 ExecutionTime += DateTime.Now - lastUpdateTime; 229 230 230 if (pausePending) OnPaused(); 231 else OnStopped(); 231 if (IsAtBreakpoint) 232 Log.LogMessage(string.Format("Breaking before: {0}", CurrentAtomicOperation.Operator.Name)); 233 if (pausePending || IsAtBreakpoint) 234 OnPaused(); 235 else 236 OnStopped(); 232 237 } 233 238 … … 241 246 #region Methods 242 247 243 public virtual bool CanContinue { 244 get { return CurrentOperation != null || ExecutionStack.Count > 0; } 245 } 248 246 249 247 250 /// <summary> … … 274 277 } 275 278 GenerateOperationTrace(); 276 } 277 catch (Exception x) { 279 } catch (Exception x) { 278 280 OnExceptionOccurred(x); 279 281 } … … 298 300 protected virtual void PerformAtomicOperation(IAtomicOperation operation) { 299 301 if (operation != null) { 300 if (operation.Operator.Breakpoint) {301 if (ignoreNextBreakpoint) {302 ignoreNextBreakpoint = false;303 } else {304 ignoreNextBreakpoint = true;305 Log.LogMessage(string.Format("Breaking before: {0}", Name(operation)));306 Pause();307 return;308 }309 }310 302 try { 311 303 currentOperator = operation.Operator; … … 317 309 currentOperator = null; 318 310 CurrentOperation = null; 319 } 320 catch (Exception ex) { 311 } catch (Exception ex) { 321 312 OnExceptionOccurred(new OperatorExecutionException(operation.Operator, ex)); 322 313 Pause(); -
branches/HeuristicLab.DebugEngine/DebugEngineView.cs
r4909 r4947 95 95 refreshButton.Enabled = false; 96 96 } else { 97 stepButton.Enabled = Content.CanContinue ;98 refreshButton.Enabled = Content.CurrentAtomicOperation != null ;97 stepButton.Enabled = Content.CanContinue && Content.ExecutionState != ExecutionState.Started; 98 refreshButton.Enabled = Content.CurrentAtomicOperation != null && Content.ExecutionState != ExecutionState.Started; 99 99 } 100 100 }
Note: See TracChangeset
for help on using the changeset viewer.