Пример #1
0
        Event DecodeEventInfo(WireProtocol.EventInfo info)
        {
            EventRequest req = FindRequest(info.requestId);

            if (info.eventKind == WireProtocol.EVENT_VM_START)
            {
                WireProtocol.VMStartEventInfo einfo = (WireProtocol.VMStartEventInfo)info;
                return(new VMStartEventImpl(vm, req, new ThreadReferenceImpl(vm, einfo.thread), new AppDomainMirrorImpl(vm, einfo.domain)));
            }
            else if (info.eventKind == WireProtocol.EVENT_VM_DEATH)
            {
                return(new VMDeathEventImpl(vm, req));
            }
            else if (info.eventKind == WireProtocol.EVENT_THREAD_START)
            {
                WireProtocol.ThreadStartEventInfo einfo = (WireProtocol.ThreadStartEventInfo)info;
                return(new ThreadStartEventImpl(vm, req, new ThreadReferenceImpl(vm, einfo.thread)));
            }
            else if (info.eventKind == WireProtocol.EVENT_THREAD_DEATH)
            {
                WireProtocol.ThreadDeathEventInfo einfo = (WireProtocol.ThreadDeathEventInfo)info;
                return(new ThreadDeathEventImpl(vm, req, new ThreadReferenceImpl(vm, einfo.thread)));
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Пример #2
0
 internal void RemoveRequest(EventRequest req, int id)
 {
     lock (requests_lock)
     {
         requests.Remove(id);
     }
 }
Пример #3
0
 internal void AddRequest(EventRequest req, int id)
 {
     lock (requests_lock)
     {
         requests [id] = req;
     }
 }
Пример #4
0
		void RemoveQueuedBreakEvents (EventRequest request)
		{
			int resume = 0;
			lock (queuedEventSets) {
				var node = queuedEventSets.First;
				while (node != null) {
					List<Event> q = node.Value;
					for (int i = 0; i < q.Count; i++)
						if (q[i].Request == request)
							q.RemoveAt (i--);
					if (q.Count == 0) {
						var d = node;
						node = node.Next;
						queuedEventSets.Remove (d);
						resume++;
					} else {
						node = node.Next;
					}
				}
			}
			for (int i = 0; i < resume; i++)
				vm.Resume ();
		}
Пример #5
0
		bool HandleBreakpoint (ThreadMirror thread, EventRequest er)
		{
			BreakInfo binfo;
			if (!breakpoints.TryGetValue (er, out binfo))
				return false;
			
			Breakpoint bp = binfo.BreakEvent as Breakpoint;
			if (bp == null)
				return false;
			
			if (bp.HitCount > 1) {
				// Just update the count and continue
				UpdateHitCount (binfo, bp.HitCount - 1);
				return true;
			}
			
			if (!string.IsNullOrEmpty (bp.ConditionExpression)) {
				string res = EvaluateExpression (thread, bp.ConditionExpression);
				if (bp.BreakIfConditionChanges) {
					if (res == binfo.LastConditionValue)
						return true;
					binfo.LastConditionValue = res;
				} else {
					if (res != null && res.ToLower () == "false")
						return true;
				}
			}
			switch (bp.HitAction) {
				case HitAction.CustomAction:
					// If custom action returns true, execution must continue
					return OnCustomBreakpointAction (bp.CustomActionId, binfo);
				case HitAction.PrintExpression: {
					string exp = EvaluateTrace (thread, bp.TraceExpression);
					UpdateLastTraceValue (binfo, exp);
					return true;
				}
				case HitAction.Break:
					return false;
			}
			return false;
		}
Пример #6
0
 private void OnStep(StepEvent stepEvent)
 {
     Trace("OnStep event");
     stepEvent.Request.Disable();
     _requestWaitingForResponse = null;
     OnVMGotSuspended(stepEvent);
 }
Пример #7
0
 public void SendStepRequest(StepDepth stepDepth)
 {
     var stepEventRequest = _vm.CreateStepRequest(_mainThread);
     stepEventRequest.Depth = stepDepth;
     stepEventRequest.Size = StepSize.Line;
     stepEventRequest.Enable();
     SafeResume();
     _requestWaitingForResponse = stepEventRequest;
 }
Пример #8
0
		void RemoveQueuedEvents (EventRequest request)
		{
			int resume = 0;
			lock (queuedEvents) {
				var node = queuedEvents.First;
				while (node != null) {
					if (node.Value.Request == request) {
						var d = node;
						node = node.Next;
						queuedEvents.Remove (d);
						resume++;
					} else {
						node = node.Next;
					}
				}
			}
			for (int i = 0; i < resume; i++)
				vm.Resume ();
		}
Пример #9
0
		static bool BreakpointMatchesAssembly (EventRequest breakpointRequest, BreakInfo breakpointInfo, string location)
		{
			return (breakpointRequest.Enabled && (
				string.IsNullOrEmpty (breakpointInfo.AssemblyLocation) ||
				breakpointInfo.AssemblyLocation.Equals(location, StringComparison.OrdinalIgnoreCase)
			));
		}
Пример #10
0
 public EventRequest(MDS.EventRequest sdbRequest) : base(sdbRequest)
 {
 }