int read = 1;
int oread = 1;
_allJavaObjects.clear();
try {
while (true) {
VMReply r = _connector.sendReplyCommand(MPGetHeapData);
int object_address = r.getInt();
while (object_address != -1 && object_address != -2) {
int size = r.getInt();
int mp_class_id = r.getInt();
int object_type = mp_class_id >> OBJ_TYPE_OFFSET;
int stack_number = -1;
if (object_type == STACK_OBJECT) {
stack_number = r.getInt();
read++;
}
int links = r.getInt();
int[] refs = new int[links];
HashMap offsets = new HashMap(links);
if (object_type == STACK_OBJECT) {
for (int i = 0; i < links; i++) {
refs[i] = r.getInt();
int offset = r.getInt();
Integer cur_offset = (Integer)offsets.get(new Integer(refs[i]));
if (cur_offset == null || cur_offset.intValue() < offset) {
offsets.put(new Integer(refs[i]), new Integer(offset));
}
}
read += links;
} else {
for (int i = 0; i < links; i++) {
refs[i] = r.getInt();
}
}
mp_class_id = mp_class_id & 0x7FFFFF;
JavaClass class_item = (JavaClass)_allClasses.get(new Integer(mp_class_id));
int class_id = mp_class_id;
if (class_item != null) {
class_id = class_item.id;
}
if (object_type == JAVA_OBJECT) {
_allJavaObjects.put(new Integer(object_address),
new JavaObject(object_address, class_id, size, refs, JAVA_OBJECT));
} else if (object_type == STATICS_OBJECT) {
_allJavaObjects.put(new Integer(object_address),
new JavaObject(object_address, class_id, size, refs, STATICS_OBJECT));
} else if (object_type == STACK_OBJECT) {
_allJavaObjects.put(new Integer(object_address),
new JavaObject(object_address, -1, size, refs, STACK_OBJECT, offsets, stack_number));
} else if (object_type == VM_OBJECT) {
_allJavaObjects.put(new Integer(object_address),
new JavaObject(object_address, -1, size, refs, VM_OBJECT));
} else {
System.out.println("Wrong response from VM! Unknown object type. Skipped!");
}
object_address = r.getInt();
read += 4;
read += links;
oread++;
}
if (object_address == -1) break;