예제 #1
0
        public void Suspend()
        {
            // the target will suspend automatically as part of the VMStart event
            if (ProtocolService == null)
            {
                return;
            }

            DebugErrorHandler.ThrowOnFailure(ProtocolService.Suspend());
        }
예제 #2
0
        public ReadOnlyCollection <IThreadReference> GetAllThreads()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            ThreadId[] threads;
            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetAllThreads(out threads));
            return(new ReadOnlyCollection <IThreadReference>(Array.ConvertAll(threads, GetMirrorOf)));
        }
예제 #3
0
        public ReadOnlyCollection <IReferenceType> GetAllClasses()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            ReferenceTypeData[] classes;
            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetAllClasses(out classes));
            return(new ReadOnlyCollection <IReferenceType>(Array.ConvertAll(classes, GetMirrorOf)));
        }
        public IClassLoaderReference GetClassLoader()
        {
            if (_classLoader == null)
            {
                ClassLoaderId classLoader;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetClassLoader(out classLoader, ReferenceTypeId));
                _classLoader = VirtualMachine.GetMirrorOf(classLoader);
            }

            return(_classLoader);
        }
        public string GetSourceDebugExtension()
        {
            if (_sourceDebugExtension == null)
            {
                string sourceDebugExtension;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetSourceDebugExtension(out sourceDebugExtension, ReferenceTypeId));
                _sourceDebugExtension = sourceDebugExtension;
            }

            return(_sourceDebugExtension);
        }
        public string GetSourceName()
        {
            if (_sourceName == null)
            {
                string sourceFile;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetSourceFile(out sourceFile, ReferenceTypeId));
                _sourceName = sourceFile;
            }

            return(_sourceName);
        }
예제 #7
0
        public bool GetIsObsolete()
        {
            if (_obsolete == null)
            {
                bool result;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetMethodIsObsolete(out result, DeclaringType.ReferenceTypeId, MethodId));
                _obsolete = result;
            }

            return(_obsolete.Value);
        }
예제 #8
0
        public ReadOnlyCollection <ExceptionTableEntry> GetExceptionTable()
        {
            if (_exceptionTable == null)
            {
                ExceptionTableEntry[] result;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetMethodExceptionTable(out result, DeclaringType.ReferenceTypeId, MethodId));
                _exceptionTable = new ReadOnlyCollection <ExceptionTableEntry>(result);
            }

            return(_exceptionTable);
        }
예제 #9
0
        public byte[] GetBytecodes()
        {
            if (_bytecode == null)
            {
                byte[] result;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetMethodBytecodes(out result, DeclaringType.ReferenceTypeId, MethodId));
                _bytecode = result;
            }

            return(_bytecode);
        }
        public void Stop(IObjectReference throwable)
        {
            ObjectReference objectReference = throwable as ObjectReference;

            if (objectReference == null || !VirtualMachine.Equals(objectReference.VirtualMachine))
            {
                throw new VirtualMachineMismatchException();
            }

            DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.StopThread(this.ThreadId, objectReference.ObjectId));
        }
예제 #11
0
        public int GetLength()
        {
            if (!_length.HasValue)
            {
                int length;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetArrayLength(out length, ArrayId));
                _length = length;
            }

            return(_length.Value);
        }
        public AccessModifiers GetModifiers()
        {
            if (_modifiers == null)
            {
                Types.AccessModifiers modifiers;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetModifiers(out modifiers, ReferenceTypeId));
                _modifiers = (AccessModifiers)modifiers;
            }

            return(_modifiers.Value);
        }
        public ReadOnlyCollection <IInterfaceType> GetSuperInterfaces()
        {
            if (_superInterfaces == null)
            {
                InterfaceId[] interfaceIds;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetInterfaces(out interfaceIds, ReferenceTypeId));
                InterfaceType[] interfaces = Array.ConvertAll(interfaceIds, VirtualMachine.GetMirrorOf);
                _superInterfaces = interfaces;
            }

            return(new ReadOnlyCollection <IInterfaceType>(_superInterfaces));
        }
예제 #14
0
        public bool GetCanGetCurrentContendedMonitor()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanGetCurrentContendedMonitor) != 0);
        }
예제 #15
0
        public IReferenceType GetReferenceType()
        {
            if (_referenceType == null)
            {
                TypeTag         typeTag;
                ReferenceTypeId typeId;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetObjectReferenceType(out typeTag, out typeId, ObjectId));
                _referenceType = VirtualMachine.GetMirrorOf(typeTag, typeId);
            }

            return(_referenceType);
        }
