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

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


    public Value[] getArrayValues(long objectID) {
        CommandPacket command = new CommandPacket(
                JDWPCommands.ArrayReferenceCommandSet.CommandSetID,
                JDWPCommands.ArrayReferenceCommandSet.LengthCommand);
        command.setNextValueAsArrayID(objectID);
        ReplyPacket reply = checkReply(performCommand(command));
        int length = reply.getNextValueAsInt();

        if (length == 0) {
            return null;
        }

        command = new CommandPacket(
                JDWPCommands.ArrayReferenceCommandSet.CommandSetID,
                JDWPCommands.ArrayReferenceCommandSet.GetValuesCommand);
        command.setNextValueAsArrayID(objectID);
        command.setNextValueAsInt(0);
        command.setNextValueAsInt(length);
        reply = checkReply(performCommand(command));
        ArrayRegion arrayRegion = reply.getNextValueAsArrayRegion();

        Value[] values = new Value[length];
        for (int i = 0; i < length; i++) {
            values[i] = arrayRegion.getValue(i);
        }
View Full Code Here


     *            The line code index.
     * @return An integer line number.
     */
    public final int getLineNumber(long classID, long methodID, long codeIndex) {
        int lineNumber = -1;
        ReplyPacket reply = getLineTable(classID, methodID);
        if (reply.getErrorCode() != JDWPConstants.Error.NONE) {
            return lineNumber;
        }

        reply.getNextValueAsLong(); // start line index, is not used
        reply.getNextValueAsLong(); // end line index, is not used
        int lines = reply.getNextValueAsInt();
        for (int i = 0; i < lines; i++) {
            long lineCodeIndex = reply.getNextValueAsLong();
            lineNumber = reply.getNextValueAsInt();
            if (lineCodeIndex == codeIndex) {
                break;
            }

            if (lineCodeIndex > codeIndex) {
View Full Code Here

     *            A source line number.
     * @return An integer representing the line code index.
     */
    public final long getLineCodeIndex(long classID, long methodID,
            int lineNumber) {
        ReplyPacket reply = getLineTable(classID, methodID);
        if (reply.getErrorCode() != JDWPConstants.Error.NONE) {
            return -1L;
        }

        reply.getNextValueAsLong(); // start line index, is not used
        reply.getNextValueAsLong(); // end line index, is not used
        int lines = reply.getNextValueAsInt();
        for (int i = 0; i < lines; i++) {
            long lineCodeIndex = reply.getNextValueAsLong();
            if (lineNumber == reply.getNextValueAsInt()) {
                return lineCodeIndex;
            }
        }

        return -1L;
View Full Code Here

    public final long createString(String value) {
        CommandPacket command = new CommandPacket(
                JDWPCommands.VirtualMachineCommandSet.CommandSetID,
                JDWPCommands.VirtualMachineCommandSet.CreateStringCommand);
        command.setNextValueAsString(value);
        ReplyPacket reply = checkReply(performCommand(command));
        return reply.getNextValueAsStringID();
    }
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

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.