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


Java ReplyPacket类代码示例

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


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

示例1: updateEventContext

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
private void updateEventContext(EventThread event) {
  final long threadId = event.getThreadID();
  final List<JUnit3Wrapper.DebuggeeState.DebuggeeFrame> frames = new ArrayList<>();
  debuggeeState = new DebuggeeState(getMirror(), threadId, frames);

  // ART returns an error if we ask for frames when there is none. Workaround by asking the
  // frame count first.
  int frameCount = getMirror().getFrameCount(threadId);
  if (frameCount > 0) {
    ReplyPacket replyPacket = getMirror().getThreadFrames(threadId, 0, frameCount);
    int number = replyPacket.getNextValueAsInt();
    assertEquals(frameCount, number);

    for (int i = 0; i < frameCount; ++i) {
      long frameId = replyPacket.getNextValueAsFrameID();
      Location location = replyPacket.getNextValueAsLocation();
      frames.add(debuggeeState.new DebuggeeFrame(frameId, location));
    }
    assertAllDataRead(replyPacket);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:22,代码来源:DebugTestBase.java

示例2: perform

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
@Override
public void perform(JUnit3Wrapper testBase) {
  long threadId = testBase.getDebuggeeState().getThreadId();
  int stepRequestID;
  {
    EventBuilder eventBuilder = Event.builder(EventKind.SINGLE_STEP, SuspendPolicy.ALL);
    eventBuilder.setStep(threadId, stepSize, stepDepth);
    stepFilter.getExcludedClasses().stream().forEach(s -> eventBuilder.setClassExclude(s));
    ReplyPacket replyPacket = testBase.getMirror().setEvent(eventBuilder.build());
    stepRequestID = replyPacket.getNextValueAsInt();
    testBase.assertAllDataRead(replyPacket);
  }
  testBase.events
      .put(stepRequestID, new StepEventHandler(this, stepRequestID, stepFilter, stepUntil));

  // Resume all threads.
  testBase.resume();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:19,代码来源:DebugTestBase.java

示例3: isSyntheticMethod

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
private static boolean isSyntheticMethod(VmMirror mirror, Location location) {
  // We must gather the modifiers of the method. This is only possible using
  // ReferenceType.Methods command which gather information about all methods in a class.
  ReplyPacket reply = mirror.getMethods(location.classID);
  int methodsCount = reply.getNextValueAsInt();
  for (int i = 0; i < methodsCount; ++i) {
    long methodId = reply.getNextValueAsMethodID();
    reply.getNextValueAsString();  // skip method name
    reply.getNextValueAsString();  // skip method signature
    int modifiers = reply.getNextValueAsInt();
    if (methodId == location.methodID &&
        ((modifiers & SYNTHETIC_FLAG) != 0)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:18,代码来源:DebugTestBase.java

示例4: setBreakpoint

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * Sets breakpoint to given location.
 * 
 * @param typeTag
 * @param breakpoint
 * @param suspendPolicy
 *            Suspend policy for a breakpoint being created
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket setBreakpoint(byte typeTag, Breakpoint breakpoint,
        byte suspendPolicy) {
    // Get Class reference ID
    long typeID = getTypeID(breakpoint.className, typeTag);

    // Get Method reference ID
    long methodID = getMethodID(typeID, breakpoint.methodName);

    // Fill location
    Location location = new Location(typeTag, typeID, methodID,
            breakpoint.index);

    // Set breakpoint
    return setBreakpoint(location, suspendPolicy);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:VmMirror.java

示例5: getObjectID

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

示例6: setCountableBreakpoint

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * Sets breakpoint that triggers only on a certain occurrence to a given
 * location
 * 
 * @param typeTag
 * @param breakpoint
 * @param suspendPolicy
 *            Suspend policy for a breakpoint being created
 * @param count
 *            Limit the requested event to be reported at most once after a
 *            given number of occurrences
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket setCountableBreakpoint(byte typeTag,
        Breakpoint breakpoint, byte suspendPolicy, int count) {
    long typeID = getTypeID(breakpoint.className, typeTag);

    // Get Method reference ID
    long methodID = getMethodID(typeID, breakpoint.methodName);

    byte eventKind = JDWPConstants.EventKind.BREAKPOINT;

    EventMod mod1 = new EventMod();
    mod1.modKind = EventMod.ModKind.LocationOnly;
    mod1.loc = new Location(typeTag, typeID, methodID, breakpoint.index);

    EventMod mod2 = new EventMod();
    mod2.modKind = EventMod.ModKind.Count;
    mod2.count = count;

    EventMod[] mods = new EventMod[] { mod1, mod2 };
    Event event = new Event(eventKind, suspendPolicy, mods);

    // Set breakpoint
    return setEvent(event);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:VmMirror.java

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

示例8: clearBreakpoint

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * Removes breakpoint according to specified requestID.
 * 
 * @param requestID
 *            for given breakpoint
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket clearBreakpoint(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 eventKind
    commandPacket.setNextValueAsByte(JDWPConstants.EventKind.BREAKPOINT);

    // Set suspendPolicy
    commandPacket.setNextValueAsInt(requestID);

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

示例9: getFramesCount

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
private int getFramesCount(long threadID) {

        logWriter.println("getting frames of the thread");

        short err;
        
        // 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);
        err = reply.getErrorCode(); 
        if ( err != JDWPConstants.Error.NONE) {
            logWriter.println("\tthreadID=" + threadID
                    + " - " + JDWPConstants.Error.getName(err));
            return 0;
        }
        int framesCount = reply.getNextValueAsInt();
        return framesCount;
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:FrameCountTest.java

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

示例11: getFieldID

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * Gets FieldID from ReplyPacket.
 * 
 * @param request
 *            ReplyPacket for request
 * @param field
 *            field name to get ID for
 * @return received FieldID
 */
public long getFieldID(ReplyPacket request, String field) {
    long fieldID = -1;
    String fieldName;
    // Get fieldID from received packet
    int count = request.getNextValueAsInt();
    for (int i = 0; i < count; i++) {
        fieldID = request.getNextValueAsFieldID();
        fieldName = request.getNextValueAsString();
        if (field.equals(fieldName)) {
            request.getNextValueAsString();
            request.getNextValueAsInt();
            break;
        } else {
            request.getNextValueAsString();
            request.getNextValueAsInt();
            fieldID = 0;
            fieldName = null;
        }
    }
    return fieldID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:VmMirror.java

示例12: getMethodName

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * Helper for getting method name of corresponding class and method ID.
 * 
 * @param classID class id
 * @param methodID method id
 * @return String
 */
protected String getMethodName(long classID, long methodID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
            JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
    packet.setNextValueAsClassID(classID);
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ReferenceType::Methods command");
    int methods = reply.getNextValueAsInt();
    for (int i = 0; i < methods; i++) {
        long mid = reply.getNextValueAsMethodID();
        String name = reply.getNextValueAsString();
        reply.getNextValueAsString();
        reply.getNextValueAsInt();
        if (mid == methodID) {
            return name;
        }
    }
    return "unknown";
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:JDWPTestCase.java

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

示例14: asserSuperClassReplyIsValid

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
private void asserSuperClassReplyIsValid(ReplyPacket reply, String expectedSignature) {
    assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
    long superClassID = reply.getNextValueAsClassID();
    logWriter.println("superClassID=" + superClassID);
    if (superClassID == 0) {
        // for superclass of Object expectedSignature is null
        assertNull
        ("ClassType::Superclass command returned invalid expectedSignature that must be null",
                expectedSignature);
    } else {
        String signature = getClassSignature(superClassID);
        logWriter.println("Signature: "+signature);
        assertString("ClassType::Superclass command returned invalid signature,",
                expectedSignature, signature);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:SuperClassTest.java

示例15: testMethodEntry

import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入依赖的package包/类
/**
 * This testcase is for METHOD_ENTRY event.
 * <BR>It runs MethodEntryDebuggee that executed its own method 
 * and verify that requested METHOD_ENTRY event occurs.
 */
public void testMethodEntry() {
    logWriter.println("testMethodEntry started");

    String methodEntryClassNameRegexp = "org.apache.harmony.jpda.tests.jdwp.Events.MethodEntryDebuggee"; 
    //String methodEntryClassNameSignature = "Lorg/apache/harmony/jpda/tests/jdwp/Events/MethodEntryDebuggee;"; 

    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    ReplyPacket reply = debuggeeWrapper.vmMirror.setMethodEntry(methodEntryClassNameRegexp);
    checkReplyPacket(reply, "Set METHOD_ENTRY event");

    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);

    CommandPacket event = debuggeeWrapper.vmMirror.receiveEvent();
    ParsedEvent[] parsedEvents = ParsedEvent.parseEventPacket(event);

    assertEquals("Invalid number of events,", 1, parsedEvents.length);
    assertEquals("Invalid event kind,",
            JDWPConstants.EventKind.METHOD_ENTRY,
            parsedEvents[0].getEventKind(),
            JDWPConstants.EventKind.getName(JDWPConstants.EventKind.METHOD_ENTRY),
            JDWPConstants.EventKind.getName(parsedEvents[0].getEventKind()));

    logWriter.println("MethodEntryTest done");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:MethodEntryTest.java


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