public TracebackDelegate Trace(TraceBackFrame frame, string result, object payload) { if (Enabled) { var bt = new BreakPoint(frame); if (_mainpoint != null && _mainpoint.BackPoint.Equals(bt)) { Status = StatusType.Start; _mainpoint = null; } else if (!bt.Path.StartsWith("<")) { switch (Status) { case StatusType.Start: if (_mainpoint == null) { if (bt.Path.StartsWith(Workspace)) { _mainpoint = bt; Wait(frame, result, payload); break; } } break; case StatusType.Continue: if (_points.ContainsKey(bt.Path) && _points[bt.Path].Contains(bt)) { Wait(frame, result, payload); } break; case StatusType.SetpIn: Wait(frame, result, payload); break; case StatusType.SetpOut: if (bt.Equals(_currpoint.BackPoint)) { Wait(frame, result, payload); } break; case StatusType.Next: if (bt.IsNext(_currpoint)) { Wait(frame, result, payload); } break; } } } return(Trace); }
private void Wait(TraceBackFrame frame, string result, object payload) { _currpoint = new BreakPoint(frame); var pt = _currpoint; _frames = new List <StackFrame>(); int i = 1000; while (pt != null) { var path = pt.Path; _frames.Add( new StackFrame { Id = i++, Name = pt.FunctionName, Line = pt.Line, Source = new Source { Name = Path.GetFileName(path), Path = path } }); pt = pt.BackPoint; } _values = ValueTree.GetValues(frame); Status = StatusType.Wait; Stop(StoppedEvent.ReasonValue.Step); _resetEvent.WaitOne(); if (Status == StatusType.Stop) { throw new System.Exception("调试中断!"); } }
public DebugResult(StatusType status, BreakPoint point = null) { Status = status; BreakPoint = point; }