Ejemplo n.º 1
0
        /// <summary>
        /// http://java.sun.com/javase/6/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ReferenceType
        /// </summary>
        /// <param name="packet"></param>
        private void CommandSetReferenceType(Packet packet)
        {
            switch (packet.Command)
            {
            case ReferenceType.Signature:
                int        typeID = packet.ReadObjectID();
                TargetType type   = target.FindType(typeID);
                Console.Error.WriteLine(typeID + ":" + type.GetJniSignature());
                packet.WriteString(type.GetJniSignature());
                break;

            case ReferenceType.ClassLoader:
                int classLoaderID = packet.ReadObjectID();
                packet.WriteObjectID(0);     //TODO 0 - System Classloader, we can use module ID instead
                break;

            case ReferenceType.MethodsWithGeneric:
                typeID = packet.ReadObjectID();
                Console.Error.WriteLine(typeID);
                type = target.FindType(typeID);
                IList <TargetMethod> methods = type.GetMethods();
                packet.WriteInt(methods.Count);
                foreach (TargetMethod method in methods)
                {
                    Console.Error.WriteLine(method.MethodId + ":" + method.Name + ":" + method.JniSignature + ":" + method.GenericSignature + ":" + method.AccessFlags);
                    packet.WriteObjectID(method.MethodId);
                    packet.WriteString(method.Name);
                    packet.WriteString(method.JniSignature);
                    packet.WriteString(method.GenericSignature);
                    packet.WriteInt(method.AccessFlags);
                }
                break;

            default:
                NotImplementedPacket(packet);
                break;
            }
        }