public ClassPrepare(JdwpPacket.DataReaderWriter reader) : base(reader) { typeId = ReferenceTypeId.Read(reader); signature = reader.GetString(); status = (DebuggerLib.Jdwp.ClassStatus)reader.GetInt(); }
public ExceptionEventFilter(EventKind internalEventKind, RequestId requestId, SuspendPolicy suspendPolicy, IEnumerable <EventRequestModifier> modifiers, ReferenceTypeId exceptionType, bool caught, bool uncaught) : base(internalEventKind, requestId, suspendPolicy, modifiers) { _exceptionType = exceptionType; _caught = caught; _uncaught = uncaught; }
/// <summary> /// Returns variable information for the method, including generic signatures for the variables. The variable table includes arguments and /// locals declared within the method. For instance methods, the "this" reference is included in the table. Also, synthetic variables may be /// present. Generic signatures are described in the signature attribute section in the Java Virtual Machine Specification, 3rd Edition. /// Since JDWP version 1.5. /// </summary> public Task<List<VariableInfo>> VariableTableWithGenericAsync(ReferenceTypeId typeId, MethodId methodId) { var conn = ConnectionOrError; var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 5, typeId.Size + methodId.Size, x => { var data = x.Data; typeId.WriteTo(data); methodId.WriteTo(data); })); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); var data = result.Data; var argCnt = data.GetInt(); var count = data.GetInt(); var list = new List<VariableInfo>(count); for (var i = 0; i < count; i++ ) { var codeIndex = data.GetLong(); var name = data.GetString(); var signature = data.GetString(); var genericSignature = data.GetString(); var length = data.GetInt(); var slot = data.GetInt(); list.Add(new VariableInfo(codeIndex, name, signature, genericSignature, length, slot)); } return list; }); }
public ClassInfo(ReferenceTypeId typeId, string signature, string genericSignature, Jdwp.ClassStatus status) { TypeId = typeId; Signature = signature; GenericSignature = genericSignature; Status = status; }
/// <summary> /// Returns the value of one or more static fields of the reference type. Each field must be member of the reference type or /// one of its superclasses, superinterfaces, or implemented interfaces. Access control is not enforced; for example, the values /// of private fields can be obtained. /// </summary> public Task<List<Value>> GetValuesAsync(ReferenceTypeId typeId, FieldId[] fields) { var conn = ConnectionOrError; var sizeInfo = conn.GetIdSizeInfo(); var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 6, typeId.Size + 4 + (sizeInfo.FieldIdSize * fields.Length), x => { var data = x.Data; typeId.WriteTo(data); data.SetInt(fields.Length); foreach (var fieldId in fields) { fieldId.WriteTo(data); } })); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); var data = result.Data; var count = data.GetInt(); var list = new List<Value>(count); for (var i = 0; i < count; i++) { var value = new Value(data); list.Add(value); } return list; }); }
public ClassInfo(ReferenceTypeId typeId, string signature, string genericSignature, Jdwp.ClassStatus status) { TypeId = typeId; Signature = signature; GenericSignature = genericSignature; Status = status; }
public ReferenceTypeData(TaggedReferenceTypeId type, string signature, string genericSignature, ClassStatus status) { ReferenceTypeTag = type.TypeTag; TypeId = type.TypeId; Signature = signature; GenericSignature = genericSignature; Status = status; }
internal ReferenceType GetMirrorOf(TypeTag typeTag, ReferenceTypeId typeId) { if (typeTag == default(TypeTag) && typeId == default(ReferenceTypeId)) { return(null); } return(GetMirrorOf(new TaggedReferenceTypeId(typeTag, typeId))); }
/// <summary> /// Returns the immediate superclass of a class. /// </summary> public Task<ClassId> SuperclassAsync(ReferenceTypeId id) { var conn = ConnectionOrError; var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 1, id.Size, x => id.WriteTo(x.Data))); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); return new ClassId(result.Data); }); }
private void RemoveBehavior(ReferenceTypeId refTypeId, string signature) { int prevEventId; if (_eventRequests.TryRemove(refTypeId, out prevEventId)) { DLog.Info(DContext.DebuggerLibDebugger, "clearing exception event: " + signature); Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId) .Await(DalvikProcess.VmTimeout); } }
/// <inheritdoc/> public override int GetHashCode() { var hashCode = -557465817; hashCode = hashCode * -1521134295 + ReferenceTypeId.GetHashSafe(); hashCode = hashCode * -1521134295 + TargetId.GetHashSafe(); hashCode = hashCode * -1521134295 + IsInverse.GetHashCode(); return(hashCode); }
public jvmtiError GetClassSignature(JniEnvironment nativeEnvironment, ReferenceTypeId classId, out string signature, out string genericSignature) { signature = null; genericSignature = null; using (var classHandle = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, classId)) { if (!classHandle.IsAlive) { return(jvmtiError.InvalidClass); } return(GetClassSignature(classHandle.Value, out signature, out genericSignature)); } }
/// <summary> /// Update the info of a given class. /// </summary> private void ProcessClassData(ReferenceTypeId typeId, string signature, Jdwp.ClassStatus status) { lock (dataLock) { DalvikReferenceType refType; if (!classes.TryGetValue(typeId, out refType)) { // Not found, create new one refType = CreateReferenceType(typeId); classes[typeId] = refType; } refType.SetSignatureIfNull(signature); refType.SetStatusIfNull(status); } }
/// <summary> /// Gets the class that belongs to the given id. /// Create's it if needed. /// </summary> public DalvikReferenceType this[ReferenceTypeId id] { get { lock (dataLock) { DalvikReferenceType result; if (classes.TryGetValue(id, out result)) return result; result = CreateReferenceType(id); classes[id] = result; return result; } } }
/// <inheritdoc/> public override int GetHashCode() { var hashCode = base.GetHashCode(); hashCode = hashCode * -1521134295 + NumericId.GetHashCode(); hashCode = hashCode * -1521134295 + ReferenceTypeId.GetHashSafe(); hashCode = hashCode * -1521134295 + TypeDefinitionId.GetHashSafe(); hashCode = hashCode * -1521134295 + ModellingRuleId.GetHashSafe(); hashCode = hashCode * -1521134295 + Parent.GetHashSafe(); return(hashCode); }
/// <summary> /// Gets the class that belongs to the given id. /// Create's it if needed. /// </summary> public DalvikReferenceType this[ReferenceTypeId id] { get { lock (dataLock) { DalvikReferenceType result; if (classes.TryGetValue(id, out result)) { return(result); } result = CreateReferenceType(id); classes[id] = result; return(result); } } }
public jvmtiError GetClassFields(JniEnvironment nativeEnvironment, ReferenceTypeId declaringType, out FieldId[] fields) { fields = null; using (var @class = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, declaringType)) { if ([email protected]) { return(jvmtiError.InvalidClass); } int fieldsCount; IntPtr fieldsPtr; jvmtiError error = RawInterface.GetClassFields(this, @class.Value, out fieldsCount, out fieldsPtr); if (error != jvmtiError.None) { return(error); } try { List <FieldId> fieldList = new List <FieldId>(); unsafe { jfieldID *fieldHandles = (jfieldID *)fieldsPtr; for (int i = 0; i < fieldsCount; i++) { if (fieldHandles[i] == jfieldID.Null) { continue; } fieldList.Add(fieldHandles[i]); } } fields = fieldList.ToArray(); return(jvmtiError.None); } finally { Deallocate(fieldsPtr); } } }
public jvmtiError GetClassMethods(JniEnvironment nativeEnvironment, ReferenceTypeId declaringType, out MethodId[] methods) { methods = null; using (var @class = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, declaringType)) { if ([email protected]) { return(jvmtiError.InvalidClass); } int methodsCount; IntPtr methodsPtr; jvmtiError error = RawInterface.GetClassMethods(this, @class.Value, out methodsCount, out methodsPtr); if (error != jvmtiError.None) { return(error); } try { List <MethodId> methodList = new List <MethodId>(); unsafe { jmethodID *methodHandles = (jmethodID *)methodsPtr; for (int i = 0; i < methodsCount; i++) { if (methodHandles[i] == jmethodID.Null) { continue; } methodList.Add(new MethodId(methodHandles[i].Handle)); } } methods = methodList.ToArray(); return(jvmtiError.None); } finally { Deallocate(methodsPtr); } } }
/// <summary> /// Try to get a type and method ID from the given node. /// </summary> private static bool TryGetTypeAndMethodId(TreeNode node, out ReferenceTypeId typeId, out MethodId methodId) { typeId = null; methodId = null; if (node == null) return false; var tag = node.Tag; if (tag is DalvikStackFrame) { typeId = ((DalvikStackFrame) tag).Location.Class; methodId = ((DalvikStackFrame) tag).Location.Method; } else if (tag is MethodInfo) { methodId = ((MethodInfo) tag).Id; TryGetTypeId(node.Parent, out typeId); } return (methodId != null) && (typeId != null); }
/// <summary> /// Try to get a type ID from the given node. /// </summary> private static bool TryGetTypeId(TreeNode node, out ReferenceTypeId typeId) { typeId = null; if (node == null) { return(false); } var tag = node.Tag; if (tag is DalvikStackFrame) { typeId = ((DalvikStackFrame)tag).Location.Class; } else if (tag is ClassInfo) { typeId = ((ClassInfo)tag).TypeId; } return(typeId != null); }
/// <summary> /// Default ctor /// </summary> protected BaseFieldEvent(JdwpPacket.DataReaderWriter reader) : base(reader) { refTypeTag = (DebuggerLib.Jdwp.TypeTag)reader.GetByte(); switch (refTypeTag) { case DebuggerLib.Jdwp.TypeTag.Class: typeId = new ClassId(reader); break; case DebuggerLib.Jdwp.TypeTag.Interface: typeId = new InterfaceId(reader); break; case DebuggerLib.Jdwp.TypeTag.Array: typeId = new ArrayTypeId(reader); break; default: throw new ArgumentException("Unknown type tag " + (int)refTypeTag); } fieldId = new FieldId(reader); objectId = new TaggedObjectId(reader); }
/// <summary> /// Try to get a type and method ID from the given node. /// </summary> private static bool TryGetTypeAndMethodId(TreeNode node, out ReferenceTypeId typeId, out MethodId methodId) { typeId = null; methodId = null; if (node == null) { return(false); } var tag = node.Tag; if (tag is DalvikStackFrame) { typeId = ((DalvikStackFrame)tag).Location.Class; methodId = ((DalvikStackFrame)tag).Location.Method; } else if (tag is MethodInfo) { methodId = ((MethodInfo)tag).Id; TryGetTypeId(node.Parent, out typeId); } return((methodId != null) && (typeId != null)); }
public jvmtiError GetClassModifiers(JniEnvironment nativeEnvironment, ReferenceTypeId declaringType, out AccessModifiers modifiers) { modifiers = 0; using (var @class = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, declaringType)) { if ([email protected]) { return(jvmtiError.InvalidClass); } JvmAccessModifiers modifiersPtr; jvmtiError error = RawInterface.GetClassModifiers(this, @class.Value, out modifiersPtr); if (error != jvmtiError.None) { return(error); } modifiers = (AccessModifiers)modifiersPtr; return(jvmtiError.None); } }
private void SetupBehavior(ReferenceTypeId refTypeId, bool stopOnThrow, bool stopUncaught, string signature) { // set the event DLog.Info(DContext.DebuggerLibDebugger, "requesting exception event {0}: stopOnThrow: {1} stopUncaught: {2}", signature, stopOnThrow, stopUncaught); var modifier = new ExceptionOnlyModifier(refTypeId, stopOnThrow, stopUncaught); var eventId = Debugger.EventRequest.SetAsync(Jdwp.EventKind.Exception, Jdwp.SuspendPolicy.All, modifier) .Await(DalvikProcess.VmTimeout); // remove previous event, if any. int?prevEventId = null; _eventRequests.AddOrUpdate(refTypeId, eventId, (key, prev) => { prevEventId = prev; return(eventId); }); if (prevEventId.HasValue) { Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId.Value) .Await(DalvikProcess.VmTimeout); } }
public jvmtiError GetSourceFileName(JniEnvironment nativeEnvironment, ReferenceTypeId classId, out string sourceName) { sourceName = null; using (var classHandle = VirtualMachine.GetLocalReferenceForClass(nativeEnvironment, classId)) { if (!classHandle.IsAlive) { return(jvmtiError.InvalidClass); } IntPtr sourceNamePtr; jvmtiError error = RawInterface.GetSourceFileName(this, classHandle.Value, out sourceNamePtr); if (error != jvmtiError.None) { return(error); } try { unsafe { if (sourceNamePtr != IntPtr.Zero) { sourceName = ModifiedUTF8Encoding.GetString((byte *)sourceNamePtr); } } return(jvmtiError.None); } finally { Deallocate(sourceNamePtr); } } }
/// <summary> /// Default ctor /// </summary> protected BaseFieldEvent(JdwpPacket.DataReaderWriter reader) : base(reader) { refTypeTag = (DebuggerLib.Jdwp.TypeTag)reader.GetByte(); switch (refTypeTag) { case DebuggerLib.Jdwp.TypeTag.Class: typeId = new ClassId(reader); break; case DebuggerLib.Jdwp.TypeTag.Interface: typeId = new InterfaceId(reader); break; case DebuggerLib.Jdwp.TypeTag.Array: typeId = new ArrayTypeId(reader); break; default: throw new ArgumentException("Unknown type tag " + (int)refTypeTag); } fieldId = new FieldId(reader); objectId = new TaggedObjectId(reader); }
/// <summary> /// Returns information for each field in a reference type. Inherited fields are not included. The field list will include any synthetic /// fields created by the compiler. Fields are returned in the order they occur in the class file. /// </summary> public Task<List<FieldInfo>> FieldsAsync(ReferenceTypeId id) { var conn = ConnectionOrError; var sizeInfo = conn.GetIdSizeInfo(); var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 14, sizeInfo.ReferenceTypeIdSize, x => id.WriteTo(x.Data))); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); var data = result.Data; var count = data.GetInt(); var list = new List<FieldInfo>(count); for (var i = 0; i < count; i++ ) { var fieldId = new FieldId(data); var name = data.GetString(); var signature = data.GetString(); var genericSignature = data.GetString(); var accessFlags = data.GetInt(); list.Add(new FieldInfo(fieldId, name, signature, genericSignature, accessFlags)); } return list; }); }
private void SetupBehavior(ReferenceTypeId refTypeId, bool stopOnThrow, bool stopUncaught, string signature) { // set the event DLog.Info(DContext.DebuggerLibDebugger, "requesting exception event {0}: stopOnThrow: {1} stopUncaught: {2}", signature, stopOnThrow, stopUncaught); var modifier = new ExceptionOnlyModifier(refTypeId, stopOnThrow, stopUncaught); var eventId = Debugger.EventRequest.SetAsync(Jdwp.EventKind.Exception, Jdwp.SuspendPolicy.All, modifier) .Await(DalvikProcess.VmTimeout); // remove previous event, if any. int? prevEventId = null; _eventRequests.AddOrUpdate(refTypeId, eventId, (key, prev) => { prevEventId = prev; return eventId; }); if (prevEventId.HasValue) { Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId.Value) .Await(DalvikProcess.VmTimeout); } }
/// <summary> /// Default ctor /// </summary> internal DalvikReferenceType(ReferenceTypeId id, DalvikReferenceTypeManager manager) { Id = id; this.manager = manager; }
public Error GetNestedTypes(out TaggedReferenceTypeId[] classes, ReferenceTypeId referenceType) { throw new NotImplementedException(); }
public Error GetReferenceTypeStatus(out ClassStatus status, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + _referenceTypeIdSize.Value]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.Status); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { status = default(ClassStatus); return errorCode; } int offset = HeaderSize; status = (ClassStatus)ReadInt32(response, ref offset); return Error.None; }
public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status) { ThreadReference thread = VirtualMachine.GetMirrorOf(threadId); EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId); ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId); ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type); VirtualMachine.EventQueue.OnClassPrepare(e); }
public Error GetMethodBytecodes(out byte[] bytecode, ReferenceTypeId referenceType, MethodId method) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize + MethodIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, MethodCommand.Bytecodes); WriteReferenceTypeId(packet, HeaderSize, referenceType); WriteMethodId(packet, HeaderSize + ReferenceTypeIdSize, method); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { bytecode = null; return errorCode; } int offset = HeaderSize; int bytes = ReadInt32(response, ref offset); bytecode = new byte[bytes]; Buffer.BlockCopy(response, offset, bytecode, 0, bytes); return Error.None; }
public Error GetModifiers(out AccessModifiers modifiers, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.Modifiers); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { modifiers = default(AccessModifiers); return errorCode; } int offset = HeaderSize; modifiers = (AccessModifiers)ReadInt32(response, ref offset); return Error.None; }
public Error GetClassObject(out ClassObjectId classObject, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.ClassObject); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { classObject = default(ClassObjectId); return errorCode; } int offset = HeaderSize; classObject = (ClassObjectId)ReadObjectId(response, ref offset); return Error.None; }
public Error GetMethods(out DeclaredMethodData[] methods, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.MethodsWithGeneric); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { methods = null; return errorCode; } int offset = HeaderSize; int methodCount = ReadInt32(response, ref offset); methods = new DeclaredMethodData[methodCount]; for (int i = 0; i < methodCount; i++) { MethodId methodId = ReadMethodId(response, ref offset); string name = ReadString(response, ref offset); string signature = ReadString(response, ref offset); string genericSignature = ReadString(response, ref offset); AccessModifiers modifiers = (AccessModifiers)ReadInt32(response, ref offset); methods[i] = new DeclaredMethodData(methodId, name, signature, genericSignature, modifiers); } return Error.None; }
/// <summary> /// Create an instance representing the given reference type. /// </summary> protected virtual DalvikReferenceType CreateReferenceType(ReferenceTypeId id) { return(new DalvikReferenceType(id, this)); }
/// <summary> /// Try to get a type ID from the given node. /// </summary> private static bool TryGetTypeId(TreeNode node, out ReferenceTypeId typeId) { typeId = null; if (node == null) return false; var tag = node.Tag; if (tag is DalvikStackFrame) { typeId = ((DalvikStackFrame)tag).Location.Class; } else if (tag is ClassInfo) { typeId = ((ClassInfo)tag).TypeId; } return (typeId != null); }
public Error GetReflectedType(out TypeTag typeTag, out ReferenceTypeId typeId, ClassObjectId classObject) { byte[] packet = new byte[HeaderSize + ObjectIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ClassObjectReferenceCommand.ReflectedType); WriteObjectId(packet, HeaderSize, classObject); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { typeTag = default(TypeTag); typeId = default(ReferenceTypeId); return errorCode; } int offset = HeaderSize; typeTag = (TypeTag)ReadByte(response, ref offset); typeId = ReadReferenceTypeId(response, ref offset); return Error.None; }
public Error GetSignature(out string signature, out string genericSignature, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.SignatureWithGeneric); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { signature = null; genericSignature = null; return errorCode; } int offset = HeaderSize; signature = ReadString(response, ref offset); genericSignature = ReadString(response, ref offset); return Error.None; }
/// <summary> /// Returns the current status of the reference type. The status indicates the extent to which the reference type has been initialized, /// as described in the VM specification. If the class is linked the PREPARED and VERIFIED bits in the returned status bits will be set. /// If the class is initialized the INITIALIZED bit in the returned status bits will be set. If an error occured during initialization then /// the ERROR bit in the returned status bits will be set. The returned status bits are undefined for array types and for primitive classes /// (such as java.lang.Integer.TYPE). /// </summary> public Task<Jdwp.ClassStatus> StatusAsync(ReferenceTypeId id) { var conn = ConnectionOrError; var sizeInfo = conn.GetIdSizeInfo(); var t = conn.SendAsync(JdwpPacket.CreateCommand(conn, Nr, 9, sizeInfo.ReferenceTypeIdSize, x => id.WriteTo(x.Data))); return t.ContinueWith(x => { x.ForwardException(); var result = x.Result; result.ThrowOnError(); return (Jdwp.ClassStatus)result.Data.GetInt(); }); }
private void WriteReferenceTypeId(byte[] packet, int offset, ReferenceTypeId referenceTypeId) { if (!_referenceTypeIdSize.HasValue) throw new InvalidOperationException(); switch (_referenceTypeIdSize.Value) { case 2: WriteInt16(packet, offset, (short)referenceTypeId.Handle); break; case 4: WriteInt32(packet, offset, (int)referenceTypeId.Handle); break; case 8: WriteInt64(packet, offset, referenceTypeId.Handle); break; default: throw new NotImplementedException(); } }
public Error GetMethodIsObsolete(out bool result, ReferenceTypeId referenceType, MethodId method) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize + MethodIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, MethodCommand.Bytecodes); WriteReferenceTypeId(packet, HeaderSize, referenceType); WriteMethodId(packet, HeaderSize + ReferenceTypeIdSize, method); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { result = false; return errorCode; } int offset = HeaderSize; result = ReadByte(response, ref offset) != 0; return Error.None; }
public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status) { ThreadReference thread = VirtualMachine.GetMirrorOf(threadId); EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId); ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId); ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type); VirtualMachine.EventQueue.OnClassPrepare(e); }
public Error GetMethodVariableTable(out VariableData[] slots, ReferenceTypeId referenceType, MethodId method) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize + MethodIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, MethodCommand.VariableTableWithGeneric); WriteReferenceTypeId(packet, HeaderSize, referenceType); WriteMethodId(packet, HeaderSize + ReferenceTypeIdSize, method); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { slots = null; return errorCode; } int offset = HeaderSize; int argumentCount = ReadInt32(response, ref offset); int slotCount = ReadInt32(response, ref offset); slots = new VariableData[slotCount]; for (int i = 0; i < slotCount; i++) { ulong codeIndex = ReadUInt64(response, ref offset); string name = ReadString(response, ref offset); string signature = ReadString(response, ref offset); string genericSignature = ReadString(response, ref offset); uint length = ReadUInt32(response, ref offset); int slot = ReadInt32(response, ref offset); slots[i] = new VariableData(slot, codeIndex, length, name, signature, genericSignature); } return Error.None; }
public Error GetSourceFile(out string sourceFile, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + _referenceTypeIdSize.Value]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.SourceFile); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { sourceFile = null; return errorCode; } int offset = HeaderSize; sourceFile = ReadString(response, ref offset); return Error.None; }
public void FieldModification(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, TypeTag typeTag, ReferenceTypeId typeId, FieldId field, TaggedObjectId @object, Types.Value newValue) { throw new NotImplementedException(); }
public Error GetInterfaces(out InterfaceId[] interfaces, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.Interfaces); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { interfaces = null; return errorCode; } int offset = HeaderSize; int interfaceCount = ReadInt32(response, ref offset); interfaces = new InterfaceId[interfaceCount]; for (int i = 0; i < interfaceCount; i++) { interfaces[i] = (InterfaceId)ReadReferenceTypeId(response, ref offset); } return Error.None; }
public override int GetHashCode() { return(VirtualMachine.GetHashCode() ^ ReferenceTypeId.GetHashCode()); }
private void RemoveBehavior(ReferenceTypeId refTypeId, string signature) { int prevEventId; if (_eventRequests.TryRemove(refTypeId, out prevEventId)) { DLog.Info(DContext.DebuggerLibDebugger, "clearing exception event: " + signature); Debugger.EventRequest.ClearAsync(Jdwp.EventKind.Exception, prevEventId) .Await(DalvikProcess.VmTimeout); } }
public ResourceTypeAttribute(ReferenceTypeId value) { this.Value = value; }
public Error GetSourceDebugExtension(out string extension, ReferenceTypeId referenceType) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.SourceDebugExtension); WriteReferenceTypeId(packet, HeaderSize, referenceType); byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { extension = null; return errorCode; } int offset = HeaderSize; extension = ReadString(response, ref offset); return Error.None; }
public void FieldModification(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, TypeTag typeTag, ReferenceTypeId typeId, FieldId field, TaggedObjectId @object, Types.Value newValue) { throw new NotImplementedException(); }
public Error GetReferenceTypeValues(out Value[] values, ReferenceTypeId referenceType, FieldId[] fields) { byte[] packet = new byte[HeaderSize + ReferenceTypeIdSize + sizeof(int) + (fields.Length * FieldIdSize)]; int id = GetMessageId(); SerializeHeader(packet, id, ReferenceTypeCommand.GetValues); WriteReferenceTypeId(packet, HeaderSize, referenceType); WriteInt32(packet, HeaderSize + ReferenceTypeIdSize, fields.Length); for (int i = 0; i < fields.Length; i++) { WriteFieldId(packet, HeaderSize + ReferenceTypeIdSize + sizeof(int) + (i * FieldIdSize), fields[i]); } byte[] response = SendPacket(id, packet); Error errorCode = ReadErrorCode(response); if (errorCode != Error.None) { values = null; return errorCode; } int offset = HeaderSize; int valueCount = ReadInt32(response, ref offset); values = new Value[valueCount]; for (int i = 0; i < valueCount; i++) { values[i] = ReadValue(response, ref offset); } return Error.None; }