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


Java CommandPacket类代码示例

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


CommandPacket类属于org.apache.harmony.jpda.tests.framework.jdwp包,在下文中一共展示了CommandPacket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: perform

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
@Override
public void perform(JUnit3Wrapper testBase) {
  Optional<Variable> localVar =
      getVariableAt(testBase.getMirror(), testBase.debuggeeState.getLocation(), localName);
  Assert.assertTrue("No local '" + localName + "'", localVar.isPresent());

  CommandPacket setValues = new CommandPacket(StackFrameCommandSet.CommandSetID,
      StackFrameCommandSet.SetValuesCommand);
  setValues.setNextValueAsThreadID(testBase.getDebuggeeState().getThreadId());
  setValues.setNextValueAsFrameID(testBase.getDebuggeeState().getFrameId());
  setValues.setNextValueAsInt(1);
  setValues.setNextValueAsInt(localVar.get().getSlot());
  setValues.setNextValueAsValue(newValue);
  ReplyPacket replyPacket = testBase.getMirror().performCommand(setValues);
  testBase.checkReplyPacket(replyPacket, "StackFrame.SetValues");
}
 
开发者ID:inferjay,项目名称:r8,代码行数:17,代码来源:DebugTestBase.java

示例2: ClearAllBreakpoints

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
/**
 * Removes all breakpoints.
 * 
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket ClearAllBreakpoints() {

    // Create new command packet
    CommandPacket commandPacket = new CommandPacket();

    // Set command. "3" - is ID of ClearAllBreakpoints command in
    // EventRequest Command Set
    commandPacket
            .setCommand(JDWPCommands.EventRequestCommandSet.ClearAllBreakpointsCommand);

    // Set command set. "15" - is ID of EventRequest Command Set
    commandPacket
            .setCommandSet(JDWPCommands.EventRequestCommandSet.CommandSetID);

    // Send packet
    return checkReply(performCommand(commandPacket));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:VmMirror.java

示例3: getTopFrameLocation

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
@SuppressWarnings("unused")
private Location getTopFrameLocation(long threadID) {

    // getting frames of the thread
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.FramesCommand);
    packet.setNextValueAsThreadID(threadID);
    packet.setNextValueAsInt(0);
    packet.setNextValueAsInt(1);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    debuggeeWrapper.vmMirror.checkReply(reply);

    // assert that only one top frame is returned
    int framesCount = reply.getNextValueAsInt();
    assertEquals("Invalid number of top stack frames,", 1, framesCount);

    long frameID = reply.getNextValueAsFrameID();
    Location loc = reply.getNextValueAsLocation();

    return loc;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:ExceptionTest.java

示例4: getMethodStartCodeIndex

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
long getMethodStartCodeIndex(long classID, String methodName) {
    long methodID = debuggeeWrapper.vmMirror.getMethodID(classID, methodName);
    if ( methodID == -1 ) {
        logWriter.println
        ("## getMethodStartCodeIndex(): Can NOT get methodID for classID = " 
                + classID + "; Method name = " + methodName);
        return -1;
    }
    
    CommandPacket packet = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.LineTableCommand);
    packet.setNextValueAsClassID(classID);
    packet.setNextValueAsMethodID(methodID);
    ReplyPacket lineTableReply = debuggeeWrapper.vmMirror.performCommand(packet);
    if ( ! checkReplyPacketWithoutFail
            (lineTableReply,  "getMethodStartCodeIndex(): Method.LineTable command") ) {
        return -1;
    }
    long methodStartCodeIndex = lineTableReply.getNextValueAsLong();
    return methodStartCodeIndex;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:CombinedEventsTestCase.java

示例5: 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

示例6: clearEvent

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
/**
 * Clear an event request for specified request ID.
 * 
 * @param eventKind
 *            event type to clear
 * @param requestID
 *            request ID to clear
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket clearEvent(byte eventKind, int requestID) {
    // Create new command packet
    CommandPacket commandPacket = new CommandPacket();

    // Set command. "2" - is ID of Clear command in EventRequest Command Set
    commandPacket
            .setCommand(JDWPCommands.EventRequestCommandSet.ClearCommand);

    // Set command set. "15" - is ID of EventRequest Command Set
    commandPacket
            .setCommandSet(JDWPCommands.EventRequestCommandSet.CommandSetID);

    // Set outgoing data
    // Set event type to clear
    commandPacket.setNextValueAsByte(eventKind);

    // Set ID of request to clear
    commandPacket.setNextValueAsInt(requestID);

    // Send packet
    return checkReply(performCommand(commandPacket));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:VmMirror.java

示例7: 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

示例8: getMethodSignature

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
/**
 * Returns JNI signature of method.
 * 
 * @param classID
 *            The reference type ID.
 * @param methodID
 *            The method ID.
 * @return JNI signature of method.
 */
