本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands类的典型用法代码示例。如果您正苦于以下问题:Java JDWPCommands类的具体用法?Java JDWPCommands怎么用?Java JDWPCommands使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JDWPCommands类属于org.apache.harmony.jpda.tests.framework.jdwp包,在下文中一共展示了JDWPCommands类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jdwpGetFrames
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例2: jdwpGetVariableTable
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例3: jdwpGetAllThreads
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的package包/类
protected long[] jdwpGetAllThreads() {
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.AllThreadsCommand);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "VirtualMachine::AllThreads command");
int frames = reply.getNextValueAsInt();
long[] frameIDs = new long[frames];
for (int i = 0; i < frames; i++) {
frameIDs[i] = reply.getNextValueAsLong();
}
return frameIDs;
}
示例4: jdwpGetFields
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例5: jdwpGetFieldIDs
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例6: jdwpGetMethodsInfo
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的package包/类
protected MethodInfo[] jdwpGetMethodsInfo(long classID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
packet.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
assertTrue(reply.getErrorCode() == JDWPConstants.Error.NONE);
int declared = reply.getNextValueAsInt();
MethodInfo[] methodsInfo = new MethodInfo[declared];
for (int i = 0; i < declared; i++) {
methodsInfo[i] = new MethodInfo(
reply.getNextValueAsMethodID(),
reply.getNextValueAsString(),
reply.getNextValueAsString(),
reply.getNextValueAsInt()
);
}
return methodsInfo;
}
示例7: getMethodID
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例8: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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: getClassIDBySignature
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的package包/类
/**
* Returns classID for the selected jni signature
*
* @param signature
* @return classID for the selected jni signature
*/
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);
checkReplyPacket(reply, "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;
}
示例10: getReferenceTypeID
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例11: clearEvent
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的package包/类
/**
* Removes breakpoint of the given event kind corresponding to the given
* request id.
*
* @param eventKind
* request event kind
* @param requestID
* request id
* @param verbose
* print or don't extra log info
*/
protected void clearEvent(byte eventKind, int requestID, boolean verbose) {
CommandPacket packet = new CommandPacket(
JDWPCommands.EventRequestCommandSet.CommandSetID,
JDWPCommands.EventRequestCommandSet.ClearCommand);
packet.setNextValueAsByte(eventKind);
packet.setNextValueAsInt(requestID);
if (verbose) {
logWriter.println("Clearing event: "
+ JDWPConstants.EventKind.getName(eventKind) + ", id: "
+ requestID);
}
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "EventRequest::Clear command");
assertAllDataRead(reply);
}
示例12: jdwpGetFrames
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例13: getClassIDBySignature
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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;
}
示例14: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的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";
}
示例15: testDebugger002
import org.apache.harmony.jpda.tests.framework.jdwp.JDWPCommands; //导入依赖的package包/类
public void testDebugger002() {
logWriter.println("***> OnthrowLaunchDebugger001 started");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
logWriter.println("**> Send VirtualMachine::Version command");
CommandPacket packet = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.VersionCommand);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
logWriter.println("**> Check reply on Version command");
if (!checkReplyPacketWithoutFail(reply, "VirtualMachine::Version command")) {
testSynchronizer.sendMessage("FAIL");
fail("error durign performing VirtualMachine::Version command");
}
testSynchronizer.sendMessage("OK");
logWriter.println("**> Send SIGNAL_CONTINUE");
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
testSynchronizer.sendMessage("END");
logWriter.println("***> OnthrowLaunchDebugger001 finished");
}