本文整理汇总了Java中org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket.setNextValueAsFieldID方法的典型用法代码示例。如果您正苦于以下问题:Java CommandPacket.setNextValueAsFieldID方法的具体用法?Java CommandPacket.setNextValueAsFieldID怎么用?Java CommandPacket.setNextValueAsFieldID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket
的用法示例。
在下文中一共展示了CommandPacket.setNextValueAsFieldID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectReferenceValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns the value of one or more instance fields.
*
* @param objectID
* The object ID
* @param fieldIDs
* IDs of fields to get
* @return An array of Value objects representing each field's value
*/
public final Value[] getObjectReferenceValues(long objectID, long[] fieldIDs) {
int fieldsCount = fieldIDs.length;
if (fieldsCount == 0) {
return null;
}
CommandPacket command = new CommandPacket(
JDWPCommands.ObjectReferenceCommandSet.CommandSetID,
JDWPCommands.ObjectReferenceCommandSet.GetValuesCommand);
command.setNextValueAsReferenceTypeID(objectID);
command.setNextValueAsInt(fieldsCount);
for (int i = 0; i < fieldsCount; i++) {
command.setNextValueAsFieldID(fieldIDs[i]);
}
ReplyPacket reply = checkReply(performCommand(command));
reply.getNextValueAsInt(); // fields returned, is not used
Value[] values = new Value[fieldsCount];
for (int i = 0; i < fieldsCount; i++) {
values[i] = reply.getNextValueAsValue();
}
return values;
}
示例2: getReferenceTypeValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Returns the value of one or more static fields of the reference type
*
* @param refTypeID
* The reference type ID.
* @param fieldIDs
* IDs of fields to get
* @return An array of Value objects representing each field's value
*/
public final Value[] getReferenceTypeValues(long refTypeID, long[] fieldIDs) {
int fieldsCount = fieldIDs.length;
if (fieldsCount == 0) {
return null;
}
CommandPacket command = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
command.setNextValueAsReferenceTypeID(refTypeID);
command.setNextValueAsInt(fieldsCount);
for (int i = 0; i < fieldsCount; i++) {
command.setNextValueAsFieldID(fieldIDs[i]);
}
ReplyPacket reply = checkReply(performCommand(command));
reply.getNextValueAsInt(); // fields returned, is not used
Value[] values = new Value[fieldsCount];
for (int i = 0; i < fieldsCount; i++) {
values[i] = reply.getNextValueAsValue();
}
return values;
}
示例3: setInstanceFieldsValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Sets the value of one or more instance fields
*
* @param objectID
* The object ID.
* @param fieldIDs
* An array of fields IDs
* @param values
* An array of Value objects representing each value to set
*/
public final void setInstanceFieldsValues(long objectID, 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.ObjectReferenceCommandSet.CommandSetID,
JDWPCommands.ObjectReferenceCommandSet.SetValuesCommand);
command.setNextValueAsObjectID(objectID);
command.setNextValueAsInt(fieldIDs.length);
for (int i = 0; i < fieldIDs.length; i++) {
command.setNextValueAsFieldID(fieldIDs[i]);
command.setNextValueAsUntaggedValue(values[i]);
}
checkReply(performCommand(command));
}
示例4: 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));
}
示例5: checkArrayValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
private void checkArrayValues(ArrayRegion valuesRegion, long classID,
long fieldID) {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
packet.setNextValueAsReferenceTypeID(classID);
packet.setNextValueAsInt(1);
packet.setNextValueAsFieldID(fieldID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ReferenceType::GetValues command");
assertEquals("GetValuesCommand returned invalid number of values,", 1, reply.getNextValueAsInt());
Value value = reply.getNextValueAsValue();
//System.err.println("value="+value);
long arrayID = value.getLongValue();
int length = valuesRegion.getLength();
checkArrayRegion(valuesRegion, arrayID, 0, length);
}
示例6: setStaticIntField
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
/**
* Helper for setting static int field in class with new value.
*
* @param classSignature -
* String defining signature of class
* @param fieldName -
* String defining field name in specified class
* @param newValue -
* int value to set for specified field
* @return true, if setting is successfully, or false otherwise
*/
protected boolean setStaticIntField(String classSignature,
String fieldName, int newValue) {
long classID = debuggeeWrapper.vmMirror.getClassID(classSignature);
if (classID == -1) {
logWriter
.println("## setStaticIntField(): Can NOT get classID for class signature = '"
+ classSignature + "'");
return false;
}
long fieldID = debuggeeWrapper.vmMirror.getFieldID(classID, fieldName);
if (fieldID == -1) {
logWriter
.println("## setStaticIntField(): Can NOT get fieldID for field = '"
+ fieldName + "'");
return false;
}
CommandPacket packet = new CommandPacket(
JDWPCommands.ClassTypeCommandSet.CommandSetID,
JDWPCommands.ClassTypeCommandSet.SetValuesCommand);
packet.setNextValueAsReferenceTypeID(classID);
packet.setNextValueAsInt(1);
packet.setNextValueAsFieldID(fieldID);
packet.setNextValueAsInt(newValue);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
int errorCode = reply.getErrorCode();
if (errorCode != JDWPConstants.Error.NONE) {
logWriter
.println("## setStaticIntField(): Can NOT set value for field = '"
+ fieldName
+ "' in class = '"
+ classSignature
+ "'; ClassType.SetValues command reurns error = "
+ errorCode);
return false;
}
return true;
}
示例7: checkArrayValues
import org.apache.harmony.jpda.tests.framework.jdwp.CommandPacket; //导入方法依赖的package包/类
private void checkArrayValues(long classID, long fieldID, int error, int length,
int checksNumber, byte expectedArrayTag, byte expectedElementTag, boolean checkValues)
throws UnsupportedEncodingException {
CommandPacket packet = new CommandPacket(
JDWPCommands.ReferenceTypeCommandSet.CommandSetID,
JDWPCommands.ReferenceTypeCommandSet.GetValuesCommand);
// set referenceTypeID
packet.setNextValueAsReferenceTypeID(classID);
// repeat 1 time
packet.setNextValueAsInt(1);
// set fieldID
packet.setNextValueAsFieldID(fieldID);
ReplyPacket reply = debuggeeWrapper.vmMirror.performCommand(packet);
checkReplyPacket(reply, "ReferenceType::GetValues command");
assertEquals("ReferenceType::GetValues command returned invalid int value,", reply.getNextValueAsInt(), 1);
Value value = reply.getNextValueAsValue();
long arrayID = value.getLongValue();
logWriter.println("==> testGetValues001: checked arrayID = " + arrayID);
logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
+ "; Expected error = " + error + "(" + JDWPConstants.Error.getName(error) + ")"
+ "; firstIndex = 0; length = " + length);
checkArrayRegion
(arrayID, error, 0, length, expectedArrayTag, expectedElementTag, checkValues);
logWriter.println("==> PASSED!");
if ( checksNumber > 1 ) {
logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
+ "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
+ "; firstIndex = 1; length = " + (length-1));
checkArrayRegion
(arrayID, error, 1, length-1, expectedArrayTag, expectedElementTag, checkValues);
logWriter.println("==> PASSED!");
logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
+ "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
+ "; firstIndex = 0; length = " + (length-1));
checkArrayRegion
(arrayID, error, 0, length-1, expectedArrayTag, expectedElementTag, checkValues);
logWriter.println("==> PASSED!");
logWriter.println("==> testGetValues001: checkArrayRegion: arrayID = " + arrayID
+ "; Expected error = " + error+ "(" + JDWPConstants.Error.getName(error) + ")"
+ "; firstIndex = " + (length-1) + " length = 1");
checkArrayRegion
(arrayID, error, length-1, 1, expectedArrayTag, expectedElementTag, checkValues);
logWriter.println("==> PASSED!");
}
}