public void AddThreadFilter(IThreadReference thread) { Contract.Requires<ArgumentNullException>(thread != null, "thread"); Contract.Requires<VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); throw new NotImplementedException(); }
public void AddThreadFilter(IThreadReference thread) { Contract.Requires <ArgumentNullException>(thread != null, "thread"); Contract.Requires <VirtualMachineMismatchException>(this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); throw new NotImplementedException(); }
public static void AbortAll(this IThreadReference reference, System.TimeSpan timeout) { foreach (var tp in reference.GetReferencedThreads()) { System.Threading.Thread t = tp; Media.Common.Extensions.Thread.ThreadExtensions.TryAbort(ref t, timeout, System.Threading.ThreadState.Running); } }
public void AddThreadFilter(IThreadReference thread) { ThreadReference threadReference = thread as ThreadReference; if (threadReference == null) throw new VirtualMachineMismatchException(); Modifiers.Add(Types.EventRequestModifier.ThreadFilter(threadReference.ThreadId)); }
public IStepRequest CreateStepRequest(IThreadReference thread, StepSize size, StepDepth depth) { Contract.Requires <VirtualMachineMismatchException>(thread == null || this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); Contract.Ensures(Contract.Result <IStepRequest>() != null); Contract.Ensures(this.GetVirtualMachine().Equals(Contract.Result <IStepRequest>().GetVirtualMachine())); throw new NotImplementedException(); }
public static void AbortAll(this IThreadReference reference, int timeoutmSec = (int)Common.Extensions.TimeSpan.TimeSpanExtensions.MicrosecondsPerMillisecond) { foreach (var tp in reference.GetReferencedThreads()) { System.Threading.Thread t = tp; Media.Common.Extensions.Thread.ThreadExtensions.TryAbort(ref t, System.Threading.ThreadState.Running, timeoutmSec); } }
public JavaDebugThread(JavaDebugProgram program, IThreadReference thread, ThreadCategory category) { Contract.Requires <ArgumentNullException>(program != null, "program"); Contract.Requires <ArgumentNullException>(thread != null, "thread"); _program = program; _thread = thread; _category = category; CreateStepRequests(); }
public JavaDebugThread(JavaDebugProgram program, IThreadReference thread, ThreadCategory category) { Contract.Requires<ArgumentNullException>(program != null, "program"); Contract.Requires<ArgumentNullException>(thread != null, "thread"); _program = program; _thread = thread; _category = category; CreateStepRequests(); }
public void AddThreadFilter(IThreadReference thread) { ThreadReference threadReference = thread as ThreadReference; if (threadReference == null || !threadReference.VirtualMachine.Equals(this.VirtualMachine)) { throw new VirtualMachineMismatchException(); } Modifiers.Add(Types.EventRequestModifier.ThreadFilter(threadReference.ThreadId)); }
public IStrongValueHandle<IObjectReference> CreateInstance(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { TaggedObjectId returnValue; TaggedObjectId thrownException; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.CreateClassInstance(out returnValue, out thrownException, ClassId, ((ThreadReference)thread).ThreadId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast<Value>().Select(Value.ToNetworkValue).ToArray())); if (thrownException != default(TaggedObjectId)) { throw new NotImplementedException(); } return new StrongValueHandle<ObjectReference>(VirtualMachine.GetMirrorOf(returnValue)); }
public IStrongValueHandle<IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { Contract.Requires<ArgumentNullException>(method != null, "method"); Contract.Requires<VirtualMachineMismatchException>(thread == null || this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); Contract.Requires<VirtualMachineMismatchException>(method.GetVirtualMachine().Equals(this.GetVirtualMachine())); #if CONTRACTS_FORALL Contract.Requires<VirtualMachineMismatchException>(arguments == null || Contract.ForAll(arguments, argument => argument == null || this.GetVirtualMachine().Equals(argument.GetVirtualMachine()))); #endif Contract.Ensures(Contract.Result<IStrongValueHandle<IValue>>() == null || this.GetVirtualMachine().Equals(Contract.Result<IStrongValueHandle<IValue>>().GetVirtualMachine())); throw new NotImplementedException(); }
public IStrongValueHandle <IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { Contract.Requires <ArgumentNullException>(method != null, "method"); Contract.Requires <VirtualMachineMismatchException>(thread == null || this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); Contract.Requires <VirtualMachineMismatchException>(method.GetVirtualMachine().Equals(this.GetVirtualMachine())); #if CONTRACTS_FORALL Contract.Requires <VirtualMachineMismatchException>(arguments == null || Contract.ForAll(arguments, argument => argument == null || this.GetVirtualMachine().Equals(argument.GetVirtualMachine()))); #endif Contract.Ensures(Contract.Result <IStrongValueHandle <IValue> >() == null || this.GetVirtualMachine().Equals(Contract.Result <IStrongValueHandle <IValue> >().GetVirtualMachine())); throw new NotImplementedException(); }
public IStrongValueHandle <IObjectReference> CreateInstance(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { TaggedObjectId returnValue; TaggedObjectId thrownException; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.CreateClassInstance(out returnValue, out thrownException, ClassId, ((ThreadReference)thread).ThreadId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast <Value>().Select(Value.ToNetworkValue).ToArray())); if (thrownException != default(TaggedObjectId)) { throw new NotImplementedException(); } return(new StrongValueHandle <ObjectReference>(VirtualMachine.GetMirrorOf(returnValue))); }
public JavaDebugExceptionEvent(enum_EVENTATTRIBUTES attributes, JavaDebugProgram program, IThreadReference thread, IObjectReference exceptionObject, ILocation location, ILocation catchLocation) : base(attributes) { Contract.Requires <ArgumentNullException>(program != null, "program"); Contract.Requires <ArgumentNullException>(thread != null, "thread"); Contract.Requires <ArgumentNullException>(exceptionObject != null, "exceptionObject"); _program = program; _thread = thread; _exceptionObject = exceptionObject; _location = location; _catchLocation = catchLocation; }
public JavaDebugExceptionEvent(enum_EVENTATTRIBUTES attributes, JavaDebugProgram program, IThreadReference thread, IObjectReference exceptionObject, ILocation location, ILocation catchLocation) : base(attributes) { Contract.Requires<ArgumentNullException>(program != null, "program"); Contract.Requires<ArgumentNullException>(thread != null, "thread"); Contract.Requires<ArgumentNullException>(exceptionObject != null, "exceptionObject"); _program = program; _thread = thread; _exceptionObject = exceptionObject; _location = location; _catchLocation = catchLocation; }
public static void AbortAndFreeAll(this IThreadReference reference, int timeoutmSec = (int)Common.Extensions.TimeSpan.TimeSpanExtensions.MicrosecondsPerMillisecond) { foreach (var tp in reference.GetReferencedThreads()) { //Take a reference to that thread System.Threading.Thread t = tp; //Call AbortAndFree //Should be Stopped to check for stop? if (false == Media.Common.Extensions.Thread.ThreadExtensions.TryAbortAndFree(ref t, System.Threading.ThreadState.Running, timeoutmSec)) { t = null; //Remove the reference if required } } }
public static void AbortAndFreeAll(this IThreadReference reference, System.TimeSpan timeout) { foreach (var tp in reference.GetReferencedThreads()) { //Take a reference to that thread System.Threading.Thread t = tp; //Call AbortAndFree //Should be Stopped to check for stop? if (false == ThreadExtensions.TryAbortAndFree(ref t, timeout, System.Threading.ThreadState.Running)) { t = null; //Remove the reference if required } } }
public IStepRequest CreateStepRequest(IThreadReference thread, StepSize size, StepDepth depth) { ThreadReference threadReference = thread as ThreadReference; if ((threadReference == null || !threadReference.VirtualMachine.Equals(this.VirtualMachine)) && thread != null) { throw new VirtualMachineMismatchException(); } var request = new StepRequest(VirtualMachine, threadReference, size, depth); _stepRequests.Add(request); return(request); }
public int ContinueFromSynchronousEvent(IDebugEvent2 pEvent) { if (pEvent == null) { throw new ArgumentNullException("pEvent"); } if (!(pEvent is DebugEvent)) { return(VSConstants.E_INVALIDARG); } if (pEvent is IDebugEngineCreateEvent2) { return(VSConstants.S_OK); } IPropertyOwner propertyOwner = pEvent as IPropertyOwner; if (propertyOwner != null) { bool manualResume; propertyOwner.Properties.TryGetProperty("ManualResume", out manualResume); SuspendPolicy suspendPolicy; if (!manualResume && propertyOwner.Properties.TryGetProperty(typeof(SuspendPolicy), out suspendPolicy)) { IThreadReference thread = propertyOwner.Properties.GetProperty <IThreadReference>(typeof(IThreadReference)); switch (suspendPolicy) { case SuspendPolicy.All: JavaDebugProgram program = propertyOwner.Properties.GetProperty <JavaDebugProgram>(typeof(JavaDebugProgram)); JavaDebugThread debugThread; program.Threads.TryGetValue(thread.GetUniqueId(), out debugThread); program.Continue(debugThread); break; case SuspendPolicy.EventThread: Task.Factory.StartNew(thread.Resume).HandleNonCriticalExceptions(); break; case SuspendPolicy.None: break; } } } return(VSConstants.S_OK); }
private void ManualContinueFromEvent(ThreadEventArgs e) { switch (e.SuspendPolicy) { case SuspendPolicy.All: JavaDebugThread thread; _threads.TryGetValue(e.Thread.GetUniqueId(), out thread); Continue(thread); break; case SuspendPolicy.EventThread: IThreadReference threadReference = e.Thread; Task.Factory.StartNew(threadReference.Resume).HandleNonCriticalExceptions(); break; case SuspendPolicy.None: break; } }
public IStrongValueHandle <IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { Types.Value returnValue; TaggedObjectId thrownException; ThreadId threadId = (thread != null) ? ((ThreadReference)thread).ThreadId : default(ThreadId); DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.InvokeObjectMethod(out returnValue, out thrownException, ObjectId, threadId, (ClassId)((Method)method).DeclaringType.TaggedReferenceTypeId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast <Value>().Select(Value.ToNetworkValue).ToArray())); if (thrownException != default(TaggedObjectId)) { throw new NotImplementedException(); } Value returnValueMirror = VirtualMachine.GetMirrorOf(returnValue); if (returnValueMirror == null) { return(null); } return(new StrongValueHandle <Value>(VirtualMachine.GetMirrorOf(returnValue))); }
private static void SetEventProperties(DebugEvent debugEvent, IEventRequest request, SuspendPolicy suspendPolicy, IVirtualMachine virtualMachine, IThreadReference thread, bool manualResume) { Contract.Requires <ArgumentNullException>(debugEvent != null, "debugEvent"); debugEvent.Properties.AddProperty(typeof(IEventRequest), request); debugEvent.Properties.AddProperty(typeof(SuspendPolicy), suspendPolicy); debugEvent.Properties.AddProperty(typeof(IVirtualMachine), virtualMachine); debugEvent.Properties.AddProperty(typeof(IThreadReference), thread); debugEvent.Properties.AddProperty("ManualResume", manualResume); }
public void AddThreadFilter(IThreadReference thread) { throw new NotImplementedException(); }
public IStrongValueHandle<IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { Types.Value returnValue; TaggedObjectId thrownException; if (thread != null || VirtualMachine.GetCanInvokeWithoutThread()) { ThreadId threadId = default(ThreadId); if (thread != null) threadId = ((ThreadReference)thread).ThreadId; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.InvokeObjectMethod(out returnValue, out thrownException, ObjectId, threadId, (ClassId)((Method)method).DeclaringType.TaggedReferenceTypeId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast<Value>().Select(Value.ToNetworkValue).ToArray())); } else { returnValue = default(Types.Value); thrownException = default(TaggedObjectId); Error errorCode = Error.ThreadNotSuspended; foreach (var vmThread in VirtualMachine.GetAllThreads()) { ThreadReference threadReference = vmThread as ThreadReference; if (threadReference == null) continue; ThreadStatus threadStatus; SuspendStatus suspendStatus; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetThreadStatus(out threadStatus, out suspendStatus, threadReference.ThreadId)); if (threadStatus != ThreadStatus.Running) continue; if (suspendStatus != SuspendStatus.Suspended) continue; int suspendCount; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetThreadSuspendCount(out suspendCount, threadReference.ThreadId)); errorCode = VirtualMachine.ProtocolService.InvokeObjectMethod(out returnValue, out thrownException, ObjectId, threadReference.ThreadId, (ClassId)((Method)method).DeclaringType.TaggedReferenceTypeId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast<Value>().Select(Value.ToNetworkValue).ToArray()); if (errorCode == Error.InvalidThread) continue; break; } DebugErrorHandler.ThrowOnFailure(errorCode); } if (thrownException.ObjectId != default(ObjectId)) { throw new InternalException((int)Error.Internal, "An exception was thrown by the invoked method."); } Value returnValueMirror = VirtualMachine.GetMirrorOf(returnValue); if (returnValueMirror == null) return null; return new StrongValueHandle<Value>(VirtualMachine.GetMirrorOf(returnValue)); }
public IStepRequest CreateStepRequest(IThreadReference thread, StepSize size, StepDepth depth) { Contract.Requires<VirtualMachineMismatchException>(thread == null || this.GetVirtualMachine().Equals(thread.GetVirtualMachine())); Contract.Ensures(Contract.Result<IStepRequest>() != null); Contract.Ensures(this.GetVirtualMachine().Equals(Contract.Result<IStepRequest>().GetVirtualMachine())); throw new NotImplementedException(); }
public IStrongValueHandle<IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { throw new NotImplementedException(); }
public IStrongValueHandle <IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { throw new NotImplementedException(); }
public IStrongValueHandle <IValue> InvokeMethod(IThreadReference thread, IMethod method, InvokeOptions options, params IValue[] arguments) { Types.Value returnValue; TaggedObjectId thrownException; if (thread != null || VirtualMachine.GetCanInvokeWithoutThread()) { ThreadId threadId = default(ThreadId); if (thread != null) { threadId = ((ThreadReference)thread).ThreadId; } DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.InvokeObjectMethod(out returnValue, out thrownException, ObjectId, threadId, (ClassId)((Method)method).DeclaringType.TaggedReferenceTypeId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast <Value>().Select(Value.ToNetworkValue).ToArray())); } else { returnValue = default(Types.Value); thrownException = default(TaggedObjectId); Error errorCode = Error.ThreadNotSuspended; foreach (var vmThread in VirtualMachine.GetAllThreads()) { ThreadReference threadReference = vmThread as ThreadReference; if (threadReference == null) { continue; } ThreadStatus threadStatus; SuspendStatus suspendStatus; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetThreadStatus(out threadStatus, out suspendStatus, threadReference.ThreadId)); if (threadStatus != ThreadStatus.Running) { continue; } if (suspendStatus != SuspendStatus.Suspended) { continue; } int suspendCount; DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetThreadSuspendCount(out suspendCount, threadReference.ThreadId)); errorCode = VirtualMachine.ProtocolService.InvokeObjectMethod(out returnValue, out thrownException, ObjectId, threadReference.ThreadId, (ClassId)((Method)method).DeclaringType.TaggedReferenceTypeId, ((Method)method).MethodId, (Types.InvokeOptions)options, arguments.Cast <Value>().Select(Value.ToNetworkValue).ToArray()); if (errorCode == Error.InvalidThread) { continue; } break; } DebugErrorHandler.ThrowOnFailure(errorCode); } if (thrownException.ObjectId != default(ObjectId)) { throw new InternalException((int)Error.Internal, "An exception was thrown by the invoked method."); } Value returnValueMirror = VirtualMachine.GetMirrorOf(returnValue); if (returnValueMirror == null) { return(null); } return(new StrongValueHandle <Value>(VirtualMachine.GetMirrorOf(returnValue))); }
private static void SetEventProperties(DebugEvent debugEvent, IEventRequest request, SuspendPolicy suspendPolicy, IVirtualMachine virtualMachine, IThreadReference thread, bool manualResume) { Contract.Requires<ArgumentNullException>(debugEvent != null, "debugEvent"); debugEvent.Properties.AddProperty(typeof(IEventRequest), request); debugEvent.Properties.AddProperty(typeof(SuspendPolicy), suspendPolicy); debugEvent.Properties.AddProperty(typeof(IVirtualMachine), virtualMachine); debugEvent.Properties.AddProperty(typeof(IThreadReference), thread); debugEvent.Properties.AddProperty("ManualResume", manualResume); }
public IStepRequest CreateStepRequest(IThreadReference thread, StepSize size, StepDepth depth) { ThreadReference threadReference = thread as ThreadReference; if ((threadReference == null || !threadReference.VirtualMachine.Equals(this.VirtualMachine)) && thread != null) throw new VirtualMachineMismatchException(); var request = new StepRequest(VirtualMachine, threadReference, size, depth); _stepRequests.Add(request); return request; }