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


Java CommandPacket.setNextValueAsMethodID方法代码示例

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


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

示例1: getLineTable

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Returns line number information for the method, if present.
 * 
 * @param refType
 *            The class ID
 * @param methodID
 *            The method ID
 * @return ReplyPacket for corresponding command.
 */
public final ReplyPacket getLineTable(long refType, long methodID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.LineTableCommand);
    command.setNextValueAsReferenceTypeID(refType);
    command.setNextValueAsMethodID(methodID);
    // ReplyPacket reply =
    // debuggeeWrapper.vmMirror.checkReply(debuggeeWrapper.vmMirror.performCommand(command));
    // it is impossible to obtain line table information from native
    // methods, so reply checking is not performed
    ReplyPacket reply = performCommand(command);
    if (reply.getErrorCode() != JDWPConstants.Error.NONE) {
        if (reply.getErrorCode() == JDWPConstants.Error.NATIVE_METHOD) {
            return reply;
        }
    }

    return checkReply(reply);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:VmMirror.java

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

示例3: invokeStaticMethod

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Invokes a static method of the given class.
 * 
 * @param classID
 *            The class type 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 invokeStaticMethod(long classID, long threadID,
        String methodName, Value[] args, int options) {
    long methodID = getMethodID(classID, methodName);
    CommandPacket command = new CommandPacket(
            JDWPCommands.ClassTypeCommandSet.CommandSetID,
            JDWPCommands.ClassTypeCommandSet.InvokeMethodCommand);
    command.setNextValueAsClassID(classID);
    command.setNextValueAsThreadID(threadID);
    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,代码行数:33,代码来源:VmMirror.java

示例4: jdwpGetVariableTable

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected VarInfo[] jdwpGetVariableTable(long classID, long methodID) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.VariableTableCommand);
    packet.setNextValueAsClassID(classID);
    packet.setNextValueAsMethodID(methodID);

    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "Method::VariableTable command");
    
    reply.getNextValueAsInt();
    int varNumber = reply.getNextValueAsInt();
    
    VarInfo[] varInfos = new VarInfo[varNumber];
    for (int i = 0; i < varNumber; i++) {
        reply.getNextValueAsLong();
        String name = reply.getNextValueAsString();
        String sign = reply.getNextValueAsString();
        reply.getNextValueAsInt();

        int slot = reply.getNextValueAsInt();
        varInfos[i] = new VarInfo(name, slot, sign);
    }
    return varInfos;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:JDWPStackFrameTestCase.java

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

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

示例7: getVariableTable

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Returns variable information for the method
 * 
 * @param classID
 *            The class ID
 * @param methodID
 *            The method ID
 * @return A list containing all variables (arguments and locals) declared
 *         within the method.
 */
public final List getVariableTable(long classID, long methodID) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.VariableTableCommand);
    command.setNextValueAsReferenceTypeID(classID);
    command.setNextValueAsMethodID(methodID);
    // ReplyPacket reply =
    // debuggeeWrapper.vmMirror.checkReply(debuggeeWrapper.vmMirror.performCommand(command));
    ReplyPacket reply = performCommand(command);
    if (reply.getErrorCode() == JDWPConstants.Error.ABSENT_INFORMATION
            || reply.getErrorCode() == JDWPConstants.Error.NATIVE_METHOD) {
        return null;
    }

    checkReply(reply);

    reply.getNextValueAsInt(); // argCnt, is not used
    int slots = reply.getNextValueAsInt();
    if (slots == 0) {
        return null;
    }

    ArrayList<Variable> vars = new ArrayList<Variable>(slots);
    for (int i = 0; i < slots; i++) {
        Variable var = new Frame().new Variable();
        var.setCodeIndex(reply.getNextValueAsLong());
        var.setName(reply.getNextValueAsString());
        var.setSignature(reply.getNextValueAsString());
        var.setLength(reply.getNextValueAsInt());
        var.setSlot(reply.getNextValueAsInt());
        vars.add(var);
    }

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

示例8: testIsObsoleteTest001

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises Method.IsObsolete command.
 * <BR>It runs MethodDebuggee, receives checked method, 
 * which is not obsolete, and checks it with Method.IsObsolete command.
 */
