Package org.apache.harmony.jpda.tests.framework.jdwp

Examples of org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket


        logWriter.println("==> Send VirtualMachine::AllClassesWithGeneric command...");
        CommandPacket packet = new CommandPacket(
                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
                JDWPCommands.VirtualMachineCommandSet.AllClassesWithGenericCommand);
        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
        checkReplyPacket(reply, "VirtualMachine::AllClassesWithGeneric command");

        byte refTypeTag;
        String refTypeTagName;
        long typeID;  
        String signature, genericSignature;  
        int status;
        String msgLine;
        boolean flagForHelloWorld = false;

        int classes = reply.getNextValueAsInt();
        logWriter.println("==> Number of reference types = " + classes);
        assertTrue("VirtualMachine::AllClassesWithGeneric command returned invalid number of classes: " + classes,
                classes > 0);

        int printBound_1 = classes;
        int printBound_2 = 0;
        if ( classes > 50 ) {
            printBound_1 = 5;
            printBound_2 = classes - 5;
        }
        for (int i = 0; i < classes; i++) {

            boolean infoIsPrinted = false;
            refTypeTag = reply.getNextValueAsByte();
            try {
                refTypeTagName = JDWPConstants.TypeTag.getName(refTypeTag);
            } catch ( Throwable thrown ) {
                refTypeTagName = "UnknownTagName";
            }
            msgLine = "\n" + i + ". " + refTypeTagName;
            typeID = reply.getNextValueAsReferenceTypeID();
            signature = reply.getNextValueAsString();
            msgLine = msgLine + ": " + signature;
            genericSignature = reply.getNextValueAsString();
            status = reply.getNextValueAsInt();
            msgLine = msgLine + " " + JDWPConstants.ClassStatus.getName(status);
            if ( (i < printBound_1) || (i >= printBound_2) ) {
                logWriter.println(msgLine);
                logWriter.println("\treferenceTypeID = " + typeID);
                logWriter.println("\trefTypeTag = " + refTypeTagName
View Full Code Here


    public long setBreakpointAtMethodBegin(long classID, String methodName) {
        long requestID;

        long methodID = getMethodID(classID, methodName);

        ReplyPacket lineTableReply = getLineTable(classID, methodID);
        if (lineTableReply.getErrorCode() != JDWPConstants.Error.NONE) {
            throw new TestErrorException(
                    "Command getLineTable returned error code: "
                            + lineTableReply.getErrorCode()
                            + " - "
                            + JDWPConstants.Error.getName(lineTableReply
                                    .getErrorCode()));
        }

        lineTableReply.getNextValueAsLong();
        // Lowest valid code index for the method

        lineTableReply.getNextValueAsLong();
        // Highest valid code index for the method

        // int numberOfLines =
        lineTableReply.getNextValueAsInt();

        long lineCodeIndex = lineTableReply.getNextValueAsLong();

        // set breakpoint inside checked method
        Location breakpointLocation = new Location(JDWPConstants.TypeTag.CLASS,
                classID, methodID, lineCodeIndex);

        ReplyPacket reply = setBreakpoint(breakpointLocation);
        checkReply(reply);

        requestID = reply.getNextValueAsInt();

        return requestID;
    }
View Full Code Here

        // Set command set. "1" - is ID of VirtualMachine Command Set
        commandPacket
                .setCommandSet(JDWPCommands.VirtualMachineCommandSet.CommandSetID);

        // Send packet
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
       
        targetVMCapabilities = new Capabilities();

        // Set capabilities
        targetVMCapabilities.canWatchFieldModification = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canWatchFieldAccess = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetBytecodes = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetSyntheticAttribute = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetOwnedMonitorInfo = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetCurrentContendedMonitor = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetMonitorInfo = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canRedefineClasses = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canAddMethod = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.canUnrestrictedlyRedefineClasses = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canPopFrames = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.canUseInstanceFilters = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canGetSourceDebugExtension = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canRequestVMDeathEvent = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.canSetDefaultStratum = replyPacket
                .getNextValueAsBoolean();
        targetVMCapabilities.reserved16 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved17 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved18 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved19 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved20 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved21 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved22 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved23 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved24 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved25 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved26 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved27 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved28 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved29 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved30 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved31 = replyPacket.getNextValueAsBoolean();
        targetVMCapabilities.reserved32 = replyPacket.getNextValueAsBoolean();

        return replyPacket;
    }
View Full Code Here

                .setCommand(JDWPCommands.VirtualMachineCommandSet.IDSizesCommand);
        commandPacket
                .setCommandSet(JDWPCommands.VirtualMachineCommandSet.CommandSetID);

        // Send packet
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));

        // Get FieldIDSize from ReplyPacket
        TypesLengths.setTypeLength(TypesLengths.FIELD_ID, replyPacket
                .getNextValueAsInt());

        // Get MethodIDSize from ReplyPacket
        TypesLengths.setTypeLength(TypesLengths.METHOD_ID, replyPacket
                .getNextValueAsInt());

        // Get ObjectIDSize from ReplyPacket
        TypesLengths.setTypeLength(TypesLengths.OBJECT_ID, replyPacket
                .getNextValueAsInt());

        // Get ReferenceTypeIDSize from ReplyPacket
        TypesLengths.setTypeLength(TypesLengths.REFERENCE_TYPE_ID, replyPacket
                .getNextValueAsInt());

        // Get FrameIDSize from ReplyPacket
        TypesLengths.setTypeLength(TypesLengths.FRAME_ID, replyPacket
                .getNextValueAsInt());

        // Adjust all other types lengths
        TypesLengths.setTypeLength(TypesLengths.ARRAY_ID, TypesLengths
                .getTypeLength(TypesLengths.OBJECT_ID));
