예제 #1
0
        void CheckBreakpoints(DebugCallbackEventArgs e)
        {
            // Never check breakpoints when we're evaluating
            if (IsEvaluating)
                return;

            var type = DnDebugEventBreakpoint.GetDebugEventBreakpointType(e);
            if (type != null) {
                foreach (var bp in DebugEventBreakpoints) {
                    if (bp.IsEnabled && bp.EventType == type.Value && bp.Condition.Hit(new DebugEventBreakpointConditionContext(this, bp, e)))
                        e.AddStopState(new DebugEventBreakpointStopState(bp));
                }
            }

            foreach (var bp in AnyDebugEventBreakpoints) {
                if (bp.IsEnabled && bp.Condition.Hit(new AnyDebugEventBreakpointConditionContext(this, bp, e)))
                    e.AddStopState(new AnyDebugEventBreakpointStopState(bp));
            }

            if (e.Type == DebugCallbackType.Breakpoint) {
                var bpArgs = (BreakpointDebugCallbackEventArgs)e;
                //TODO: Use a dictionary instead of iterating over all breakpoints
                foreach (var bp in ilCodeBreakpointList.GetBreakpoints()) {
                    if (!bp.IsBreakpoint(bpArgs.Breakpoint))
                        continue;

                    if (bp.IsEnabled && bp.Condition.Hit(new ILCodeBreakpointConditionContext(this, bp)))
                        e.AddStopState(new ILCodeBreakpointStopState(bp));
                    break;
                }
            }

            if (e.Type == DebugCallbackType.Break && !debugOptions.IgnoreBreakInstructions)
                e.AddStopReason(DebuggerStopReason.Break);

            //TODO: DebugCallbackType.BreakpointSetError
        }