Exemplo n.º 1
0
		void RemoveBreakpoint(Breakpoint bp) {
			for (int i = 0; i < Collection.Count; i++) {
				var vm = Collection[i];
				if (Collection[i].Breakpoint == bp) {
					Collection.RemoveAt(i);
					vm.Dispose();
					return;
				}
			}
			Debug.Fail("Breakpoint got removed but it wasn't in BreakpointsVM's list");
		}
Exemplo n.º 2
0
		void InitializeDebuggerBreakpoint(Breakpoint bp) {
			var debugger = theDebugger.Debugger;
			if (debugger == null || theDebugger.ProcessState == DebuggerProcessState.Terminated)
				return;

			switch (bp.Kind) {
			case BreakpointKind.ILCode:
				var ilbp = (ILCodeBreakpoint)bp;
				Func<ILCodeBreakpointConditionContext, bool> cond = null;//TODO: Let user pick what cond to use
				Debug.Assert(ilbp.DnBreakpoint == null);
				ilbp.DnBreakpoint = debugger.CreateBreakpoint(ilbp.MethodToken.Module.ToDnModuleId(), ilbp.MethodToken.Token, ilbp.ILOffset, cond);
				break;

			case BreakpointKind.DebugEvent:
				//TODO:
				break;

			default:
				throw new InvalidOperationException();
			}
		}
Exemplo n.º 3
0
		public Breakpoint[] GetBreakpoints() {
			var bps = new Breakpoint[ilCodeBreakpoints.Count + eventBreakpoints.Count];
			int i = 0;
			foreach (var bp in ilCodeBreakpoints)
				bps[i++] = bp;
			foreach (var bp in eventBreakpoints)
				bps[i++] = bp;
			return bps;
		}
Exemplo n.º 4
0
		void AddBreakpoint(Breakpoint bp) {
			Collection.Add(new BreakpointVM(bp));
		}
Exemplo n.º 5
0
 void AddBreakpoint(Breakpoint bp)
 {
     Collection.Add(new BreakpointVM(this, breakpointContext, bp));
 }
Exemplo n.º 6
0
		public BreakpointsRemovedEventArgs(Breakpoint breakpoint)
			: base(breakpoint) {
		}
Exemplo n.º 7
0
		protected BreakpointsEventArgs(Breakpoint[] breakpoints) {
			if (breakpoints == null)
				throw new ArgumentNullException(nameof(breakpoints));
			Breakpoints = breakpoints;
		}
Exemplo n.º 8
0
		public void Remove(Breakpoint bp) {
			var ilbp = bp as ILCodeBreakpoint;
			if (ilbp != null) {
				bool b = ilCodeBreakpoints.Remove(ilbp);
				Debug.Assert(b);
				if (b) {
					UninitializeDebuggerBreakpoint(bp);
					BreakpointsRemoved?.Invoke(this, new BreakpointsRemovedEventArgs(bp));
				}
				return;
			}

			var debp = bp as DebugEventBreakpoint;
			if (debp != null) {
				bool b = eventBreakpoints.Remove(debp);
				Debug.Assert(b);
				if (b) {
					UninitializeDebuggerBreakpoint(bp);
					BreakpointsRemoved?.Invoke(this, new BreakpointsRemovedEventArgs(bp));
				}
				return;
			}
		}
Exemplo n.º 9
0
		public void Add(Breakpoint bp) {
			var ilbp = bp as ILCodeBreakpoint;
			if (ilbp != null) {
				TextLineObjectManager.Instance.Add(ilbp);
				return;
			}

			var debp = bp as DebugEventBreakpoint;
			if (debp != null) {
				otherBreakpoints.Add(debp);
				BreakPointAddedRemoved(debp, true);
				return;
			}
		}
Exemplo n.º 10
0
		public BreakpointVM(BreakpointsVM owner, IBreakpointContext context, Breakpoint bp) {
			this.owner = owner;
			Context = context;
			Breakpoint = bp;
			bp.PropertyChanged += Breakpoint_PropertyChanged;
		}
Exemplo n.º 11
0
 void AddBreakpoint(Breakpoint bp) => Collection.Add(new BreakpointVM(this, breakpointContext, bp));
Exemplo n.º 12
0
 public static object GetTag(Breakpoint bp) => bp;
Exemplo n.º 13
0
 public BreakpointVM(BreakpointsVM owner, Breakpoint bp)
 {
     this.owner          = owner;
     this.bp             = bp;
     bp.PropertyChanged += Breakpoint_PropertyChanged;
 }
