Search in sources :

Example 6 with U8Pointer

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

the class RomClassWalker method allSlotsInMethodDebugInfoDo.

long allSlotsInMethodDebugInfoDo(U32Pointer cursor) throws CorruptDataException {
    J9MethodDebugInfoPointer methodDebugInfo;
    U8Pointer currentLineNumberPtr;
    /* if data is out of line, then the size of the data inline in the method is a single SRP in sizeof(U_32 increments), currently assuming J9SRP is U_32 aligned*/
    long inlineSize = SelfRelativePointer.SIZEOF / U32.SIZEOF;
    long sectionSizeBytes = 0;
    boolean inlineDebugExtension = (1 == (cursor.at(0).intValue() & 1));
    /* check for low tag to indicate inline or out of line debug information */
    if (inlineDebugExtension) {
        methodDebugInfo = J9MethodDebugInfoPointer.cast(cursor);
        /* set the inline size to stored size in terms of U_32
			 * NOTE: stored size is aligned on a U32
			 * tag bit will be dropped by the '/' operation */
        inlineSize = cursor.at(0).intValue() / U32.SIZEOF;
        sectionSizeBytes = inlineSize * U32.SIZEOF;
    } else {
        methodDebugInfo = J9MethodDebugInfoPointer.cast(SelfRelativePointer.cast(cursor).get());
        if (AlgorithmVersion.getVersionOf("VM_LINE_NUMBER_TABLE_VERSION").getAlgorithmVersion() < 1) {
            sectionSizeBytes = J9MethodDebugInfo.SIZEOF + (J9MethodDebugInfoHelper.getLineNumberCount(methodDebugInfo).intValue() * U32.SIZEOF);
        } else {
            sectionSizeBytes = J9MethodDebugInfo.SIZEOF + J9MethodDebugInfoHelper.getLineNumberCompressedSize(methodDebugInfo).intValue();
            /* When out of line debug information, align on U_16 */
            sectionSizeBytes = (sectionSizeBytes + U16.SIZEOF - 1) & ~(U16.SIZEOF - 1);
        }
    }
    if (!inlineDebugExtension) {
        if (inlineSize == 1) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, cursor, "SRP to DebugInfo");
            classWalkerCallback.addSection(clazz, cursor, inlineSize * U32.SIZEOF, "methodDebugInfo out of line", true);
        }
    }
    classWalkerCallback.addSlot(clazz, SlotType.J9_SRP, methodDebugInfo.srpToVarInfoEA(), "SizeOfDebugInfo(low tagged)");
    if (AlgorithmVersion.getVersionOf("VM_LINE_NUMBER_TABLE_VERSION").getAlgorithmVersion() < 1) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.lineNumberCountEA(), "lineNumberCount");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.varInfoCountEA(), "varInfoCount");
        J9LineNumberPointer lineNumberPtr = J9MethodDebugInfoHelper.getLineNumberTableForROMClass(methodDebugInfo);
        if (lineNumberPtr.notNull()) {
            for (int j = 0; j < methodDebugInfo.lineNumberCount().intValue(); j++, lineNumberPtr = lineNumberPtr.add(1)) {
                // FIXME : Silo
                // classWalkerCallback.addSlot(clazz, SlotType.J9_U16, lineNumberPtr.offsetLocationEA(), "offsetLocation");
                classWalkerCallback.addSlot(clazz, SlotType.J9_U16, lineNumberPtr.lineNumberEA(), "lineNumber");
            }
        }
    } else {
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.lineNumberCountEA(), "lineNumberCount(encoded)");
        classWalkerCallback.addSlot(clazz, SlotType.J9_U32, methodDebugInfo.varInfoCountEA(), "varInfoCount");
        if (methodDebugInfo.lineNumberCount().allBitsIn(1)) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_U32, U32Pointer.cast(methodDebugInfo.add(1)), "compressed line number size");
        }
        currentLineNumberPtr = J9MethodDebugInfoHelper.getCompressedLineNumberTableForROMClassV1(methodDebugInfo);
        if (currentLineNumberPtr.notNull()) {
            for (int j = 0; j < J9MethodDebugInfoHelper.getLineNumberCompressedSize(methodDebugInfo).intValue(); j++) {
                classWalkerCallback.addSlot(clazz, SlotType.J9_U8, currentLineNumberPtr, "pc, lineNumber compressed");
                currentLineNumberPtr = currentLineNumberPtr.add(1);
            }
        }
    }
    U8Pointer variableTable = OptInfo.getV1VariableTableForMethodDebugInfo(methodDebugInfo);
    if (variableTable.notNull()) {
        LocalVariableTableIterator variableInfoValuesIterator = LocalVariableTableIterator.localVariableTableIteratorFor(methodDebugInfo);
        U8Pointer start = variableInfoValuesIterator.getLocalVariableTablePtr();
        while (variableInfoValuesIterator.hasNext()) {
            LocalVariableTable values = variableInfoValuesIterator.next();
            // Need to walk the name and signature to add them to the UTF8 section
            classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getName(), "name");
            classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getSignature(), "getSignature");
            if (values.getGenericSignature().notNull()) {
                classWalkerCallback.addSlot(clazz, SlotType.J9_UTF8, values.getGenericSignature(), "getGenericSignature");
            }
        }
        U8Pointer end = variableInfoValuesIterator.getLocalVariableTablePtr();
        int localVariableSectionSize = end.sub(start).intValue();
        for (int j = 0; j < localVariableSectionSize; j++) {
            classWalkerCallback.addSlot(clazz, SlotType.J9_U8, start, "variableInfo compressed");
            start = start.add(1);
        }
        classWalkerCallback.addSection(clazz, variableTable, localVariableSectionSize, "variableInfo" + (inlineDebugExtension ? " Inline" : ""), inlineDebugExtension);
    }
    classWalkerCallback.addSection(clazz, methodDebugInfo, sectionSizeBytes, "methodDebugInfo" + (inlineDebugExtension ? " Inline" : ""), inlineDebugExtension);
    return inlineSize;
}
Also used : LocalVariableTable(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable) J9MethodDebugInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodDebugInfoPointer) LocalVariableTableIterator(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) J9LineNumberPointer(com.ibm.j9ddr.vm29.pointer.generated.J9LineNumberPointer)

