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


Java CommandPacket.setNextValueAsThreadID方法代码示例

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


在下文中一共展示了CommandPacket.setNextValueAsThreadID方法的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: 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

示例3: 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);
    if (!checkReplyPacketWithoutFail(reply, "ThreadReference::FramesCommand command")) {
        throw new TestErrorException("Error during performing ThreadReference::Frames 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,代码行数:23,代码来源:LaunchedDebugger.java

示例4: resumeThread

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Resumes specified thread on target Virtual Machine
 * 
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket resumeThread(long threadID) {
    CommandPacket commandPacket = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.ResumeCommand);

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

示例5: suspendThread

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Suspends specified thread in debuggee VM.
 * 
 * @return ReplyPacket for corresponding command
 */
public ReplyPacket suspendThread(long threadID) {
    CommandPacket commandPacket = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.SuspendCommand);

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

示例6: testOwnedMonitorsStackDepthInfo_Unsuspended

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
public void testOwnedMonitorsStackDepthInfo_Unsuspended() {
    String thisTestName = "testOwnedMonitorsStackDepthInfo";
    logWriter.println("==> " + thisTestName + " for " + thisCommandName
            + ": START...");
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    if (!isCapability()) {
        logWriter
                .println("##WARNING: this VM dosn't possess capability: OwnedMonitorsStackDepthInfo");
        return;
    }

    // Getting ID of the tested thread
    logWriter.println("==> testedThreadName = "
            + OwnedMonitorsStackDepthInfoDebuggee.TESTED_THREAD);
    logWriter.println("==> Get testedThreadID...");
    long testedThreadID = debuggeeWrapper.vmMirror
            .getThreadID(OwnedMonitorsStackDepthInfoDebuggee.TESTED_THREAD);

    // Compose the OwnedMonitorsStackDepthInfo command
    CommandPacket stackDepthPacket = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.OwnedMonitorsStackDepthInfoCommand);
    stackDepthPacket.setNextValueAsThreadID(testedThreadID);

    // Perform the command and attain the reply package
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror
            .performCommand(stackDepthPacket);
    short errorCode = checkedReply.getErrorCode();
    if (errorCode != JDWPConstants.Error.NONE) {
        if (errorCode == JDWPConstants.Error.THREAD_NOT_SUSPENDED) {
            logWriter.println("=> CHECK PASSED: Expected error (THREAD_NOT_SUSPENDED) is returned");
            return;
        }
    }
    printErrorAndFail(thisCommandName + " should throw exception when VM is not suspended.");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:38,代码来源:OwnedMonitorsStackDepthInfoTest.java

示例7: getThreadStatus

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Returns thread status for specified <code>threadID</code>.
 * 
 * @param threadID
 *            thread ID
 * @return thread status
 */
public int getThreadStatus(long threadID) {
    CommandPacket commandPacket = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
    commandPacket.setNextValueAsThreadID(threadID);
    ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
    return replyPacket.getNextValueAsInt();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:VmMirror.java

示例8: getThisObject

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Returns the value of the 'this' reference for this frame
 * 
 * @param threadID
 *            The frame's thread ID
 * @param frameID
 *            The frame ID.
 * @return The 'this' object ID for this frame.
 */
public final long getThisObject(long threadID, long frameID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.StackFrameCommandSet.CommandSetID,
            JDWPCommands.StackFrameCommandSet.ThisObjectCommand);
    command.setNextValueAsThreadID(threadID);
    command.setNextValueAsFrameID(frameID);
    ReplyPacket reply = checkReply(performCommand(command));
    TaggedObject taggedObject = reply.getNextValueAsTaggedObject();
    return taggedObject.objectID;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:VmMirror.java

示例9: getThreadGroupID

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Returns the thread group that contains a given thread
 * 
 * @param threadID
 *            The thread object ID.
 * @return The thread group ID of this thread.
 */
public final long getThreadGroupID(long threadID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.ThreadGroupCommand);
    command.setNextValueAsThreadID(threadID);
    ReplyPacket reply = checkReply(performCommand(command));
    return reply.getNextValueAsThreadGroupID();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:VmMirror.java

示例10: isThreadSuspended

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Checks whether a given thread is suspended or not
 * 
 * @param threadID
 *            The thread object ID.
 * @return True if a given thread is suspended, false otherwise.
 */
public final boolean isThreadSuspended(long threadID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
    command.setNextValueAsThreadID(threadID);
    ReplyPacket reply = checkReply(performCommand(command));
    reply.getNextValueAsInt(); // the thread's status; is not used
    return reply.getNextValueAsInt() == JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:17,代码来源:VmMirror.java

示例11: testInterrupt001

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises ThreadReference.Interrupt command.
 * <BR>At first the test starts InterruptDebuggee which runs
 * the tested thread 'TESTED_THREAD' and blocks it in invocation of
 * the 'wait()' method. 
 * <BR> Then the tests performs the ThreadReference.Interrupt command 
 * for tested thread. 
 * <BR>After sending Interrupt command, the test waits signals via synchronization
 * channel that 'InterruptedException' was thrown.
 */
public void testInterrupt001() {
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    // getting ID of the tested thread
    logWriter.println("get thread ID");
    long threadID = 
        debuggeeWrapper.vmMirror.getThreadID(InterruptDebuggee.TESTED_THREAD);

    // getting the thread group ID
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.InterruptCommand);
    packet.setNextValueAsThreadID(threadID);
    logWriter.println("send \"Interrupt\" command");
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    
    short err = reply.getErrorCode();
    logWriter.println("error = " + err);

    if (err == JDWPConstants.Error.NONE) {
        Thread thrd = new RecvThread();
        thrd.start();
        try {
            thrd.join(settings.getTimeout());
        } catch(InterruptedException e) {
            
        }
    }

    if (!isReceived) {
        printErrorAndFail(waitForString + " is not received");
    } else {
        logWriter.println(waitForString + " is received");
    }
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:48,代码来源:InterruptTest.java

示例12: jdwpGetFrameCount

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected int jdwpGetFrameCount(long threadID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.FrameCountCommand);
    packet.setNextValueAsThreadID(threadID);
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ThreadReference::FrameCount command");
    
    int frameCount = reply.getNextValueAsInt();
    return frameCount;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:JDWPStackFrameTestCase.java

示例13: jdwpGetThreadName

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected String jdwpGetThreadName(long threadID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.NameCommand);
    packet.setNextValueAsThreadID(threadID);
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ThreadReference::Name command");
    
    String name= reply.getNextValueAsString();
    return name;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:JDWPStackFrameTestCase.java

示例14: jdwpResumeThread

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected void jdwpResumeThread(long threadID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.ResumeCommand);
    packet.setNextValueAsThreadID(threadID);
    
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ThreadReference::Resume command");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:JDWPStackFrameTestCase.java

示例15: testStatus005

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises ThreadReference.Status command for the Thread waiting UNDEFINITELY.
 * <BR>At first the test starts Status004Debuggee which runs
 * the tested thread and blocks it in invocation of
 * the 'Object.wait()' method. 
 * <BR> Then the tests performs the ThreadReference.Status command 
 * for tested thread. 
 * <BR>It is expected that:
 * <BR>&nbsp;&nbsp; - returned thread status is WAIT status;
 * <BR>&nbsp;&nbsp; - returned suspend status is not SUSPEND_STATUS_SUSPENDED status;
 */
public void testStatus005() {
    String thisTestName = "testStatus005";
    logWriter.println("==> " + thisTestName + " for ThreadReference.Status command: START...");
    logWriter.println("==> This " + thisTestName
        + " checks command for WAITING Thread: which is waiting UNDEFINITELY in Object.wait() method...");
    String checkedThreadName = synchronizer.receiveMessage();
    logWriter.println("=> checkedThreadName = " + checkedThreadName);

    long checkedThreadID = debuggeeWrapper.vmMirror.getThreadID(checkedThreadName);
    logWriter.println("=> checkedThreadID = " + checkedThreadID);

    logWriter.println
    ("=> Send ThreadReference.Status command for checked Thread and check reply...");
    CommandPacket checkedCommand = new CommandPacket(
            JDWPCommands.ThreadReferenceCommandSet.CommandSetID,
            JDWPCommands.ThreadReferenceCommandSet.StatusCommand);
    checkedCommand.setNextValueAsThreadID(checkedThreadID);
    
    ReplyPacket checkedReply = debuggeeWrapper.vmMirror.performCommand(checkedCommand);
    checkReplyPacket(checkedReply, "ThreadReference.Status command");
    
    int threadStatus = checkedReply.getNextValueAsInt();
    int suspendStatus = checkedReply.getNextValueAsInt();

    logWriter.println("\n=> Returned thread status = 0x" + Integer.toHexString(threadStatus)
            + "(" + JDWPConstants.ThreadStatus.getName(threadStatus) + ")");
    if (threadStatus != JDWPConstants.ThreadStatus.WAIT) {
        finalSyncMessage = JPDADebuggeeSynchronizer.SGNL_CONTINUE;
        printErrorAndFail("Unexpected thread status is returned:"
            + "\n Expected thread status = 0x"
            + Integer.toHexString(JDWPConstants.ThreadStatus.WAIT)
            + "(" + JDWPConstants.ThreadStatus.getName(JDWPConstants.ThreadStatus.WAIT) + ")");
    } else {
        logWriter.println("=> OK - Expected thread status is returned");
    }

    logWriter.println
        ("\n=> Returned thread suspend status = 0x" + Integer.toHexString(suspendStatus)
        + "(" + getThreadSuspendStatusName(suspendStatus) + ")");
    if (suspendStatus == JDWPConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED) {
        finalSyncMessage = JPDADebuggeeSynchronizer.SGNL_CONTINUE;
        printErrorAndFail("Unexpected thread status is returned:"
            + "\n Expected thread status = 0x"
            + Integer.toHexString(0)
            + "(" + getThreadSuspendStatusName(0) + ")");
    } else {
        logWriter.println("=> OK - Expected thread suspend status is returned");
    }

    logWriter.println("=> Send to Debuggee signal to funish ...");
    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);

    logWriter.println("==> " + thisTestName + " for ThreadReference.Status command: FINISH...");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:66,代码来源:Status004Test.java


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