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

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


     * @param fieldName
     *            field name
     * @return received FieldID
     */
    public long getFieldID(long classID, String fieldName) {
        ReplyPacket reply = getFieldsInClass(classID);
        return getFieldID(reply, fieldName);
    }
View Full Code Here


     * @param methodName
     *            method name
     * @return received MethodID
     */
    public long getMethodID(long classID, String methodName) {
        ReplyPacket reply;
        int declared = 0;
        String method = null;
        long methodID = -1;

        // Get Method reference ID
        reply = getMethods(classID);

        // Get methodID from received packet
        declared = reply.getNextValueAsInt();
        for (int i = 0; i < declared; i++) {
            methodID = reply.getNextValueAsMethodID();
            method = reply.getNextValueAsString();
            if (methodName.equals(method)) {
                // If this method name is the same as requested
                reply.getNextValueAsString();
                reply.getNextValueAsInt();
                break;
            } else {
                // If this method name is not the requested one
                reply.getNextValueAsString();
                reply.getNextValueAsInt();
                methodID = -1;
                method = null;
            }
        }
        return methodID;
View Full Code Here

    public String getMethodName(long classID, long methodID) {
        CommandPacket packet = new CommandPacket(
                JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
                JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
        packet.setNextValueAsReferenceTypeID(classID);
        ReplyPacket reply = performCommand(packet);

        int declared = reply.getNextValueAsInt();
        long mID;
        String value = null;
        String methodName = "";
        for (int i = 0; i < declared; i++) {
            mID = reply.getNextValueAsMethodID();
            methodName = reply.getNextValueAsString();
            reply.getNextValueAsString();
            reply.getNextValueAsInt();
            if (mID == methodID) {
                value = methodName;
                break;
            }
        }
View Full Code Here

     * @return ReplyPacket if breakpoint is set
     * @throws ReplyErrorCodeException
     */
    public ReplyPacket setFieldAccess(String classSignature, byte classTypeTag,
            String fieldName) throws ReplyErrorCodeException {
        ReplyPacket request = null;
        long typeID = -1;
        long fieldID = -1;

        // Request referenceTypeID for class
        typeID = getClassID(classSignature);
View Full Code Here

     * @return ReplyPacket for corresponding command
     * @throws ReplyErrorCodeException
     */
    public ReplyPacket setFieldModification(String classSignature,
            byte classTypeTag, String fieldName) throws ReplyErrorCodeException {
        ReplyPacket request = null;
        long typeID = -1;
        long fieldID = -1;

        // Request referenceTypeID for class
        typeID = getClassID(classSignature);
View Full Code Here

     *            Command packet to be sent
     * @return received ReplyPacket
     */
    public ReplyPacket performCommand(CommandPacket command)
            throws TestErrorException {
        ReplyPacket replyPacket = null;
        try {
            replyPacket = packetDispatcher.performCommand(command);
        } catch (IOException e) {
            throw new TestErrorException(e);
        } catch (InterruptedException e) {
View Full Code Here

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

        long typeID;  
        String signature;  
        int status;

        int classes = reply.getNextValueAsInt();
        assertTrue(classes > 0);

        int count = 0;
        for (int i = 0; i < classes; i++) {

            reply.getNextValueAsByte();
            typeID = reply.getNextValueAsReferenceTypeID();
            signature = reply.getNextValueAsString();
            status = reply.getNextValueAsInt();

            if ( (status & JDWPConstants.ClassStatus.ARRAY) != 0 ){
                logWriter.println("## FAILURE: Unexpected status is returned:");
                logWriter.println("##          ReferenceTypeId = " + typeID);
                logWriter.println("##          Class signature: " + signature);
View Full Code Here

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

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

        int classes = reply.getNextValueAsInt();
        logWriter.println("==> Number of reference types = " + classes);
        assertTrue(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;
            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

     *            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

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.