public void testIsObsoleteTest001() throws UnsupportedEncodingException {
    logWriter.println("testObsoleteTest001 started");
    
    //check capability, relevant for this test
    logWriter.println("=> Check, can VM redefine classes");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canRedefineClasses;
    if (!isCapability) {
        logWriter.println("##WARNING: this VM can't redefine classes");
        return;
    }
    
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    long classID = getClassIDBySignature("L"+getDebuggeeClassName().replace('.', '/')+";");

    MethodInfo[] methodsInfo = jdwpGetMethodsInfo(classID);
    assertFalse("Invalid number of methods", methodsInfo.length == 0);

    for (int i = 0; i < methodsInfo.length; i++) {
        logWriter.println(methodsInfo[i].toString());

        // get variable table for this class
        CommandPacket packet = new CommandPacket(
                JDWPCommands.MethodCommandSet.CommandSetID,
                JDWPCommands.MethodCommandSet.IsObsoleteCommand);
        packet.setNextValueAsClassID(classID);
        packet.setNextValueAsMethodID(methodsInfo[i].getMethodID());
        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
        checkReplyPacket(reply, "Method::IsObsolete command");

        boolean isObsolete = reply.getNextValueAsBoolean();
        logWriter.println("isObsolete=" + isObsolete);
    }

    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:43,代码来源:IsObsoleteTest.java

示例9: getLineTable

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * Issues LineTable command.
 * 
 * @param classID -
 *            class ID
 * @param methodID -
 *            method ID
 * @return reply packet
 */
protected ReplyPacket getLineTable(long classID, long methodID) {
    CommandPacket lineTableCommand = new CommandPacket(
            JDWPCommands.MethodCommandSet.CommandSetID,
            JDWPCommands.MethodCommandSet.LineTableCommand);
    lineTableCommand.setNextValueAsReferenceTypeID(classID);
    lineTableCommand.setNextValueAsMethodID(methodID);
    ReplyPacket lineTableReply = debuggeeWrapper.vmMirror
            .performCommand(lineTableCommand);
    checkReplyPacket(lineTableReply, "Method::LineTable command");
    return lineTableReply;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:JDWPTestCase.java

示例10: printMethodLineTable

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
void printMethodLineTable(long classID, String className /* may be null */, String methodName) {
    long methodID = debuggeeWrapper.vmMirror.getMethodID(classID, methodName);
    if ( methodID == -1 ) {
        logWriter.println
        ("## printMethodLineTable(): Can NOT get methodID for classID = " 
                + classID + "; Method name = " + methodName);
        return;
    }
    
    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,  "printMethodLineTable(): Method.LineTable command") ) {
        return;
    }
    if ( className == null ) {
        logWriter.println("=== Line Table for method: " + methodName + " ===");
    } else {
        logWriter.println("=== Line Table for method: " + methodName + " of class: " 
                + className + " ===");
    }
    long methodStartCodeIndex = lineTableReply.getNextValueAsLong();
    logWriter.println("==> Method Start Code Index = " + methodStartCodeIndex);
    long methodEndCodeIndex = lineTableReply.getNextValueAsLong();
    logWriter.println("==> Method End Code Index = " + methodEndCodeIndex);
    
    int linesNumber = lineTableReply.getNextValueAsInt();
    logWriter.println("==> Number of lines = " + linesNumber);
    for (int i=0; i < linesNumber; i++) {
        long lineCodeIndex = lineTableReply.getNextValueAsLong();
        int lineNumber = lineTableReply.getNextValueAsInt();
        logWriter.println("====> Line Number " + lineNumber + " : Initial code index = " + lineCodeIndex);
    }
    logWriter.println("=== End of Line Table " + methodName + " ===");
}
 
开发者ID:shannah,项目名称:cn1,代码行数:39,代码来源:CombinedEventsTestCase.java

示例11: getMethodEntryLocation

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

示例12: getMethodEndLocation

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