public final String getMethodSignature(long classID, long methodID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
    command.setNextValueAsReferenceTypeID(classID);
    ReplyPacket reply = checkReply(performCommand(command));
    int methods = reply.getNextValueAsInt();
    String value = null;
    for (int i = 0; i < methods; i++) {
        long mID = reply.getNextValueAsMethodID();
        reply.getNextValueAsString(); // name of the method; is not used
        String methodSign = reply.getNextValueAsString();
        reply.getNextValueAsInt();
        if (mID == methodID) {
            value = methodSign;
            value = value.replaceAll("/", ".");
            int lastRoundBracketIndex = value.lastIndexOf(")");
            value = value.substring(0, lastRoundBracketIndex + 1);
            break;
        }
    }

    return value;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:34,代码来源:VmMirror.java

示例9: 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

示例10: setStaticFieldsValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
/**
 * Sets the value of one or more static fields
 * 
 * @param classID
 *            The class type ID.
 * @param fieldIDs
 *            An array of fields IDs
 * @param values
 *            An array of Value objects representing each value to set
 */
public final void setStaticFieldsValues(long classID, 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.ClassTypeCommandSet.CommandSetID,
            JDWPCommands.ClassTypeCommandSet.SetValuesCommand);
    command.setNextValueAsClassID(classID);
    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

示例11: checkArrayValues

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
private void checkArrayValues(ArrayRegion valuesRegion, long classID,
                              long fieldID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
    packet.setNextValueAsReferenceTypeID(classID);
    packet.setNextValueAsInt(1);
    packet.setNextValueAsFieldID(fieldID);

    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ReferenceType::GetValues command");

    assertEquals("GetValuesCommand returned invalid number of values,", 1, reply.getNextValueAsInt());
    Value value = reply.getNextValueAsValue();
    //System.err.println("value="+value);
    long arrayID = value.getLongValue();
    int length = valuesRegion.getLength();

    checkArrayRegion(valuesRegion, arrayID, 0, length);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:SetValuesTest.java

示例12: getMethodEndCodeIndex

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
@SuppressWarnings("unused")
long getMethodEndCodeIndex(long classID, String methodName) {
    long methodID = debuggeeWrapper.vmMirror.getMethodID(classID, methodName);
    if ( methodID == -1 ) {
        logWriter.println
        ("## getMethodEndCodeIndex(): Can NOT get methodID for classID = " 
                + classID + "; Method name = " + methodName);
        return -1;
    }
    
    CommandPacket packet = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.LineTableCommand);
    packet.setNextValueAsClassID(classID);
    packet.setNextValueAsMethodID(methodID);
    ReplyPacket lineTableReply = debuggeeWrapper.vmMirror.performCommand(packet);
    if ( ! checkReplyPacketWithoutFail
            (lineTableReply,  "getMethodEndCodeIndex(): Method.LineTable command") ) {
        return -1;
    }
    long methodStartCodeIndex = lineTableReply.getNextValueAsLong();
    long methodEndCodeIndex = lineTableReply.getNextValueAsLong();
    return methodEndCodeIndex;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:CombinedEventsTestCase.java

示例13: jdwpGetFrames

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
protected FrameInfo[] jdwpGetFrames(long threadID, int startFrame, int length) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.FramesCommand);
    packet.setNextValueAsThreadID(threadID);
    packet.setNextValueAsInt(startFrame);
    packet.setNextValueAsInt(length);
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ThreadReference::FramesCommand command");
           
    int frames = reply.getNextValueAsInt();
    FrameInfo[] frameInfos = new FrameInfo[frames];
    for (int i = 0; i < frames; i++) {
        long frameID = reply.getNextValueAsLong();
        Location location = reply.getNextValueAsLocation();
        frameInfos[i] = new FrameInfo(frameID, location);
    }
    return frameInfos;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:JDWPStackFrameTestCase.java

示例14: getObjectID

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
private long getObjectID() {
    // Compose Instances command to get tested thread objectID
    CommandPacket InstancesCommand = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.InstancesCommand);

    long testThreadTypeID = getClassIDBySignature(testObjSignature);
    InstancesCommand.setNextValueAsReferenceTypeID(testThreadTypeID);
    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();
    return objectID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:22,代码来源:ForceEarlyReturn006Test.java

示例15: jdwpGetAllThreads

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入依赖的package包/类
protected long[] jdwpGetAllThreads() {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.VirtualMachineCommandSet.CommandSetID,
            JDWPCommands.VirtualMachineCommandSet.AllThreadsCommand);
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "VirtualMachine::AllThreads command");
    
    int frames = reply.getNextValueAsInt();
    
    long[] frameIDs = new long[frames]; 
    for (int i = 0; i < frames; i++) {
        frameIDs[i] = reply.getNextValueAsLong();
    }
    
    return frameIDs;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:JDWPStackFrameTestCase.java


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