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

			var type = DnDebugEventBreakpoint.GetDebugEventBreakpointKind(e);
			if (type != null) {
				foreach (var bp in DebugEventBreakpoints) {
					if (bp.IsEnabled && bp.EventKind == type.Value && bp.Condition(new DebugEventBreakpointConditionContext(this, bp, e)))
						e.AddPauseState(new DebugEventBreakpointPauseState(bp));
				}
			}

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

			if (e.Kind == DebugCallbackKind.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(new ILCodeBreakpointConditionContext(this, bp)))
						e.AddPauseState(new ILCodeBreakpointPauseState(bp));
					break;
				}
				foreach (var bp in nativeCodeBreakpointList.GetBreakpoints()) {
					if (!bp.IsBreakpoint(bpArgs.Breakpoint))
						continue;

					if (bp.IsEnabled && bp.Condition(new NativeCodeBreakpointConditionContext(this, bp)))
						e.AddPauseState(new NativeCodeBreakpointPauseState(bp));
					break;
				}
			}

			if (e.Kind == DebugCallbackKind.Break && !debugOptions.IgnoreBreakInstructions)
				e.AddPauseReason(DebuggerPauseReason.Break);

			//TODO: DebugCallbackType.BreakpointSetError
		}