当前位置: 首页>>代码示例>>Java>>正文


Java ReplyPacket.getNextValueAsReferenceTypeID方法代码示例

本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsReferenceTypeID方法的典型用法代码示例。如果您正苦于以下问题:Java ReplyPacket.getNextValueAsReferenceTypeID方法的具体用法?Java ReplyPacket.getNextValueAsReferenceTypeID怎么用?Java ReplyPacket.getNextValueAsReferenceTypeID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket的用法示例。


在下文中一共展示了ReplyPacket.getNextValueAsReferenceTypeID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTypeID

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * Gets TypeID for specified type signature and type tag.
 * 
 * @param typeSignature
 *            type signature
 * @param classTypeTag
 *            type tag
 * @return received TypeID
 */
public long getTypeID(String typeSignature, byte classTypeTag) {
    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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:34,代码来源:VmMirror.java

示例2: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * Returns classID for the selected jni signature
 * 
 * @param signature
 * @return classID for the selected jni signature
 */
protected long getClassIDBySignature(String signature) {
    logWriter.println("=> Getting reference type ID for class: "
            + signature);
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
    int classes = reply.getNextValueAsInt();
    logWriter.println("=> Returned number of classes: " + classes);
    long classID = 0;
    for (int i = 0; i < classes; i++) {
        reply.getNextValueAsByte();
        classID = reply.getNextValueAsReferenceTypeID();
        reply.getNextValueAsInt();
        // we need the only class, even if there were multiply ones
        break;
    }
    assertTrue(
            "VirtualMachine::ClassesBySignature command returned invalid classID:<"
                    + classID + "> for signature " + signature, classID > 0);
    return classID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:JDWPTestCase.java

示例3: getReferenceTypeID

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * Returns reference type ID.
 * 
 * @param signature
 * @return type ID for the selected jni signature
 */
protected long getReferenceTypeID(String signature) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::ClassesBySignature command");
    int classes = reply.getNextValueAsInt();
    // this class may be loaded only once
    assertEquals("Invalid number of classes for reference type: "
            + signature + ",", 1, classes);
    byte refTypeTag = reply.getNextValueAsByte();
    long classID = reply.getNextValueAsReferenceTypeID();
    int status = reply.getNextValueAsInt();
    logWriter.println("VirtualMachine.ClassesBySignature: classes="
            + classes + " refTypeTag=" + refTypeTag + " typeID= " + classID
            + " status=" + status);
    assertAllDataRead(reply);
    assertEquals("", JDWPConstants.TypeTag.CLASS, refTypeTag);
    return classID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:JDWPTestCase.java

示例4: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
protected long getClassIDBySignature(String signature) {
    logWriter.println("=> Getting reference type ID for class: " + signature);
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    packet.setNextValueAsString(signature);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    if (!checkReplyPacketWithoutFail(reply, "VirtualMachine::ClassesBySignature command")) {
        throw new TestErrorException("Error during performing VirtualMachine::ClassesBySignature command");
    }
    int classes = reply.getNextValueAsInt();
    logWriter.println("=> Returned number of classes: " + classes);
    long classID = 0;
    for (int i = 0; i < classes; i++) {
        reply.getNextValueAsByte();
        classID = reply.getNextValueAsReferenceTypeID();
        reply.getNextValueAsInt();
        // we need the only class, even if there were multiply ones
        break;
    }
    assertTrue("VirtualMachine::ClassesBySignature command returned invalid classID:<" +
            classID + "> for signature " + signature, classID > 0);
    return classID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:LaunchedDebugger.java

示例5: getObjectReferenceType

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * Helper that returns reference type ID for input object ID.
 * 
 * @param objectID -
 *            debuggee object ID
 * @return reference type ID
 */
protected long getObjectReferenceType(long objectID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.ReferenceTypeCommand);
    command.setNextValueAsReferenceTypeID(objectID);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(command);
    checkReplyPacket(reply, "ObjectReference::ReferenceType command");
    // byte refTypeTag =
    reply.getNextValueAsByte();
    long objectRefTypeID = reply.getNextValueAsReferenceTypeID();
    return objectRefTypeID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:JDWPTestCase.java

示例6: testAllClassesWithGeneric002

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises VirtualMachine.AllClassesWithGeneric command.
 * <BR>At first the test starts HelloWorld debuggee.
 * <BR> Then the test performs VirtualMachine.AllClassesWithGeneric 
 * command and checks that:
 * <BR>&nbsp;&nbsp; - number of reference types returned by command has
 *                    non-zero value;
 * <BR>&nbsp;&nbsp; - there are no classes with the 'ARRAY' or
 *                    'PRIMITIVE' bits in the status flag;
 */
public void testAllClassesWithGeneric002() {
    logWriter.println("==> testAllClassesWithGeneric002: START...");

    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    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");

    long typeID;   
    String signature, genericSignature;
    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();
        genericSignature = 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);
            logWriter.println("##          Class generic signature: " + genericSignature);
            logWriter.println("##          Class status = 0x" + Integer.toHexString(status) 
                + "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
            logWriter.println("##          Status \"0x"
                    + Integer.toHexString(JDWPConstants.ClassStatus.ARRAY) 
                    + "("
                    + JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.ARRAY)
                    + ")\" must NOT be returned!");
            count++;
        }
        if ( (status & JDWPConstants.ClassStatus.PRIMITIVE) != 0 ){
            logWriter.println("## FAILURE: Unexpected status is returned:");
            logWriter.println("##          ReferenceTypeId = " + typeID);
            logWriter.println("##          Class signature: " + signature);
            logWriter.println("##          Class generic signature: " + genericSignature);
            logWriter.println("##          Class status = 0x" + Integer.toHexString(status) 
                + "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
            logWriter.println("##          Status \"0x"
                    + Integer.toHexString(JDWPConstants.ClassStatus.PRIMITIVE) 
                    + "("
                    + JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.PRIMITIVE)
                    + ")\" must NOT be returned!");
            count++;
        }
    }
    assertEquals("count must be 0", 0, count);
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
    logWriter.println("==> testAllClassesWithGeneric002: OK.");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:72,代码来源:AllClassesWithGenericTest.java

示例7: testAllClasses002

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises VirtualMachine.AllClasses command.
 * <BR>At first the test starts HelloWorld debuggee.
 * <BR> Then the test performs VirtualMachine.AllClasses command and checks that:
 * <BR>&nbsp;&nbsp; - number of reference types returned by command has
 *                    non-zero value;
 * <BR>&nbsp;&nbsp; - there are no classes with the 'ARRAY' or
 *                    'PRIMITIVE' bits in the status flag;
 */
public void testAllClasses002() {
    logWriter.println("==> testAllClasses002: START...");

    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    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);
            logWriter.println("##          Class status = 0x" + Integer.toHexString(status) 
                + "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
            logWriter.println("##          Status \"0x"
                    + Integer.toHexString(JDWPConstants.ClassStatus.ARRAY) 
                    + "("
                    + JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.ARRAY)
                    + ")\" must NOT be returned!");
            count++;
        }
        if ( (status & JDWPConstants.ClassStatus.PRIMITIVE) != 0 ){
            logWriter.println("## FAILURE: Unexpected status is returned:");
            logWriter.println("##          ReferenceTypeId = " + typeID);
            logWriter.println("##          Class signature: " + signature);
            logWriter.println("##          Class status = 0x" + Integer.toHexString(status) 
                + "(" + JDWPConstants.ClassStatus.getName(status)+ ")");
            logWriter.println("##          Status \"0x"
                    + Integer.toHexString(JDWPConstants.ClassStatus.PRIMITIVE) 
                    + "("
                    + JDWPConstants.ClassStatus.getName(JDWPConstants.ClassStatus.PRIMITIVE)
                    + ")\" must NOT be returned!");
            count++;
        }
    }
    assertEquals("count must be 0", 0, count);
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
    logWriter.println("==> testAllClasses002: OK.");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:68,代码来源:AllClassesTest.java