Exemplo n.º 14
0
		void UninitializeDebuggerBreakpoint(Breakpoint bp) {
			var dnbp = bp.DnBreakpoint;
			bp.DnBreakpoint = null;
			if (dnbp != null) {
				var dbg = theDebugger.Debugger;
				if (dbg != null)
					dbg.RemoveBreakpoint(dnbp);
			}
		}
Exemplo n.º 15
0
		public BreakpointVM(BreakpointsVM owner, Breakpoint bp) {
			this.owner = owner;
			this.bp = bp;
			bp.PropertyChanged += Breakpoint_PropertyChanged;
		}
Exemplo n.º 16
0
		public void Add(Breakpoint bp) {
			if (!breakpointListenersInitialized) {
				breakpointListenersInitialized = true;
				foreach (var lazy in breakpointListeners) {
					var b = lazy.Value;
				}
			}

			var ilbp = bp as ILCodeBreakpoint;
			if (ilbp != null) {
				bool b = ilCodeBreakpoints.Add(ilbp);
				Debug.Assert(b);
				if (b) {
					InitializeDebuggerBreakpoint(bp);
					BreakpointsAdded?.Invoke(this, new BreakpointsAddedEventArgs(bp));
				}
				return;
			}

			var debp = bp as DebugEventBreakpoint;
			if (debp != null) {
				bool b = eventBreakpoints.Add(debp);
				Debug.Assert(b);
				if (b) {
					InitializeDebuggerBreakpoint(bp);
					BreakpointsAdded?.Invoke(this, new BreakpointsAddedEventArgs(bp));
				}
				return;
			}
		}
Exemplo n.º 17
0
        public void Remove(Breakpoint bp)
        {
            var ilbp = bp as ILCodeBreakpoint;
            if (ilbp != null) {
                textLineObjectManager.Remove(ilbp);
                return;
            }

            var debp = bp as DebugEventBreakpoint;
            if (debp != null) {
                otherBreakpoints.Remove(debp);
                BreakPointAddedRemoved(debp, false);
                return;
            }
        }
Exemplo n.º 18
0
		protected BreakpointsEventArgs(Breakpoint breakpoint) {
			if (breakpoint == null)
				throw new ArgumentNullException(nameof(breakpoint));
			Breakpoints = new[] { breakpoint };
		}
Exemplo n.º 19
0
 void BreakPointAddedRemoved(Breakpoint bp, bool added)
 {
     if (bp == null)
         return;
     if (added) {
         InitializeDebuggerBreakpoint(bp);
         if (OnListModified != null)
             OnListModified(this, new BreakpointListModifiedEventArgs(bp, true));
     }
     else {
         UninitializeDebuggerBreakpoint(bp);
         if (OnListModified != null)
             OnListModified(this, new BreakpointListModifiedEventArgs(bp, false));
     }
 }
Exemplo n.º 20
0
		public BreakpointsAddedEventArgs(Breakpoint breakpoint)
			: base(breakpoint) {
		}
Exemplo n.º 21
0
        void InitializeDebuggerBreakpoint(Breakpoint bp)
        {
            var debugger = theDebugger.Debugger;
            if (debugger == null || theDebugger.ProcessState == DebuggerProcessState.Terminated)
                return;

            IBreakpointCondition cond;
            switch (bp.Type) {
            case BreakpointType.ILCode:
                var ilbp = (ILCodeBreakpoint)bp;
                cond = AlwaysBreakpointCondition.Instance;//TODO: Let user pick what cond to use
                Debug.Assert(ilbp.DnBreakpoint == null);
                ilbp.DnBreakpoint = debugger.CreateBreakpoint(ilbp.SerializedDnToken.Module, ilbp.SerializedDnToken.Token, ilbp.ILOffset, cond);
                break;

            case BreakpointType.DebugEvent:
                //TODO:
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Exemplo n.º 22
0
		public BreakpointsRemovedEventArgs(Breakpoint[] breakpoints)
			: base(breakpoints) {
		}
Exemplo n.º 23
0
 public BreakpointListModifiedEventArgs(Breakpoint bp, bool added)
 {
     this.Breakpoint = bp;
     this.Added = added;
 }
Exemplo n.º 24
0
		public static object GetTag(Breakpoint bp) => bp;
Exemplo n.º 25
0
		public BreakpointVM(Breakpoint bp) {
			this.bp = bp;
			bp.PropertyChanged += Breakpoint_PropertyChanged;
		}