Search in sources :

Example 1 with J9MethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.

the class StackWalkerUtils method swPrintMethod.

public static void swPrintMethod(WalkState walkState, J9MethodPointer method) throws CorruptDataException {
    if (method.notNull()) {
        J9UTF8Pointer className = UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
        J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
        J9UTF8Pointer name = romMethod.nameAndSignature().name();
        J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
        swPrintf(walkState, 2, "\tMethod: {0}.{1}{2} !j9method {3}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), method.getHexAddress());
    }
}
Also used : J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Example 2 with J9MethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.

the class TerseStackWalkerCallbacks method frameWalkFunction.

public FrameCallbackResult frameWalkFunction(J9VMThreadPointer walkThread, WalkState walkState) {
    try {
        if (walkState.method.notNull()) {
            J9MethodPointer method = walkState.method;
            J9UTF8Pointer className = StackWalkerUtils.UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
            J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
            J9UTF8Pointer name = romMethod.nameAndSignature().name();
            J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
            StackWalkerUtils.swPrintf(walkState, 0, "\t!j9method {3}   {0}.{1}{2}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), walkState.method.getHexAddress());
            return FrameCallbackResult.KEEP_ITERATING;
        }
        if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_JNI_NATIVE_METHOD) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Native method frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_GENERIC_SPECIAL) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        Generic special frame");
        } else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_METHODTYPE) {
            StackWalkerUtils.swPrintf(walkState, 0, "\t                        MethodType frame");
        } else {
            if (walkState.pc.getAddress() > J9SF_MAX_SPECIAL_FRAME_TYPE) {
                if (walkState.pc.getAddress() == walkState.walkThread.javaVM().callInReturnPC().getAddress() || walkState.pc.getAddress() == (walkState.walkThread.javaVM().callInReturnPC().getAddress() + 3)) {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        JNI call-in frame");
                } else {
                    StackWalkerUtils.swPrintf(walkState, 0, "\t                        unknown frame type {0} *{1}", walkState.pc, walkState.pc.getHexAddress());
                }
            } else {
                StackWalkerUtils.swPrintf(walkState, 0, "\t                        known but unhandled frame type {0}", walkState.pc);
            }
        }
    } catch (CorruptDataException e) {
        e.printStackTrace();
    }
    return FrameCallbackResult.KEEP_ITERATING;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 3 with J9MethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.

the class J9ClassHelper method getMethodFromPCAndClass.

/*
	 * Returns a program space pointer to the matching J9Method for the
	 * specified class and PC.
	 */
public static J9MethodPointer getMethodFromPCAndClass(J9ClassPointer localClass, U8Pointer pc) throws CorruptDataException {
    J9ROMClassPointer localROMClass = localClass.romClass();
    for (int i = 0; i < localROMClass.romMethodCount().longValue(); i++) {
        J9MethodPointer localMethod = localClass.ramMethods().add(i);
        J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(localMethod);
        boolean a = pc.gte(U8Pointer.cast(romMethod));
        boolean b = pc.lte(J9ROMMethodHelper.bytecodeEnd(romMethod).subOffset(1));
        if (a && b) {
            return localMethod;
        }
    }
    return J9MethodPointer.NULL;
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)

Example 4 with J9MethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.

the class BytecodesCommand method run.

// dbgext_bytecodes
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
        J9MethodPointer ramMethod = J9MethodPointer.cast(address);
        long maps = 0;
        if (ramMethod.isNull()) {
            CommandUtils.dbgPrint(out, "bad or missing ram method addr\n");
            return;
        }
        J9ClassPointer ramClass = ConstantPoolHelpers.J9_CLASS_FROM_METHOD(ramMethod);
        if (args.length == 2 && args[1].equals("maps")) {
            maps |= BCT_DumpMaps;
        }
        if (J9BuildFlags.env_littleEndian) {
            maps |= BCT_LittleEndianOutput;
        } else {
            maps |= BCT_BigEndianOutput;
        }
        J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(ramMethod);
        J9ROMClassPointer romClass = ramClass.romClass();
        J9BCUtil.j9bcutil_dumpRomMethod(out, romMethod, romClass, maps, 0);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 5 with J9MethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.

the class DumpRomMethodCommand method romMethodIteratorFromRamMethod.

private Iterable<J9ROMClassAndMethod> romMethodIteratorFromRamMethod(J9MethodPointer ramMethod) throws CorruptDataException {
    Iterable<J9ROMClassAndMethod> methodIterator;
    J9ClassPointer ramClass = ConstantPoolHelpers.J9_CLASS_FROM_METHOD(ramMethod);
    J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(ramMethod);
    J9ROMClassPointer romClass = ramClass.romClass();
    Vector<J9ROMClassAndMethod> methodInfoVector = new Vector<J9ROMClassAndMethod>(1);
    methodInfoVector.add(new J9ROMClassAndMethod(romMethod, romClass));
    methodIterator = methodInfoVector;
    return methodIterator;
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) Vector(java.util.Vector) J9ROMClassAndMethod(com.ibm.j9ddr.vm29.j9.walkers.J9ROMClassAndMethod)

Aggregations

J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)17 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)13 CorruptDataException (com.ibm.j9ddr.CorruptDataException)11 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)9 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)6 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)6 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)5 UDATA (com.ibm.j9ddr.vm29.types.UDATA)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)3 GCClassLoaderIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassLoaderIterator)2 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)2 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)2 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)2 J9ROMClassAndMethod (com.ibm.j9ddr.vm29.j9.walkers.J9ROMClassAndMethod)2 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)2 J9ConstantPoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ConstantPoolPointer)2 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)2 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)2 J9VMEntryLocalStoragePointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMEntryLocalStoragePointer)2