當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandPacket.setNextValueAsObjectID方法代碼示例

本文整理匯總了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsObjectID方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandPacket.setNextValueAsObjectID方法的具體用法?Java CommandPacket.setNextValueAsObjectID怎麽用?Java CommandPacket.setNextValueAsObjectID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket的用法示例。


在下文中一共展示了CommandPacket.setNextValueAsObjectID方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMethods

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Gets method reference by signature.
 * 
 * @param classReferenceTypeID
 *            class referenceTypeID.
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket getMethods(long classReferenceTypeID) {
    // Create new command packet
    CommandPacket commandPacket = new CommandPacket();

    // Set command. "5" - is ID of Methods command in ReferenceType Command
    // Set
    commandPacket
            .setCommand(JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);

    // Set command set. "2" - is ID of ReferenceType Command Set
    commandPacket
            .setCommandSet(JDWPCommands.ReferenceTypeCommandSet.CommandSetID);

    // Set outgoing data
    // Set referenceTypeID
    commandPacket.setNextValueAsObjectID(classReferenceTypeID);

    // Send packet
    return checkReply(performCommand(commandPacket));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:28,代碼來源:VmMirror.java

示例2: setInstanceFieldsValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Sets the value of one or more instance fields
 * 
 * @param objectID
 *            The object ID.
 * @param fieldIDs
 *            An array of fields IDs
 * @param values
 *            An array of Value objects representing each value to set
 */
public final void setInstanceFieldsValues(long objectID, long[] fieldIDs,
        Value[] values) {
    if (fieldIDs.length != values.length) {
        throw new TestErrorException(
                "Number of fields doesn't correspond to number of their values");
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
    command.setNextValueAsObjectID(objectID);
    command.setNextValueAsInt(fieldIDs.length);
    for (int i = 0; i < fieldIDs.length; i++) {
        command.setNextValueAsFieldID(fieldIDs[i]);
        command.setNextValueAsUntaggedValue(values[i]);
    }

    checkReply(performCommand(command));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:30,代碼來源:VmMirror.java

示例3: invokeInstanceMethod

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Invokes a member method of the given object.
 * 
 * @param objectID
 *            The object ID.
 * @param threadID
 *            The thread ID.
 * @param methodName
 *            The name of method for the invocation.
 * @param args
 *            The arguments for the invocation.
 * @param options
 *            The invocation options.
 * @return ReplyPacket for corresponding command
 */
public final ReplyPacket invokeInstanceMethod(long objectID, long threadID,
        String methodName, Value[] args, int options) {
    long classID = getReferenceType(objectID);
    long methodID = getMethodID(classID, methodName);
    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.InvokeMethodCommand);
    command.setNextValueAsObjectID(objectID);
    command.setNextValueAsThreadID(threadID);
    command.setNextValueAsClassID(classID);
    command.setNextValueAsMethodID(methodID);
    command.setNextValueAsInt(args.length);
    for (int i = 0; i < args.length; i++) {
        command.setNextValueAsValue(args[i]);
    }
    command.setNextValueAsInt(options);

    return checkReply(performCommand(command));
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:35,代碼來源:VmMirror.java

示例4: getReferenceType

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns the runtime type of the object
 * 
 * @param objectID
 *            The object ID
 * @return The runtime reference type.
 */
public final long getReferenceType(long objectID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.ReferenceTypeCommand);
    command.setNextValueAsObjectID(objectID);
    ReplyPacket reply = checkReply(performCommand(command));
    reply.getNextValueAsByte();
    return reply.getNextValueAsLong();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:VmMirror.java

示例5: getStringValue

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns the characters contained in the string
 * 
 * @param objectID
 *            The String object ID.
 * @return A string value.
 */
public final String getStringValue(long objectID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.StringReferenceCommandSet.CommandSetID,
            JDWPCommands.StringReferenceCommandSet.ValueCommand);
    command.setNextValueAsObjectID(objectID);
    ReplyPacket reply = checkReply(performCommand(command));
    return reply.getNextValueAsString();
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:VmMirror.java

示例6: getStringValue

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * Returns corresponding string from string ID.
 * 
 * @param stringID -
 *            string ID
 * @return string value
 */
protected String getStringValue(long stringID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.StringReferenceCommandSet.CommandSetID,
            JDWPCommands.StringReferenceCommandSet.ValueCommand);
    packet.setNextValueAsObjectID(stringID);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "StringReference::Value command");
    String returnedTestString = reply.getNextValueAsString();
    return returnedTestString;
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:18,代碼來源:JDWPTestCase.java

示例7: testReferringObjects_IllegalArgument

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //導入方法依賴的package包/類
/**
 * This testcase exercises ObjectReference.ReferringObjects command. <BR>
 * Compose a ReferringObjects command with negative maxReferrers
 * The vm should throw a ILLEGAL_ARGUMENT exception.
 */
public void testReferringObjects_IllegalArgument() {
    String thisTestName = "testReferringObjects_IllegalArgument";
    
    if (!isCapability()) {
        logWriter.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
        return;
    }
    
    int maxReferrers = -1;
    
    logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    // Compose Instances command to get referree objectID
    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);
    
    long referreeObjTypeID = getClassIDBySignature(referreeObjSignature);
    InstancesCommand.setNextValueAsReferenceTypeID(referreeObjTypeID);
    InstancesCommand.setNextValueAsInt(1);
    
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(InstancesCommand);
    InstancesCommand = null;
    
    // Get the number of instances that returned. 
    int objNum = checkedReply.getNextValueAsInt();
    // Get the tagged-objectID
    byte tag = checkedReply.getNextValueAsByte();
    long objectID = checkedReply.getNextValueAsObjectID();
    
    // Compose ReferringObjects commnad
    CommandPacket ReferringObjectsCommand = new CommandPacket(
            JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
            JDWPCommands.ObjectReferenceCommandSet.ReferringObjectsCommand);
    
    ReferringObjectsCommand.setNextValueAsObjectID(objectID);
    ReferringObjectsCommand.setNextValueAsInt(maxReferrers);
    
    // Perform ReferringObjects command and attain reply package
    checkedReply = debuggeeWrapper.vmMirror
            .performCommand(ReferringObjectsCommand);
    ReferringObjectsCommand = null;

    short errorCode = checkedReply.getErrorCode();
    if (errorCode != JDWPConstants.Error.NONE) {
        if (errorCode == JDWPConstants.Error.NOT_IMPLEMENTED) {
            logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
            return;
        }
        else if(errorCode == JDWPConstants.Error.ILLEGAL_ARGUMENT) {
            logWriter.println("=> CHECK PASSED: Expected error (ILLEGAL_ARGUMENT) is returned");
            return;
        }
    }
    printErrorAndFail(thisCommandName + " should throw ILLEGAL_ARGUMENT exception when maxReferrers is negative.");
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:63,代碼來源:ReferringObjectsTest.java


注:本文中的org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsObjectID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。