long declaringClass = variablesIn.readLong();
long cPos = variablesIn.getStreamPosition(); // Save where we are before reading in the declaring class
JClass clazz = (JClass) nreadReference(declaringClass);
variablesIn.seek(cPos); // Return to our read position
JStackFrame jsf = new JStackFrame();
JLocation loc = new JLocation();
JMethod jm = model.getMethod(methodID);
loc.method = jm;
jsf.setLocation(loc);
// SRDM
if( clazz != null) {
loc.filename = clazz.sourceFile;
}
t.addStackFrame(jsf);
byte depth = variablesIn.readByte();
if (depth == CJVMTI_LOCAL_NATIVECALL) {
log.log(Level.FINEST, "Native call");
loc.linenumber = -1;
loc.setAddress(-1);
if (loc.filename == null){
loc.filename = "nativeCall"; // ..
}
return;
} else if (depth == CJVMTI_JVMTI_ERROR) {
// If there are no local variables, we can still have a frame for the method.
log.log(Level.FINEST, "Data unavailable");
loc.linenumber = -1;
loc.setAddress(-1);
loc.setCompilationLevel(1);
return;
} else if (depth != CJVMTI_LOCAL_VARIABLE) {
log.finer("Error reading frame type. Got "+depth);
throw new IOException("Error reading frame "+pos+" in thread. "+t+
". Error reading frame type. Got "+depth);
}
log.log(Level.FINEST, "Local var");
loc.setCompilationLevel(0);
if (clazz != null) {
loc.filename = clazz.sourceFile;
}
long location = variablesIn.readLong();
log.log(Level.FINEST, "Location is " + location);
loc.setAddress(location);
loc.linenumber = loc.method.getLineNumber(location);
log.log(Level.FINEST, " Line number " + loc.linenumber + " to "
+ location);
int varCount = variablesIn.readInt();
int slots[] = new int[varCount];
long lvarReference[] = new long[varCount];
log.log(Level.FINEST, "vars: " + varCount);
// Read in all the variable references
for (int i2 = 0; i2 < varCount; i2++) {
slots[i2] = variablesIn.readInt();
lvarReference[i2] = variablesIn.readLong();
}
// Follow all the variable references
for (int i2 = 0; i2 < varCount; i2++){
log.finest("Slot "+slots[i2]+" at "+Long.toHexString(lvarReference[i2]));
JLocalVariable jlv = new JLocalVariable();
jlv.slot = slots[i2];
long cpos = variablesIn.getStreamPosition();
jlv.value = nreadReference(lvarReference[i2]);
variablesIn.seek(cpos);
jsf.addVariable(jlv);
}
t.addStackFrame(jsf);
}