View Full Code Here

        int classes = 0;
        byte refTypeTag = 0;
        long typeID = -1;

        // Request referenceTypeID for exception
        ReplyPacket classReference = getClassBySignature(typeSignature);

        // Get referenceTypeID from received packet
        classes = classReference.getNextValueAsInt();
        for (int i = 0; i < classes; i++) {
            refTypeTag = classReference.getNextValueAsByte();
            if (refTypeTag == classTypeTag) {
                typeID = classReference.getNextValueAsReferenceTypeID();
                classReference.getNextValueAsInt();
                break;
            } else {
                classReference.getNextValueAsReferenceTypeID();
                classReference.getNextValueAsInt();
                refTypeTag = 0;
            }
        }
        return typeID;
    }
View Full Code Here

     * @param threadName
     *            thread name
     * @return received ThreadID
     */
    public long getThreadID(String threadName) {
        ReplyPacket request = null;
        long threadID = -1;
        long thread = -1;
        String name = null;
        int threads = -1;

        // Get All Threads IDs
        request = getAllThreadID();

        // Get thread ID for threadName
        threads = request.getNextValueAsInt();
        for (int i = 0; i < threads; i++) {
            thread = request.getNextValueAsThreadID();
            name = getThreadName(thread);
            if (threadName.equals(name)) {
                threadID = thread;
                break;
            }
View Full Code Here

        // Create new command packet
        CommandPacket commandPacket = new CommandPacket(
                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
                JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
        commandPacket.setNextValueAsReferenceTypeID(classID);
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
        return replyPacket.getNextValueAsString();
    }
View Full Code Here

        // Create new command packet
        CommandPacket commandPacket = new CommandPacket(
                JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
                JDWPCommands.ThreadReferenceCommandSet.NameCommand);
        commandPacket.setNextValueAsThreadID(threadID);
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
        return replyPacket.getNextValueAsString();
    }
View Full Code Here

    public int getThreadStatus(long threadID) {
        CommandPacket commandPacket = new CommandPacket(
                JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
                JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
        commandPacket.setNextValueAsThreadID(threadID);
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
        return replyPacket.getNextValueAsInt();
    }
View Full Code Here

        // Create new command packet
        CommandPacket commandPacket = new CommandPacket(
                JDWPCommands.ThreadGroupReferenceCommandSet.CommandSetID,
                JDWPCommands.ThreadGroupReferenceCommandSet.NameCommand);
        commandPacket.setNextValueAsReferenceTypeID(groupID);
        ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
        return replyPacket.getNextValueAsString();
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.