public bool ShouldStopAtThisLine(string module, ExecutionFrame currentFrame) { bool mustStop = false; switch (_currentState) { case DebugState.Running: mustStop = HitBreakpointOnLine(module, currentFrame); break; case DebugState.SteppingIn: mustStop = true; break; case DebugState.SteppingOut: case DebugState.SteppingOver: mustStop = FrameIsInStopList(currentFrame); // по пути следования все равно может встретиться breakpoint if (!mustStop && HitBreakpointOnLine(module, currentFrame)) { _currentState = DebugState.Running; //для правильной причины останова (см. ниже) mustStop = true; } break; } if (mustStop) { // здесь мы уже останавливались if (_lastStopPoint.frame != currentFrame || _lastStopPoint.line != currentFrame.LineNumber) { if (_currentState == DebugState.Running) { LastStopReason = MachineStopReason.Breakpoint; } else { LastStopReason = MachineStopReason.Step; } _lastStopPoint = new StopPoint() { frame = currentFrame, line = currentFrame.LineNumber }; _currentState = DebugState.Running; } else { mustStop = false; } } return(mustStop); }
protected override void OnMachineStopped(MachineInstance machine, MachineStopReason reason) { if (!CallbackChannelIsReady()) { return; // нет подписчика } var handle = GetTokenForThread(Thread.CurrentThread.ManagedThreadId); handle.ThreadEvent.Reset(); _eventChannel.ThreadStopped(1, ConvertStopReason(reason)); handle.ThreadEvent.Wait(); }
private ThreadStopReason ConvertStopReason(MachineStopReason reason) { switch (reason) { case MachineStopReason.Breakpoint: return(ThreadStopReason.Breakpoint); case MachineStopReason.Step: return(ThreadStopReason.Step); case MachineStopReason.Exception: return(ThreadStopReason.Exception); default: throw new NotImplementedException(); } }
protected abstract void OnMachineStopped(MachineInstance machine, MachineStopReason reason);
public MachineStoppedEventArgs(MachineStopReason reason) { Reason = reason; }
public MachineStoppedEventArgs(MachineStopReason reason, int threadId) { Reason = reason; ThreadId = threadId; }
public MachineStoppedEventArgs(MachineStopReason reason) { Reason = reason; ThreadId = Thread.CurrentThread.ManagedThreadId; }