本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsReferenceTypeID方法的典型用法代码示例。如果您正苦于以下问题:Java CommandPacket.setNextValueAsReferenceTypeID方法的具体用法?Java CommandPacket.setNextValueAsReferenceTypeID怎么用?Java CommandPacket.setNextValueAsReferenceTypeID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket
的用法示例。
在下文中一共展示了CommandPacket.setNextValueAsReferenceTypeID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectID
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的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;
}
示例2: getMethodSignature
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns JNI signature of method.
*
* @param classID
* The reference type ID.
* @param methodID
* The method ID.
* @return JNI signature of method.
*/
public final String getMethodSignature(long classID, long methodID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.MethodsCommand);
command.setNextValueAsReferenceTypeID(classID);
ReplyPacket reply = checkReply(performCommand(command));
int methods = reply.getNextValueAsInt();
String value = null;
for (int i = 0; i < methods; i++) {
long mID = reply.getNextValueAsMethodID();
reply.getNextValueAsString(); // name of the method; is not used
String methodSign = reply.getNextValueAsString();
reply.getNextValueAsInt();
if (mID == methodID) {
value = methodSign;
value = value.replaceAll("/", ".");
int lastRoundBracketIndex = value.lastIndexOf(")");
value = value.substring(0, lastRoundBracketIndex + 1);
break;
}
}
return value;
}
示例3: getSourceFile
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
public String getSourceFile() {
// TODO(shertz) support JSR-45
Location location = getLocation();
CommandPacket sourceFileCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SourceFileCommand);
sourceFileCommand.setNextValueAsReferenceTypeID(location.classID);
ReplyPacket replyPacket = getMirror().performCommand(sourceFileCommand);
if (replyPacket.getErrorCode() != 0) {
return null;
} else {
return replyPacket.getNextValueAsString();
}
}
示例4: getClassSignature
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Gets class signature for specified class ID.
*
* @param classID
* class ID
* @return received class signature
*/
public String getClassSignature(long classID) {
// Create new command packet
CommandPacket commandPacket = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
commandPacket.setNextValueAsReferenceTypeID(classID);
ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
return replyPacket.getNextValueAsString();
}
示例5: getThreadGroupName
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns name of thread group for specified <code>groupID</code>
*
* @param groupID
* thread group ID
*
* @return name of thread group
*/
public String getThreadGroupName(long groupID) {
// Create new command packet
CommandPacket commandPacket = new CommandPacket(
JDWPCommands.ThreadGroupReferenceCommandSet.CommandSetID,
JDWPCommands.ThreadGroupReferenceCommandSet.NameCommand);
commandPacket.setNextValueAsReferenceTypeID(groupID);
ReplyPacket replyPacket = checkReply(performCommand(commandPacket));
return replyPacket.getNextValueAsString();
}
示例6: getFieldsInClass
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Gets class fields by class referenceTypeID.
*
* @param referenceTypeID
* class referenceTypeID.
* @return ReplyPacket for corresponding command
*/
public ReplyPacket getFieldsInClass(long referenceTypeID) {
CommandPacket commandPacket = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.FieldsCommand);
commandPacket.setNextValueAsReferenceTypeID(referenceTypeID);
return checkReply(performCommand(commandPacket));
}
示例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;
}
示例8: getClassObjectId
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns the class object corresponding to this type
*
* @param refType
* The reference type ID.
* @return The class object.
*/
public final long getClassObjectId(long refType) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.ClassObjectCommand);
command.setNextValueAsReferenceTypeID(refType);
ReplyPacket reply = checkReply(performCommand(command));
return reply.getNextValueAsObjectID();
}
示例9: testClassLoader001
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ReferenceType.ClassLoader command.
* <BR>The test starts HelloWorld debuggee, requests referenceTypeId
* for it by VirtualMachine.ClassesBySignature command, then
* performs ReferenceType.ClassLoader command and checks that command
* returns reply with some classLoaderID without any ERROR
*/
public void testClassLoader001() {
String thisTestName = "testClassLoader001";
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
long refTypeID = getClassIDBySignature(debuggeeSignature);
logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
logWriter.println("=> CHECK1: send " + thisCommandName + " and check reply for ERROR...");
CommandPacket classLoaderCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.ClassLoaderCommand);
classLoaderCommand.setNextValueAsReferenceTypeID(refTypeID);
ReplyPacket classLoaderReply = debuggeeWrapper.vmMirror.performCommand(classLoaderCommand);
classLoaderCommand = null;
checkReplyPacket(classLoaderReply, thisCommandName);
long returnedClassLoaderID = classLoaderReply.getNextValueAsObjectID();
logWriter.println("=> CHECK1: PASSED: Returned classLoaderID = " + returnedClassLoaderID);
assertAllDataRead(classLoaderReply);
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
}
示例10: getReferenceTypeSignature
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns the JNI signature of a reference type. JNI signature formats are
* described in the Java Native Interface Specification
*
* @param refTypeID
* The reference type ID.
* @return The JNI signature for the reference type.
*/
public final String getReferenceTypeSignature(long refTypeID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
command.setNextValueAsReferenceTypeID(refTypeID);
ReplyPacket reply = checkReply(performCommand(command));
return reply.getNextValueAsString();
}
示例11: testSourceFile001
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ReferenceType.SourceFile command.
* >BR>The test starts SourceFileDebuggee class, requests referenceTypeId
* for this class by VirtualMachine.ClassesBySignature command, then
* performs ReferenceType.SourceFile command and checks that returned
* source file name is equal to expected name.
*/
public void testSourceFile001() {
String thisTestName = "testSourceFile001";
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
finalSyncMessage = JPDADebuggeeSynchronizer.SGNL_CONTINUE;
long refTypeID = getClassIDBySignature(debuggeeSignature);
logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
logWriter.println("=> CHECK: send " + thisCommandName + " and check reply...");
CommandPacket sourceFileCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SourceFileCommand);
sourceFileCommand.setNextValueAsReferenceTypeID(refTypeID);
ReplyPacket sourceFileReply = debuggeeWrapper.vmMirror.performCommand(sourceFileCommand);
sourceFileCommand = null;
checkReplyPacket(sourceFileReply, thisCommandName);
String returnedSourceFile = sourceFileReply.getNextValueAsString();
String expectedSourceFile = "SourceFileDebuggee.java";
assertString(thisCommandName + " returned invalid source file,",
expectedSourceFile, returnedSourceFile);
logWriter.println("=> CHECK: PASSED: expected source file is returned = " +
returnedSourceFile);
finalSyncMessage = null;
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
assertAllDataRead(sourceFileReply);
}
示例12: testInstanceCounts_IllegalArgument
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ReferenceType.InstanceCounts command. <BR>
* Compose a InstanceCounts command with negative reference types count
* The vm should throw a ILLEGAL_ARGUMENT exception.
*/
public void testInstanceCounts_IllegalArgument() {
String thisTestName = "testInstanceCounts_IllegalArgument";
if (!isCapability()) {
logWriter.println("##WARNING: this VM dosn't possess capability: canGetInstanceInfo");
return;
}
int refTypesCount = -1;
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
// Compose InstanceCounts commnad
CommandPacket InstanceCountsCommand = new CommandPacket(
JDWPCommands.VirtualMachineCommandSet.CommandSetID,
JDWPCommands.VirtualMachineCommandSet.InstanceCountsCommand);
InstanceCountsCommand.setNextValueAsInt(refTypesCount);
InstanceCountsCommand.setNextValueAsReferenceTypeID(0);
// Perform InstanceCounts command and attain reply package
ReplyPacket checkedReply = debuggeeWrapper.vmMirror
.performCommand(InstanceCountsCommand);
InstanceCountsCommand = null;
short errorCode = checkedReply.getErrorCode();
if (errorCode != JDWPConstants.Error.NONE) {
if (errorCode == JDWPConstants.Error.NOT_IMPLEMENTED) {
logWriter.println("=> CHECK PASSED: Expected error (NOT_IMPLEMENTED) is returned");
return;
}
else if(errorCode == JDWPConstants.Error.ILLEGAL_ARGUMENT) {
logWriter.println("=> CHECK PASSED: Expected error (ILLEGAL_ARGUMENT) is returned");
return;
}
}
printErrorAndFail(thisCommandName + " should throw ILLEGAL_ARGUMENT exception when refTypesCount is negative.");
}
示例13: 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;
}
示例14: getClassSignature
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns jni signature for selected classID
*
* @param classID
* @return jni signature for selected classID
*/
protected String getClassSignature(long classID) {
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SignatureCommand);
command.setNextValueAsReferenceTypeID(classID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(command);
checkReplyPacket(reply, "ReferenceType::Signature command");
String signature = reply.getNextValueAsString();
return signature;
}
示例15: testSignatureWithGeneric001
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* This testcase exercises ReferenceType.SignatureWithGeneric command.
* <BR>The test starts SignatureWithGenericDebuggee class, requests referenceTypeId
* for this class by VirtualMachine.ClassesBySignature command, then
* performs ReferenceType.SignatureWithGeneric command and checks that returned
* both signature and generic signature are equal to expected signatures.
*/
public void testSignatureWithGeneric001() {
String thisTestName = "testSignatureWithGeneric001";
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": START...");
synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
long refTypeID = getClassIDBySignature(debuggeeSignature);
logWriter.println("=> Debuggee class = " + getDebuggeeClassName());
logWriter.println("=> referenceTypeID for Debuggee class = " + refTypeID);
logWriter.println("=> CHECK1: send " + thisCommandName + " and check reply...");
CommandPacket signatureWithGenericCommand = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.SignatureWithGenericCommand);
signatureWithGenericCommand.setNextValueAsReferenceTypeID(refTypeID);
ReplyPacket signatureWithGenericReply = debuggeeWrapper.vmMirror.performCommand(signatureWithGenericCommand);
signatureWithGenericCommand = null;
checkReplyPacket(signatureWithGenericReply, thisCommandName);
String returnedSignature = signatureWithGenericReply.getNextValueAsString();
String returnedGenericSignature = signatureWithGenericReply.getNextValueAsString();
assertString(thisCommandName + " returned invalid signature,",
debuggeeSignature, returnedSignature);
assertString(thisCommandName + " returned invalid generic signature,",
debuggeeGenericSignature, returnedGenericSignature);
logWriter.println("=> CHECK1: PASSED: expected signatures are returned:");
logWriter.println("=> Signature = " + returnedSignature);
logWriter.println("=> Generic signature = \"" + returnedGenericSignature + "\"");
synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_CONTINUE);
logWriter.println("==> " + thisTestName + " for " + thisCommandName + ": FINISH");
assertAllDataRead(signatureWithGenericReply);
}