コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
 protected abstract void OnMachineStopped(MachineInstance machine, MachineStopReason reason);
コード例 #5
0
 public MachineStoppedEventArgs(MachineStopReason reason)
 {
     Reason = reason;
 }
コード例 #6
0
 public MachineStoppedEventArgs(MachineStopReason reason, int threadId)
 {
     Reason   = reason;
     ThreadId = threadId;
 }
コード例 #7
0
 public MachineStoppedEventArgs(MachineStopReason reason)
 {
     Reason   = reason;
     ThreadId = Thread.CurrentThread.ManagedThreadId;
 }