Search in sources :

Example 1 with JCJavaStackFrame

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);
    }
}
Also used : JCJavaObject(com.ibm.dtfj.java.javacore.JCJavaObject) ImagePointer(com.ibm.dtfj.image.ImagePointer) JCJavaMethod(com.ibm.dtfj.java.javacore.JCJavaMethod) JavaObject(com.ibm.dtfj.java.JavaObject) JCJavaObject(com.ibm.dtfj.java.javacore.JCJavaObject) BuilderFailureException(com.ibm.dtfj.javacore.builder.BuilderFailureException) JCJavaStackFrame(com.ibm.dtfj.java.javacore.JCJavaStackFrame) JCJavaLocation(com.ibm.dtfj.java.javacore.JCJavaLocation) JCInvalidArgumentsException(com.ibm.dtfj.java.javacore.JCInvalidArgumentsException) JCJavaClass(com.ibm.dtfj.java.javacore.JCJavaClass) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) JCJavaThread(com.ibm.dtfj.java.javacore.JCJavaThread)

Aggregations

CorruptDataException (com.ibm.dtfj.image.CorruptDataException)1 ImagePointer (com.ibm.dtfj.image.ImagePointer)1 JavaObject (com.ibm.dtfj.java.JavaObject)1 JCInvalidArgumentsException (com.ibm.dtfj.java.javacore.JCInvalidArgumentsException)1 JCJavaClass (com.ibm.dtfj.java.javacore.JCJavaClass)1 JCJavaLocation (com.ibm.dtfj.java.javacore.JCJavaLocation)1 JCJavaMethod (com.ibm.dtfj.java.javacore.JCJavaMethod)1 JCJavaObject (com.ibm.dtfj.java.javacore.JCJavaObject)1 JCJavaStackFrame (com.ibm.dtfj.java.javacore.JCJavaStackFrame)1 JCJavaThread (com.ibm.dtfj.java.javacore.JCJavaThread)1 BuilderFailureException (com.ibm.dtfj.javacore.builder.BuilderFailureException)1