예제 #16
0
        public bool GetCanGetSyntheticAttribute()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanGetSyntheticAttribute) != 0);
        }
예제 #17
0
        public bool GetCanGetMonitorFrameInfo()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanGetOwnedMonitorStackDepthInfo) != 0);
        }
        public sealed override string GetSignature()
        {
            if (_signature == null)
            {
                string signature;
                string genericSignature;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetSignature(out signature, out genericSignature, ReferenceTypeId));
                _signature = signature;
            }

            return(_signature);
        }
예제 #19
0
        public StrongValueHandle <StringReference> GetMirrorOf(string value)
        {
            if (value == null)
            {
                return(null);
            }

            StringId stringObject;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.CreateString(out stringObject, value));
            return(new StrongValueHandle <StringReference>(GetMirrorOf(stringObject)));
        }
        private Version GetVersion()
        {
            if (_version == null)
            {
                int majorVersion;
                int minorVersion;
                DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetClassFileVersion(out majorVersion, out minorVersion, this.ReferenceTypeId));
                _version = new Version(majorVersion, minorVersion);
            }

            return(_version);
        }
예제 #21
0
        public bool GetCanInvokeWithoutThread()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanInvokeWithoutThread) != 0);
        }
예제 #22
0
        public bool GetCanWatchFieldModification()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanGenerateFieldModificationEvents) != 0);
        }
예제 #23
0
        public bool GetCanUnrestrictedlyRedefineClasses()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            return((capabilities & Capabilities.CanRedefineAnyClass) != 0);
        }
예제 #24
0
        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)));
        }
예제 #25
0
        public bool GetCanUseSourceNameFilters()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            //return (capabilities & Capabilities.CanUseSourceNameFilters) != 0;
            throw new NotImplementedException();
        }
예제 #26
0
        public bool GetCanRequestVMDeathEvent()
        {
            if (ProtocolService == null)
            {
                throw new VirtualMachineDisconnectedException();
            }

            Capabilities capabilities;

            DebugErrorHandler.ThrowOnFailure(ProtocolService.GetCapabilities(out capabilities));
            //return (capabilities & Capabilities.CanRequestVMDeathEvent) != 0;
            throw new NotImplementedException();
        }
예제 #27
0
        public IValue GetValue(ILocalVariable variable)
        {
            LocalVariable localVariable = variable as LocalVariable;

            if (localVariable == null)
            {
                throw new VirtualMachineMismatchException();
            }

            int[]         slots = { localVariable.Slot };
            Types.Value[] values;
            DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetValues(out values, _thread.ThreadId, _frameId, slots));
            return(VirtualMachine.GetMirrorOf(values[0]));
        }
        public IValue GetValue(IField field)
        {
            Field localField = field as Field;

            if (localField == null)
            {
                throw new VirtualMachineMismatchException();
            }

            Types.Value[] values;
            FieldId[]     fields = { localField.FieldId };
            DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.GetReferenceTypeValues(out values, ReferenceTypeId, fields));
            return(VirtualMachine.GetMirrorOf(values.Single()));
        }
예제 #29
0
        public void RedefineClasses(IEnumerable <KeyValuePair <IReferenceType, byte[]> > classes)
        {
            List <ClassDefinitionData> definitions = new List <ClassDefinitionData>();

            foreach (var pair in classes)
            {
                ReferenceType referenceType = pair.Key as ReferenceType;
                if (referenceType == null || !this.Equals(referenceType.VirtualMachine))
                {
                    throw new VirtualMachineMismatchException();
                }

                definitions.Add(new ClassDefinitionData(referenceType.ReferenceTypeId, pair.Value));
            }

            DebugErrorHandler.ThrowOnFailure(ProtocolService.RedefineClasses(definitions.ToArray()));
        }
예제 #30
0
        public void SetValue(ILocalVariable variable, IValue value)
        {
            LocalVariable localVariable = variable as LocalVariable;

            if (localVariable == null)
            {
                throw new VirtualMachineMismatchException();
            }

            Value trueValue = value as Value;

            if (trueValue == null && value != null)
            {
                throw new VirtualMachineMismatchException();
            }

            int[]         slots  = { localVariable.Slot };
            Types.Value[] values = { Value.ToNetworkValue(trueValue) };
            DebugErrorHandler.ThrowOnFailure(VirtualMachine.ProtocolService.SetValues(_thread.ThreadId, _frameId, slots, values));
        }