本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsClassID方法的典型用法代码示例。如果您正苦于以下问题:Java CommandPacket.setNextValueAsClassID方法的具体用法?Java CommandPacket.setNextValueAsClassID怎么用?Java CommandPacket.setNextValueAsClassID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket
的用法示例。
在下文中一共展示了CommandPacket.setNextValueAsClassID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setStaticFieldsValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Sets the value of one or more static fields
*
* @param classID
* The class type ID.
* @param fieldIDs
* An array of fields IDs
* @param values
* An array of Value objects representing each value to set
*/
public final void setStaticFieldsValues(long classID, long[] fieldIDs,
Value[] values) {
if (fieldIDs.length != values.length) {
throw new TestErrorException(
"Number of fields doesn't correspond to number of their values");
}
CommandPacket command = new CommandPacket(
JDWPCommands.ClassTypeCommandSet.CommandSetID,
JDWPCommands.ClassTypeCommandSet.SetValuesCommand);
command.setNextValueAsClassID(classID);
command.setNextValueAsInt(fieldIDs.length);
for (int i = 0; i < fieldIDs.length; i++) {
command.setNextValueAsFieldID(fieldIDs[i]);
command.setNextValueAsUntaggedValue(values[i]);
}
checkReply(performCommand(command));
}
示例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));
}
示例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));
}
示例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;
}
示例5: jdwpGetMethodsInfo
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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;
}
示例6: getMethodID
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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;
}
示例7: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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";
}
示例8: getMethodName
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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";
}
示例9: 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;
}
示例10: 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;
}
示例11: getSuperclassId
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns the immediate superclass of a class
*
* @param classID
* The class ID whose superclass ID is to get
* @return The superclass ID (null if the class ID for java.lang.Object is
* specified).
*/
public final long getSuperclassId(long classID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ClassTypeCommandSet.CommandSetID,
JDWPCommands.ClassTypeCommandSet.SuperclassCommand);
command.setNextValueAsClassID(classID);
ReplyPacket reply = checkReply(performCommand(command));
return reply.getNextValueAsClassID();
}
示例12: jdwpGetSuperClassReply
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
private ReplyPacket jdwpGetSuperClassReply(long classID, int errorExpected) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ClassTypeCommandSet.CommandSetID,
JDWPCommands.ClassTypeCommandSet.SuperclassCommand);
packet.setNextValueAsClassID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ClassType.Superclass command", errorExpected);
return reply;
}
示例13: 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);
}
示例14: 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 + " ===");
}
示例15: 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;
}