本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket.getNextValueAsInt方法的典型用法代码示例。如果您正苦于以下问题:Java ReplyPacket.getNextValueAsInt方法的具体用法?Java ReplyPacket.getNextValueAsInt怎么用?Java ReplyPacket.getNextValueAsInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket
的用法示例。
在下文中一共展示了ReplyPacket.getNextValueAsInt方法的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);
}
}
示例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();
}
示例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;
}
示例4: 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;
}
示例5: getMethodID
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Helper for getting method ID of corresponding class and method name.
*
* @param classID -
* class ID
* @param methodName -
* method name
* @return method ID
*/
protected long getMethodID(long classID, String methodName) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
command.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(command);
checkReplyPacket(reply, "ReferenceType::Methods command");
int methods = reply.getNextValueAsInt();
for (int i = 0; i < methods; i++) {
long methodID = reply.getNextValueAsMethodID();
String name = reply.getNextValueAsString(); // method name
reply.getNextValueAsString(); // method signature
reply.getNextValueAsInt(); // method modifiers
if (name.equals(methodName)) {
return methodID;
}
}
return -1;
}
示例6: 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;
}
示例7: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
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);
if (!checkReplyPacketWithoutFail(reply, "ReferenceType::Methods command")) {
throw new TestErrorException("Error during performing ReferenceType::Method 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";
}
示例8: 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";
}
示例9: 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;
}
示例10: 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;
}
示例11: jdwpGetFields
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns for specified class array with information about fields of this class.
* <BR>Each element of array contains:
* <BR>Field ID, Field name, Field signature, Field modifier bit flags;
* @param refType - ReferenceTypeID, defining class.
* @return array with information about fields.
*/
protected FieldInfo[] jdwpGetFields(long refType) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
packet.setNextValueAsReferenceTypeID(refType);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
int declared = reply.getNextValueAsInt();
FieldInfo[] fields = new FieldInfo[declared];
for (int i = 0; i < declared; i++) {
fields[i] =
new FieldInfo(reply.getNextValueAsFieldID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt());
}
return fields;
}
示例12: jdwpGetFieldIDs
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
private FieldInfo[] jdwpGetFieldIDs(long classID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
packet.setNextValueAsReferenceTypeID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ReferenceType::Fields command");
int declared = reply.getNextValueAsInt();
FieldInfo[] fields = new FieldInfo[declared];
for (int i = 0; i < declared; i++) {
fields[i] = new FieldInfo(
reply.getNextValueAsFieldID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt()
);
}
return fields;
}
示例13: getLineNumber
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns a source line number according to a corresponding line code index
* in a method's line table.
*
* @param classID
* The class object ID.
* @param methodID
* The method ID.
* @param codeIndex
* The line code index.
* @return An integer line number.
*/
public final int getLineNumber(long classID, long methodID, long codeIndex) {
int lineNumber = -1;
ReplyPacket reply = getLineTable(classID, methodID);
if (reply.getErrorCode() != JDWPConstants.Error.NONE) {
return lineNumber;
}
reply.getNextValueAsLong(); // start line index, is not used
reply.getNextValueAsLong(); // end line index, is not used
int lines = reply.getNextValueAsInt();
for (int i = 0; i < lines; i++) {
long lineCodeIndex = reply.getNextValueAsLong();
lineNumber = reply.getNextValueAsInt();
if (lineCodeIndex == codeIndex) {
break;
}
if (lineCodeIndex > codeIndex) {
--lineNumber;
break;
}
}
return lineNumber;
}
示例14: getLineCodeIndex
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
/**
* Returns a line code index according to a corresponding line number in a
* method's line table.
*
* @param classID
* The class object ID.
* @param methodID
* The method ID.
* @param lineNumber
* A source line number.
* @return An integer representing the line code index.
*/
public final long getLineCodeIndex(long classID, long methodID,
int lineNumber) {
ReplyPacket reply = getLineTable(classID, methodID);
if (reply.getErrorCode() != JDWPConstants.Error.NONE) {
return -1L;
}
reply.getNextValueAsLong(); // start line index, is not used
reply.getNextValueAsLong(); // end line index, is not used
int lines = reply.getNextValueAsInt();
for (int i = 0; i < lines; i++) {
long lineCodeIndex = reply.getNextValueAsLong();
if (lineNumber == reply.getNextValueAsInt()) {
return lineCodeIndex;
}
}
return -1L;
}
示例15: getMethodFirstCodeIndex
import org.apache.harmony.jpda.tests.framework.jdwp.ReplyPacket; //导入方法依赖的package包/类
private long getMethodFirstCodeIndex(long classId, long breakpointMethodId) {
ReplyPacket replyPacket = getMirror().getLineTable(classId, breakpointMethodId);
checkReplyPacket(replyPacket, "Failed to get method line table");
replyPacket.getNextValueAsLong(); // start
replyPacket.getNextValueAsLong(); // end
int linesCount = replyPacket.getNextValueAsInt();
if (linesCount == 0) {
return -1;
} else {
// Read only the 1st line because code indices are in ascending order
return replyPacket.getNextValueAsLong();
}
}