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


Java Variable类代码示例

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


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

示例1: perform

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

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
/**
 * Returns values of local variables in a given frame
 * 
 * @param frame
 *            Frame whose variables to get
 * @return An array of Value objects
 */
public final Value[] getFrameValues(Frame frame) {
    CommandPacket command = new CommandPacket(
            JDWPCommands.StackFrameCommandSet.CommandSetID,
            JDWPCommands.StackFrameCommandSet.GetValuesCommand);
    command.setNextValueAsThreadID(frame.getThreadID());
    command.setNextValueAsFrameID(frame.getID());
    int slots = frame.getVars().size();
    command.setNextValueAsInt(slots);
    Iterator it = frame.getVars().iterator();
    while (it.hasNext()) {
        Frame.Variable var = (Frame.Variable) it.next();
        command.setNextValueAsInt(var.getSlot());
        command.setNextValueAsByte(var.getTag());
    }

    ReplyPacket reply = checkReply(performCommand(command));
    reply.getNextValueAsInt(); // number of values , is not used
    Value[] values = new Value[slots];
    for (int i = 0; i < slots; i++) {
        values[i] = reply.getNextValueAsValue();
    }

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

示例3: getLocalVars

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
/**
 * Returns all variables which are visible within the given frame.
 * 
 * @param frame
 *            The frame whose visible local variables to retrieve.
 * @return A list of Variable objects representing each visible local
 *         variable within the given frame.
 */
public final List getLocalVars(Frame frame) {
    List vars = getVariableTable(frame.getLocation().classID, frame
            .getLocation().methodID);
    if (vars == null) {
        return null;
    }

    // All variables that are not visible from within current frame must be
    // removed from the list
    long frameCodeIndex = frame.getLocation().index;
    for (int i = 0; i < vars.size(); i++) {
        Variable var = (Variable) vars.toArray()[i];
        long varCodeIndex = var.getCodeIndex();
        if (varCodeIndex > frameCodeIndex
                || (frameCodeIndex >= varCodeIndex + var.getLength())) {
            vars.remove(i);
            --i;
            continue;
        }
    }

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

示例4: setLocalVars

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
/**
 * Sets the value of one or more local variables
 * 
 * @param frame
 *            The frame ID.
 * @param vars
 *            An array of Variable objects whose values to set
 * @param values
 *            An array of Value objects to set
 */
public final void setLocalVars(Frame frame, Variable[] vars, Value[] values) {
    if (vars.length != values.length) {
        throw new TestErrorException(
                "Number of variables doesn't correspond to number of their values");
    }

    CommandPacket command = new CommandPacket(
            JDWPCommands.StackFrameCommandSet.CommandSetID,
            JDWPCommands.StackFrameCommandSet.SetValuesCommand);
    command.setNextValueAsThreadID(frame.getThreadID());
    command.setNextValueAsFrameID(frame.getID());
    command.setNextValueAsInt(vars.length);
    for (int i = 0; i < vars.length; i++) {
        command.setNextValueAsInt(vars[i].getSlot());
        command.setNextValueAsValue(values[i]);
    }

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

示例5: checkLocal

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
public void checkLocal(String localName) {
  Optional<Variable> localVar = JUnit3Wrapper
      .getVariableAt(mirror, getLocation(), localName);
  if (!localVar.isPresent()) {
    failNoLocal(localName);
  }
}
 
开发者ID:inferjay,项目名称:r8,代码行数:8,代码来源:DebugTestBase.java

示例6: getVariableTable

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

示例7: inScope

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
private static boolean inScope(long index, Variable var) {
  long varStart = var.getCodeIndex();
  long varEnd = varStart + var.getLength();
  return index >= varStart && index < varEnd;
}
 
开发者ID:inferjay,项目名称:r8,代码行数:6,代码来源:DebugTestBase.java

示例8: getVariableAt

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
private static Optional<Variable> getVariableAt(VmMirror mirror, Location location,
    String localName) {
  return getVariablesAt(mirror, location).stream()
      .filter(v -> localName.equals(v.getName()))
      .findFirst();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:7,代码来源:DebugTestBase.java

示例9: getVariablesAt

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
private static List<Variable> getVariablesAt(VmMirror mirror, Location location) {
  // Get variable table and keep only variables visible at this location.
  return getVariables(mirror, location.classID, location.methodID).stream()
      .filter(v -> inScope(location.index, v))
      .collect(Collectors.toList());
}
 
开发者ID:inferjay,项目名称:r8,代码行数:7,代码来源:DebugTestBase.java

示例10: getVariables

import org.apache.harmony.jpda.tests.framework.jdwp.Frame.Variable; //导入依赖的package包/类
private static List<Variable> getVariables(VmMirror mirror, long classID, long methodID) {
  List<Variable> list = mirror.getVariableTable(classID, methodID);
  return list != null ? list : Collections.emptyList();
}
 
开发者ID:inferjay,项目名称:r8,代码行数:5,代码来源:DebugTestBase.java


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