use of com.ibm.dtfj.java.javacore.JCJavaStackFrame in project openj9 by eclipse.
the class JavaRuntimeBuilder method addJavaStackFrame.
/**
*/
public JavaStackFrame addJavaStackFrame(JavaThread javaThread, String className, String classFileName, String methodName, String methodType, String compilationLevel, int lineNumber) throws BuilderFailureException {
try {
JCJavaThread jThread = (JCJavaThread) javaThread;
JCJavaClass jclass = getJavaRuntime().findJavaClass(className);
if (jclass == null) {
jclass = new JCJavaClass(getJavaRuntime(), className);
}
JCJavaMethod method = new JCJavaMethod(methodName, jclass);
JCJavaLocation location = new JCJavaLocation(method);
location.setFilename(classFileName);
location.setCompilation(compilationLevel);
location.setLineNumber(lineNumber);
JCJavaStackFrame stackFrame = new JCJavaStackFrame(jThread, location);
if ("run".equals(methodName)) {
/*
* Perhaps the type of the thread is the type of the last run() method.
* Not strictly accurate if the class was extended without overriding run().
* Add the object only if the object ID is valid.
*/
try {
JavaObject jo = jThread.getObject();
if (jo != null) {
ImagePointer tid = jo.getID();
if (fAddressSpace.isValidAddressID(tid.getAddress())) {
JCJavaObject jobject = new JCJavaObject(tid, jclass);
jThread.setObject(jobject);
}
}
} catch (CorruptDataException e) {
// Ignore
}
}
return stackFrame;
} catch (JCInvalidArgumentsException e) {
throw new BuilderFailureException(e);
}
}
Aggregations