Changeset 4904 for branches/HeuristicLab.DebugEngine
- Timestamp:
- 11/22/10 17:06:12 (14 years ago)
- Location:
- branches/HeuristicLab.DebugEngine
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DebugEngine/DebugEngine.cs
r4903 r4904 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using System.Threading; … … 48 49 Log = cloner.Clone(original.Log); 49 50 ExecutionStack = cloner.Clone(original.ExecutionStack); 51 OperatorTrace = new ItemList<IOperator>(original.OperatorTrace.Select(op => cloner.Clone(op))); 52 operatorParents = original.operatorParents.ToDictionary(kvp => cloner.Clone(kvp.Key), kvp => cloner.Clone(kvp.Value)); 50 53 pausePending = original.pausePending; 51 54 stopPending = original.stopPending; … … 60 63 Log = new Log(); 61 64 ExecutionStack = new ExecutionStack(); 65 OperatorTrace = new ItemList<IOperator>(); 66 operatorParents = new Dictionary<IAtomicOperation, IAtomicOperation>(); 62 67 pausePending = stopPending = false; 63 68 timer = new System.Timers.Timer(100); … … 110 115 } 111 116 117 [Storable] 118 public ItemList<IOperator> OperatorTrace { get; private set; } 119 120 [Storable] 121 private Dictionary<IAtomicOperation, IAtomicOperation> operatorParents; 122 112 123 #endregion 113 124 … … 131 142 ignoreNextBreakpoint = false; 132 143 CurrentOperation = null; 144 OperatorTrace.Clear(); 145 operatorParents.Clear(); 133 146 OnPrepared(); 134 147 } … … 140 153 ignoreNextBreakpoint = false; 141 154 CurrentOperation = null; 155 OperatorTrace.Clear(); 156 operatorParents.Clear(); 142 157 OnPrepared(); 143 158 } … … 161 176 public override void Start() { 162 177 base.Start(); 163 CurrentOperation = null;164 178 ThreadPool.QueueUserWorkItem(new WaitCallback(Run), null); 165 179 } … … 250 264 ExpandOperationCollection(operations); 251 265 } else if (ExecutionStack.Count > 0) { 252 Log.LogMessage("Pop ing execution stack");266 Log.LogMessage("Popping execution stack"); 253 267 CurrentOperation = ExecutionStack.Last(); 254 268 ExecutionStack.RemoveAt(ExecutionStack.Count - 1); … … 256 270 Log.LogMessage("Nothing to do"); 257 271 } 272 GenerateOperationTrace(); 258 273 } catch (Exception x) { 259 274 OnExceptionOccurred(x); 275 } 276 } 277 278 private void GenerateOperationTrace() { 279 var operation = CurrentOperation as IAtomicOperation; 280 if (operation != null) { 281 List<IOperator> trace = new List<IOperator>(); 282 while (operation != null) { 283 trace.Add(operation.Operator); 284 IAtomicOperation parent = null; 285 operatorParents.TryGetValue(operation, out parent); 286 operation = parent; 287 } 288 trace.Reverse(); 289 OperatorTrace.Clear(); 290 OperatorTrace.AddRange(trace); 260 291 } 261 292 } … … 276 307 currentOperator = operation.Operator; 277 308 IOperation successor = operation.Operator.Execute((IExecutionContext)operation); 278 CurrentOperation = null;279 currentOperator = null;280 309 if (successor != null) { 310 AssignParents(operation, successor); 281 311 ExecutionStack.Add(successor); 282 312 } 313 currentOperator = null; 314 CurrentOperation = null; 283 315 } catch (Exception ex) { 284 316 OnExceptionOccurred(new OperatorExecutionException(operation.Operator, ex)); … … 288 320 } 289 321 322 private void AssignParents(IAtomicOperation parent, IOperation successor) { 323 OperationCollection operations = successor as OperationCollection; 324 if (operations != null) 325 foreach (var op in operations) 326 AssignParents(parent, op); 327 IAtomicOperation atomicOperation = successor as IAtomicOperation; 328 if (atomicOperation != null && atomicOperation.Operator != null && !operatorParents.ContainsKey(atomicOperation)) 329 operatorParents[atomicOperation] = parent; 330 } 331 290 332 protected virtual void ExpandOperationCollection(OperationCollection operations) { 291 333 ExecutionStack.AddRange(operations.Reverse()); -
branches/HeuristicLab.DebugEngine/DebugEngineView.Designer.cs
r4903 r4904 49 49 this.label1 = new System.Windows.Forms.Label(); 50 50 this.executionTimeTextBox = new System.Windows.Forms.TextBox(); 51 this.executionStackView = new HeuristicLab.DebugEngine.ExecutionStackView(); 52 this.operationContentView = new HeuristicLab.DebugEngine.OperationContentView(); 51 this.operationContentView = new OperationContentView(); 53 52 this.logView = new HeuristicLab.Core.Views.LogView(); 54 53 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); … … 58 57 this.refreshButton = new System.Windows.Forms.Button(); 59 58 this.skipStackOpsCheckBox = new System.Windows.Forms.CheckBox(); 59 this.splitContainer3 = new System.Windows.Forms.SplitContainer(); 60 this.executionStackView = new HeuristicLab.DebugEngine.ExecutionStackView(); 61 this.operatorTraceView = new OperatorTraceView(); 60 62 this.splitContainer1.Panel1.SuspendLayout(); 61 63 this.splitContainer1.Panel2.SuspendLayout(); … … 64 66 this.splitContainer2.Panel2.SuspendLayout(); 65 67 this.splitContainer2.SuspendLayout(); 68 this.splitContainer3.Panel1.SuspendLayout(); 69 this.splitContainer3.SuspendLayout(); 66 70 this.SuspendLayout(); 67 71 // … … 85 89 this.executionTimeTextBox.TabIndex = 1; 86 90 // 87 // executionStackView88 //89 this.executionStackView.Caption = "Execution Stack View";90 this.executionStackView.Content = null;91 this.executionStackView.Dock = System.Windows.Forms.DockStyle.Fill;92 this.executionStackView.Location = new System.Drawing.Point(0, 0);93 this.executionStackView.Name = "executionStackView";94 this.executionStackView.ReadOnly = false;95 this.executionStackView.Size = new System.Drawing.Size(252, 262);96 this.executionStackView.TabIndex = 0;97 //98 // operationContentView99 //100 this.operationContentView.Caption = "Operation Content View";101 this.operationContentView.Content = null;102 this.operationContentView.Dock = System.Windows.Forms.DockStyle.Fill;103 this.operationContentView.Location = new System.Drawing.Point(0, 0);104 this.operationContentView.Name = "operationContentView";105 this.operationContentView.ReadOnly = false;106 this.operationContentView.Size = new System.Drawing.Size(610, 503);107 this.operationContentView.TabIndex = 0;108 //109 91 // logView 110 92 // … … 115 97 this.logView.Name = "logView"; 116 98 this.logView.ReadOnly = false; 117 this.logView.Size = new System.Drawing.Size( 252, 237);99 this.logView.Size = new System.Drawing.Size(198, 237); 118 100 this.logView.TabIndex = 2; 119 101 // … … 132 114 // 133 115 this.splitContainer1.Panel2.Controls.Add(this.logView); 134 this.splitContainer1.Size = new System.Drawing.Size( 252, 503);135 this.splitContainer1.SplitterDistance = 26 2;116 this.splitContainer1.Size = new System.Drawing.Size(198, 502); 117 this.splitContainer1.SplitterDistance = 261; 136 118 this.splitContainer1.TabIndex = 3; 137 119 // 138 120 // splitContainer2 139 121 // 140 this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 141 | System.Windows.Forms.AnchorStyles.Left) 142 | System.Windows.Forms.AnchorStyles.Right))); 143 this.splitContainer2.Location = new System.Drawing.Point(3, 32); 122 this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 123 this.splitContainer2.Location = new System.Drawing.Point(0, 0); 144 124 this.splitContainer2.Name = "splitContainer2"; 145 125 // … … 151 131 // 152 132 this.splitContainer2.Panel2.Controls.Add(this.operationContentView); 153 this.splitContainer2.Size = new System.Drawing.Size( 866, 503);154 this.splitContainer2.SplitterDistance = 252;133 this.splitContainer2.Size = new System.Drawing.Size(683, 502); 134 this.splitContainer2.SplitterDistance = 198; 155 135 this.splitContainer2.TabIndex = 0; 156 136 // … … 189 169 this.skipStackOpsCheckBox.UseVisualStyleBackColor = true; 190 170 // 171 // splitContainer3 172 // 173 this.splitContainer3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 174 | System.Windows.Forms.AnchorStyles.Left) 175 | System.Windows.Forms.AnchorStyles.Right))); 176 this.splitContainer3.Location = new System.Drawing.Point(3, 33); 177 this.splitContainer3.Name = "splitContainer3"; 178 // 179 // splitContainer3.Panel1 180 // 181 this.splitContainer3.Panel1.Controls.Add(this.splitContainer2); 182 this.splitContainer3.Panel2.Controls.Add(this.operatorTraceView); 183 this.splitContainer3.Size = new System.Drawing.Size(866, 502); 184 this.splitContainer3.SplitterDistance = 683; 185 this.splitContainer3.TabIndex = 7; 186 this.operatorTraceView.Dock = System.Windows.Forms.DockStyle.Fill; 187 // 188 // executionStackView 189 // 190 this.executionStackView.Caption = "Execution Stack View"; 191 this.executionStackView.Content = null; 192 this.executionStackView.Dock = System.Windows.Forms.DockStyle.Fill; 193 this.executionStackView.Location = new System.Drawing.Point(0, 0); 194 this.executionStackView.Name = "executionStackView"; 195 this.executionStackView.ReadOnly = false; 196 this.executionStackView.Size = new System.Drawing.Size(198, 261); 197 this.executionStackView.TabIndex = 0; 198 // 199 // operationContentView 200 // 201 this.operationContentView.Caption = "Operation Content View"; 202 this.operationContentView.Content = null; 203 this.operationContentView.Dock = System.Windows.Forms.DockStyle.Fill; 204 this.operationContentView.Location = new System.Drawing.Point(0, 0); 205 this.operationContentView.Name = "operationContentView"; 206 this.operationContentView.ReadOnly = false; 207 this.operationContentView.Size = new System.Drawing.Size(481, 502); 208 this.operationContentView.TabIndex = 0; 209 // 191 210 // DebugEngineView 192 211 // 193 212 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 213 this.Controls.Add(this.splitContainer3); 194 214 this.Controls.Add(this.skipStackOpsCheckBox); 195 215 this.Controls.Add(this.refreshButton); 196 this.Controls.Add(this.splitContainer2);197 216 this.Controls.Add(this.stepButton); 198 217 this.Controls.Add(this.executionTimeTextBox); … … 206 225 this.splitContainer2.Panel2.ResumeLayout(false); 207 226 this.splitContainer2.ResumeLayout(false); 227 this.splitContainer3.Panel1.ResumeLayout(false); 228 this.splitContainer3.ResumeLayout(false); 208 229 this.ResumeLayout(false); 209 230 this.PerformLayout(); … … 224 245 private System.Windows.Forms.Button refreshButton; 225 246 private System.Windows.Forms.CheckBox skipStackOpsCheckBox; 247 private System.Windows.Forms.SplitContainer splitContainer3; 248 private OperatorTraceView operatorTraceView; 226 249 227 250 } -
branches/HeuristicLab.DebugEngine/DebugEngineView.cs
r4903 r4904 123 123 executionStackView.SuspendUpdate(); 124 124 logView.Content = null; 125 operatorTraceView.Content = null; 125 126 break; 126 127 default: … … 128 129 executionStackView.ResumeUpdate(); 129 130 operationContentView.Content = new OperationContent(Content.CurrentOperation); 131 operatorTraceView.Content = Content.OperatorTrace; 130 132 break; 131 133 } … … 138 140 Invoke(new EventHandler<OperationChangedEventArgs>(Content_CurrentOperationChanged), sender, e); 139 141 } else { 140 if (Content.ExecutionState != ExecutionState.Started)141 operationContentView.Content = new OperationContent(Content.CurrentOperation);142 142 } 143 143 } -
branches/HeuristicLab.DebugEngine/DebugEngineView.resx
r4903 r4904 122 122 <value> 123 123 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 124 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAA LCwAA125 C wsBbQSEtwAAARBJREFUOE9j+P//PwM6Tuh5woxNHJsYhmaQIqABMkDMRIwhWA0onPX8f/zkt0rEGILV124 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/gAA 125 Cv4B5iV4ZgAAARBJREFUOE9j+P//PwM6Tuh5woxNHJsYhmaQIqABMkDMRIwhWA0onPX8f/zkt0rEGILV 126 126 gNyZz/4ndN/7HzfhtQYh72A1IGPK0//z9v/+H9Rw8zXQAFt8huAKg/+z9/3637n173+30sv/gQbY4zIE 127 127 qwGRXY/+T9n263/J0r//E6b//W+TexanIVgNCGx++L917XuwZuOSL/+lo6/9N45c9t+h6Gw8ukuwGuBR … … 137 137 <value> 138 138 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 139 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAL EQAA140 C xEBf2RfkQAAAmFJREFUOE+dk21IU1EYx3cVVzkhaLCy+UaY0xwlZkYRmiGR7oMEUlAGfRGKvkRFVOQ0139 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALBAAA 140 CwQBG8oqrQAAAmFJREFUOE+dk21IU1EYx3cVVzkhaLCy+UaY0xwlZkYRmiGR7oMEUlAGfRGKvkRFVOQ0 141 141 DddsVmtbvpQWhCFBSvaCUcRAk0gGm8SGM7JtrU1nzYFvu3P33znDRcLpSxceDvdefr/zv+d5Lidaufjg 142 142 QKKIWwNSUo4Tz4u4RAl5xYsgJIuEcADCYlS8oQKLvvvKdam1n+PcqjUyN5ox7PyIVrMB1U9PoKxThZI7 -
branches/HeuristicLab.DebugEngine/ExecutionStackView.Designer.cs
r4871 r4904 65 65 private System.Windows.Forms.TreeView treeView; 66 66 private System.Windows.Forms.GroupBox groupBox; 67 67 68 } 68 69 } -
branches/HeuristicLab.DebugEngine/HeuristicLab.DebugEngine.csproj
r4876 r4904 140 140 <DependentUpon>OperationContentView.cs</DependentUpon> 141 141 </Compile> 142 <Compile Include="OperatorTraceView.cs"> 143 <SubType>UserControl</SubType> 144 </Compile> 145 <Compile Include="OperatorTraceView.Designer.cs"> 146 <DependentUpon>OperatorTraceView.cs</DependentUpon> 147 </Compile> 142 148 <Compile Include="Properties\AssemblyInfo.cs" /> 143 149 <Compile Include="Properties\Resources.Designer.cs"> … … 157 163 <EmbeddedResource Include="OperationContentView.resx"> 158 164 <DependentUpon>OperationContentView.cs</DependentUpon> 165 </EmbeddedResource> 166 <EmbeddedResource Include="OperatorTraceView.resx"> 167 <DependentUpon>OperatorTraceView.cs</DependentUpon> 159 168 </EmbeddedResource> 160 169 <EmbeddedResource Include="Properties\Resources.resx"> -
branches/HeuristicLab.DebugEngine/OperationContentView.cs
r4903 r4904 197 197 } 198 198 199 #endregion200 201 199 private void nameTextBox_DoubleClick(object sender, EventArgs e) { 202 200 if (Content != null && Content.IsAtomic && Content.AtomicOperation.Operator != null) … … 204 202 } 205 203 204 #endregion 205 206 207 206 208 } 207 209 }
Note: See TracChangeset
for help on using the changeset viewer.