示例13: testBytecodesTest001

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
 * This testcase exercises Method.Bytecodes command.
 * <BR>It runs MethodDebuggee. Gets methods with ReferenceType.Methods command,
 * prints it's bytecodes received with Method.Bytecodes command.
 */
public void testBytecodesTest001() throws UnsupportedEncodingException {
    logWriter.println("testBytecodesTest001 started");
    
    //check capability, relevant for this test
    logWriter.println("=> Check capability: canGetBytecodes");
    debuggeeWrapper.vmMirror.capabilities();
    boolean isCapability = debuggeeWrapper.vmMirror.targetVMCapabilities.canGetBytecodes;
    if (!isCapability) {
        logWriter.println("##WARNING: this VM doesn't possess capability: canGetBytecodes");
        return;
    }
    
    synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);

    long classID = getClassIDBySignature("L"+getDebuggeeClassName().replace('.', '/')+";");

    MethodInfo[] methodsInfo = jdwpGetMethodsInfo(classID);
    assertFalse("Invalid number of methods", methodsInfo.length == 0);

    for (int i = 0; i < methodsInfo.length; i++) {
        logWriter.println(methodsInfo[i].toString());
       
        // get variable table for this class
        CommandPacket packet = new CommandPacket(
                JDWPCommands.MethodCommandSet.CommandSetID,
                JDWPCommands.MethodCommandSet.BytecodesCommand);
        packet.setNextValueAsClassID(classID);
        packet.setNextValueAsMethodID(methodsInfo[i].getMethodID());
        ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
        checkReplyPacket(reply, "Method::Bytecodes command");

        int bytes = reply.getNextValueAsInt();
        logWriter.println("bytes = " + bytes);
        
        byte[] bytecode = new byte[bytes];
        for (int j = 0; j < bytes; j++) {
            bytecode[j] = reply.getNextValueAsByte();
        }

        logWriter.println("Bytecode=" + new String(bytecode));
    }

    synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:50,代码来源:BytecodesTest.java

示例14: makeNewInstance

import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
protected TaggedObject makeNewInstance(long typeID, long threadID,
        long constructorID, int testNumber) {
    CommandPacket packet = new CommandPacket(
            JDWPCommands.ClassTypeCommandSet.CommandSetID,
            JDWPCommands.ClassTypeCommandSet.NewInstanceCommand);
    packet.setNextValueAsClassID(typeID);
    packet.setNextValueAsThreadID(threadID);
    packet.setNextValueAsMethodID(constructorID);
    if ( testNumber == 1 ) {
        packet.setNextValueAsInt(1); // number of parameters
        packet.setNextValueAsValue(new Value(false));
    }
    if ( testNumber == 2 ) {
        packet.setNextValueAsInt(0); // number of parameters
    }
    packet.setNextValueAsInt(0);
    logWriter.println("\nSend ClassType.NewInstance");
    ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
    checkReplyPacket(reply, "ClassType::NewInstance command");

    TaggedObject newObject = reply.getNextValueAsTaggedObject();
    logWriter.println(" ClassType.NewInstance: newObject.tag="
            + newObject.tag + " newObject.objectID=" + newObject.objectID);

    TaggedObject exception = reply.getNextValueAsTaggedObject();
    logWriter.println(" ClassType.NewInstance: exception.tag="
            + exception.tag + " exception.objectID=" + exception.objectID);

    assertTrue("newObject must be != null", newObject != null);
    assertTrue("newObject.objectID must be != 0", newObject.objectID != 0);
    assertEquals("Invalid object tag,", JDWPConstants.Tag.OBJECT_TAG, newObject.tag
            , JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG)
            , JDWPConstants.Tag.getName(newObject.tag));

    assertTrue("exception must be != null", exception != null);
    assertTrue("exception.objectID must be == 0", exception.objectID == 0);
    assertEquals("Invalid exception.tag,", JDWPConstants.Tag.OBJECT_TAG, exception.tag
            , JDWPConstants.Tag.getName(JDWPConstants.Tag.OBJECT_TAG)
            , JDWPConstants.Tag.getName(exception.tag));

    assertAllDataRead(reply);
    return newObject;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:44,代码来源:InvokeMethodTest.java


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