Search in sources :

Example 1 with J9ROMMethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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 J9ROMMethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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 J9ROMMethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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 J9ROMMethodPointer

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

the class RomClassWalker method allSlotsInROMMethodDo.

private J9ROMMethodPointer allSlotsInROMMethodDo(J9ROMMethodPointer method) throws CorruptDataException {
    U32Pointer cursor;
    addObjectsasSlot(method);
    cursor = ROMHelp.J9_EXTENDED_MODIFIERS_ADDR_FROM_ROM_METHOD(method);
    allSlotsInBytecodesDo(method);
    if (J9ROMMethodHelper.hasExtendedModifiers(method)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "extendedModifiers");
        cursor = cursor.add(1);
    }
    if (J9ROMMethodHelper.hasGenericSignature(method)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, cursor, "methodUTF8");
        cursor = cursor.add(1);
    }
    if (J9ROMMethodHelper.hasExceptionInfo(method)) {
        J9ExceptionInfoPointer exceptionInfo = J9ExceptionInfoPointer.cast(cursor);
        long exceptionInfoSize = J9ExceptionInfo.SIZEOF + exceptionInfo.catchCount().longValue() * J9ExceptionHandler.SIZEOF + exceptionInfo.throwCount().longValue() * SelfRelativePointer.SIZEOF;
        allSlotsInExceptionInfoDo(exceptionInfo);
        cursor = cursor.addOffset(exceptionInfoSize);
    }
    if (J9ROMMethodHelper.hasMethodAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "methodAnnotation"));
    }
    if (J9ROMMethodHelper.hasParameterAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "parameterAnnotations"));
    }
    if (J9ROMMethodHelper.hasMethodTypeAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "method typeAnnotations"));
    }
    if (J9ROMMethodHelper.hasCodeTypeAnnotations(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "code typeAnnotations"));
    }
    if (J9ROMMethodHelper.hasDefaultAnnotation(method)) {
        cursor = cursor.add(allSlotsInAnnotationDo(cursor, "defaultAnnotation"));
    }
    if (J9ROMMethodHelper.hasDebugInfo(method)) {
        cursor = cursor.add(allSlotsInMethodDebugInfoDo(cursor));
    }
    if (J9ROMMethodHelper.hasStackMap(method)) {
        long stackMapSize = cursor.at(0).longValue();
        U8Pointer stackMap = U8Pointer.cast(cursor.add(1));
        classWalkerCallback.addSection(clazz, cursor, stackMapSize, "stackMap", true);
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "stackMapSize");
        allSlotsInStackMapDo(stackMap);
        cursor = cursor.addOffset(stackMapSize);
    }
    if (J9ROMMethodHelper.hasMethodParameters(method)) {
        cursor = cursor.add(allSlotsInMethodParametersDataDo(cursor));
    }
    return J9ROMMethodPointer.cast(cursor);
}
Also used : U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) U32Pointer(com.ibm.j9ddr.vm29.pointer.U32Pointer) J9ExceptionInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionInfoPointer)

Example 5 with J9ROMMethodPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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)

Aggregations

J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)22 CorruptDataException (com.ibm.j9ddr.CorruptDataException)10 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)10 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)9 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)7 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)7 U32 (com.ibm.j9ddr.vm29.types.U32)6 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)5 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)5 UDATA (com.ibm.j9ddr.vm29.types.UDATA)5 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)4 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)4 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)3 J9ROMClassAndMethod (com.ibm.j9ddr.vm29.j9.walkers.J9ROMClassAndMethod)3 U16 (com.ibm.j9ddr.vm29.types.U16)3 U8 (com.ibm.j9ddr.vm29.types.U8)3 J9ROMFieldShapeIterator (com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator)2 J9ExceptionInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ExceptionInfoPointer)2 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)2 J9ROMConstantPoolItemPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMConstantPoolItemPointer)2