Example 7 with U8Pointer

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

the class RomClassWalker method allSlotsInIntermediateClassDataDo.

void allSlotsInIntermediateClassDataDo() throws CorruptDataException {
    U32 count = romClass.intermediateClassDataLength();
    if (count.gt(0)) {
        U8Pointer cursor = romClass.intermediateClassData();
        String j9xHelp = "!j9x " + cursor.getHexAddress() + "," + count.getHexValue();
        classWalkerCallback.addSlot(clazz, SlotType.J9_IntermediateClassData, cursor, "intermediateClassData", j9xHelp);
        classWalkerCallback.addSection(clazz, cursor, count.longValue(), "intermediateClassDataSection", true);
    }
}
Also used : U32(com.ibm.j9ddr.vm29.types.U32) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 8 with U8Pointer

use of com.ibm.j9ddr.vm29.pointer.U8Pointer 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 9 with U8Pointer

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

the class DumpRomMethodCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        Iterable<J9ROMClassAndMethod> methodIterator = null;
        if (args.length < 1) {
            printUsage(out);
            return;
        }
        String selector = args[0];
        if (selector.equals("-a")) {
            if (args.length != 2) {
                printUsage(out);
                return;
            }
            /* decimal or hexadecimal */
            long methodAddress = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
            J9MethodPointer ramMethod = J9MethodPointer.cast(methodAddress);
            if (ramMethod.isNull()) {
                CommandUtils.dbgPrint(out, "bad ram method addr\n");
                return;
            }
            methodIterator = romMethodIteratorFromRamMethod(ramMethod);
        } else if (selector.equals("-o")) {
            if (args.length != 2) {
                printUsage(out);
                return;
            }
            long methodAddress = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
            J9ROMMethodPointer romMethod = J9ROMMethodPointer.cast(methodAddress);
            if (romMethod.isNull()) {
                CommandUtils.dbgPrint(out, "bad rom method addr\n");
                return;
            }
            J9ROMMethodPointer bytecodesStart = romMethod.add(1);
            /* bytecodes immediately follow the J9ROMMethod struct */
            U8Pointer pc = U8Pointer.cast(bytecodesStart.getAddress());
            J9MethodPointer ramMethod = J9JavaVMHelper.getMethodFromPC(J9RASHelper.getVM(DataType.getJ9RASPointer()), pc);
            methodIterator = romMethodIteratorFromRamMethod(ramMethod);
        } else {
            try {
                methodIterator = new FilteredROMMethodsIterator(out, context, selector);
            } catch (CorruptDataException e) {
                throw new DDRInteractiveCommandException(e);
            }
        }
        for (J9ROMClassAndMethod mi : methodIterator) {
            out.println(String.format("Class: %s", J9UTF8Helper.stringValue(mi.romClass.className())));
            J9BCUtil.j9bcutil_dumpRomMethod(out, mi.romMethod, mi.romClass, dumpFlags, J9BCUtil.BCUtil_DumpAnnotations);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    } catch (NullPointerException e) {
        e.printStackTrace();
        throw e;
    }
}
Also used : J9MethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer) FilteredROMMethodsIterator(com.ibm.j9ddr.vm29.tools.ddrinteractive.FilteredROMMethodsIterator) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ROMMethodPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ROMClassAndMethod(com.ibm.j9ddr.vm29.j9.walkers.J9ROMClassAndMethod)