示例8: testVisibleClasses001

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises ClassLoaderReference.VisibleClasses command.
 * <BR>Starts <A HREF="../share/debuggee/HelloWorld.html">HelloWorld</A> debuggee. 
 * <BR>Then the following statements are checked: 
 * <BR>It is expected:
 * <BR>&nbsp;&nbsp; - number of reference types has non-zero value;
 * <BR>&nbsp;&nbsp; - refTypeTag takes one of the TypeTag constants: CLASS, INTERFACE, ARRAY;
 * <BR>&nbsp;&nbsp; - All data were read;
 */
public void testVisibleClasses001() {
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
    
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ClassLoaderReferenceCommandSet.CommandSetID,
            JDWPCommands.ClassLoaderReferenceCommandSet.VisibleClassesCommand);
    packet.setNextValueAsClassLoaderID(0);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ClassLoaderReference::VisibleClasses command");

    byte refTypeTag;
    String refTypeTagName;
    long typeID;
    String msgLine;

    int classes = reply.getNextValueAsInt();
    logWriter.println("Number of reference types = " + classes);
    assertTrue("Invalid returned number of reference types = " + 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++) {
        refTypeTag = reply.getNextValueAsByte();
        refTypeTagName = JDWPConstants.TypeTag.getName(refTypeTag);
        msgLine = "" + i + ".  refTypeTag = " + refTypeTagName + "(" + refTypeTag + ")";
        typeID = reply.getNextValueAsReferenceTypeID();
        msgLine = msgLine + ";  referenceTypeID = " + typeID;
        if ( (i < printBound_1) || (i >= printBound_2) ) {
            logWriter.println(msgLine);
            if ( i == (printBound_1 - 1) ) {
                logWriter.println("...\n...\n...");
            }
        }
        assertTrue("Unexpected reference TagType:<" + refTypeTag + "(" + refTypeTagName + ")>",
                refTypeTag == JDWPConstants.TypeTag.ARRAY
                || refTypeTag == JDWPConstants.TypeTag.CLASS
                || refTypeTag == JDWPConstants.TypeTag.INTERFACE);
    }

    assertAllDataRead(reply);
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:56,代码来源:VisibleClassesTest.java


注:本文中的org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsReferenceTypeID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。