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


Java CommandPacket.setNextValueAsString方法代码示例

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


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

示例1: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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

示例2: getReferenceTypeID

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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

示例3: getClassIDBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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

示例4: setEventRequest

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected int setEventRequest() {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.EventRequestCommandSet.CommandSetID,
            JDWPCommands.EventRequestCommandSet.SetCommand);
    packet.setNextValueAsByte(JDWPConstants.EventKind.METHOD_ENTRY);
    packet.setNextValueAsByte(JDWPConstants.SuspendPolicy.ALL);
    packet.setNextValueAsInt(1);
    packet.setNextValueAsByte((byte) 5);
    packet.setNextValueAsString("*.InvokeMethodDebuggee");

    logWriter.println("\nSend EventRequest::Set command...");
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "EventRequest::Set command");
    
    int requestID = reply.getNextValueAsInt();
    logWriter.println(" EventRequest.Set: requestID=" + requestID);
    assertTrue(reply.isAllDataRead());
    return requestID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:InvokeMethodTest.java

示例5: getClassBySignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Gets class reference by signature.
 * 
 * @param classSignature
 *            class signature.
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket getClassBySignature(String classSignature) {
    CommandPacket commandPacket = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.ClassesBySignatureCommand);
    commandPacket.setNextValueAsString(classSignature);
    return checkReply(performCommand(commandPacket));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:VmMirror.java

示例6: createString

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Creates java String in target VM with the given value.
 * 
 * @param value
 *            The value of the string.
 * @return The string id.
 */
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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:VmMirror.java

示例7: createString

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Performs string creation in debuggee.
 * 
 * @param value -
 *            content for new string
 * @return StringID of new created string
 */
protected long createString(String value) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.CreateStringCommand);
    packet.setNextValueAsString(value);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::CreateString command");
    long stringID = reply.getNextValueAsStringID();
    return stringID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:JDWPTestCase.java

示例8: testSetDefaultStratum001

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises VirtualMachine.SetDefaultStratum command.
 * <BR>At first the test starts HelloWorld debuggee.
 * <BR>Then the test checks that VirtualMachine.SetDefaultStratum command runs
 * without any error or returns NOT_IMPLEMENTED error.
 * Any other error is considered as test' failure.
 */
public void testSetDefaultStratum001() {
    String thisTestName = "testSetDefaultStratum001";
    
    //check capability, relevant for this test
    logWriter.println("=> Check capability: canSetDefaultStratum");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canSetDefaultStratum;
    if (!isCapability) {
        logWriter.println("##WARNING: this VM dosn't possess capability: canSetDefaultStratum");
        return;
    }
    
    logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    logWriter.println("=> CHECK1: send " + thisCommandName + " and check reply for ERROR...");
    String stratumID = "C++";
    CommandPacket checkedCommand = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.SetDefaultStratumCommand);
    checkedCommand.setNextValueAsString(stratumID);
    
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
    checkedCommand = null;

    short errorCode = checkedReply.getErrorCode();
    if ( errorCode != JDWPConstants.Error.NONE ) {
        if ( errorCode != JDWPConstants.Error.NOT_IMPLEMENTED ) {
            printErrorAndFail(thisCommandName 
                + " returns unexpected ERROR = " + errorCode 
                + "(" + JDWPConstants.Error.getName(errorCode) + ")");
        } else { 
            logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
        }
    } else {
        logWriter.println
        ("=> CHECK PASSED: No any error is received");
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:47,代码来源:SetDefaultStratumTest.java


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