Example 10 with U8Pointer

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

the class J9BCUtil method dumpSourceDebugExtension.

private static void dumpSourceDebugExtension(PrintStream out, J9ROMClassPointer romClass, long flags) throws CorruptDataException {
    if (J9BuildFlags.opt_debugInfoServer) {
        U8Pointer current;
        U32 temp;
        if ((flags & J9BCTranslationData.BCT_StripDebugAttributes) == 0) {
            J9SourceDebugExtensionPointer sde = OptInfo.getSourceDebugExtensionForROMClass(romClass);
            if (!sde.isNull()) {
                temp = sde.size();
                if (!temp.eq(0)) {
                    current = U8Pointer.cast(sde.add(1));
                    out.append(String.format("  Source debug extension (%d bytes):    ", temp.longValue()));
                    out.append(nl);
                    while (!temp.eq(0)) {
                        temp = temp.sub(1);
                        U8 c = current.at(0);
                        current = current.add(1);
                        if (c.eq('\015')) {
                            if (!temp.eq(0)) {
                                if (current.at(0).eq('\012')) {
                                    current = current.add(1);
                                }
                                out.append(nl + "    ");
                            }
                        } else if (c.eq('\012')) {
                            out.append(nl + "    ");
                        } else {
                            out.append((char) c.intValue());
                        }
                    }
                }
            }
        }
    }
}
Also used : J9SourceDebugExtensionPointer(com.ibm.j9ddr.vm29.pointer.generated.J9SourceDebugExtensionPointer) U8(com.ibm.j9ddr.vm29.types.U8) U32(com.ibm.j9ddr.vm29.types.U32) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Aggregations

U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)37 CorruptDataException (com.ibm.j9ddr.CorruptDataException)11 UDATA (com.ibm.j9ddr.vm29.types.UDATA)11 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)8 U32 (com.ibm.j9ddr.vm29.types.U32)8 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)7 U8 (com.ibm.j9ddr.vm29.types.U8)7 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)5 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)5 U16 (com.ibm.j9ddr.vm29.types.U16)5 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)4 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)4 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)3 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)3 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)3 CorruptData (com.ibm.dtfj.image.CorruptData)2 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)2 LocalVariableTable (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable)2 LocalVariableTableIterator (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator)2 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)2