Search in sources :

Example 1 with LineNumberIterator

use of com.ibm.j9ddr.vm29.j9.walkers.LineNumberIterator in project openj9 by eclipse.

the class J9BCUtil method dumpMethodDebugInfo.

private static void dumpMethodDebugInfo(PrintStream out, J9ROMClassPointer romClass, J9ROMMethodPointer romMethod, long flags) throws CorruptDataException {
    J9MethodDebugInfoPointer methodInfo;
    if ((flags & J9BCTranslationData.BCT_StripDebugAttributes) == 0) {
        methodInfo = getMethodDebugInfoFromROMMethod(romMethod);
        if (!methodInfo.isNull()) {
            out.append(nl);
            out.append("  Debug Info:");
            out.append(nl);
            out.append(String.format("    Line Number Table (%d):", J9MethodDebugInfoHelper.getLineNumberCount(methodInfo).intValue()));
            out.append(nl);
            LineNumberIterator lineNumberIterator = LineNumberIterator.lineNumberIteratorFor(methodInfo);
            while (lineNumberIterator.hasNext()) {
                LineNumber lineNumber = lineNumberIterator.next();
                if (null == lineNumber) {
                    out.append("      Bad compressed data \n");
                    U8Pointer currentLineNumberPtr = lineNumberIterator.getLineNumberTablePtr();
                    int sizeLeft = J9MethodDebugInfoHelper.getLineNumberCompressedSize(methodInfo).sub((currentLineNumberPtr.sub(J9MethodDebugInfoHelper.getLineNumberTableForROMClass(methodInfo)))).intValue();
                    while (0 < sizeLeft--) {
                        out.append("      " + currentLineNumberPtr.at(0));
                        out.append(nl);
                        currentLineNumberPtr = currentLineNumberPtr.add(1);
                    }
                    break;
                } else {
                    out.append(String.format("      Line: %5d PC: %5d", lineNumber.getLineNumber().longValue(), lineNumber.getLocation().longValue()));
                    out.append(nl);
                }
            }
            out.append(nl);
            out.append(String.format("    Variables (%d):", methodInfo.varInfoCount().longValue()));
            out.append(nl);
            LocalVariableTableIterator variableInfoValuesIterator = LocalVariableTableIterator.localVariableTableIteratorFor(methodInfo);
            while (variableInfoValuesIterator.hasNext()) {
                LocalVariableTable values = variableInfoValuesIterator.next();
                out.append(String.format("      Slot: %d", values.getSlotNumber().intValue()));
                out.append(nl);
                out.append(String.format("      Visibility Start: %d", values.getStartVisibility().intValue()));
                out.append(nl);
                out.append(String.format("      Visibility End: %d", values.getStartVisibility().intValue() + values.getVisibilityLength().intValue()));
                out.append(nl);
                out.append(String.format("      Visibility Length: %d", values.getVisibilityLength().intValue()));
                out.append(nl);
                out.append("      Name: ");
                if ((null != values.getName()) && (!values.getName().isNull())) {
                    out.append(String.format("%s", J9UTF8Helper.stringValue(values.getName())));
                } else {
                    out.append("None");
                }
                out.append(nl);
                out.append("      Signature: ");
                if ((null != values.getSignature()) && (!values.getSignature().isNull())) {
                    out.append(String.format("%s", J9UTF8Helper.stringValue(values.getSignature())));
                } else {
                    out.append("None");
                }
                out.append(nl);
                out.append("      Generic Signature: ");
                if ((null != values.getGenericSignature()) && (!values.getGenericSignature().isNull())) {
                    out.append(String.format("%s", J9UTF8Helper.stringValue(values.getGenericSignature())));
                } else {
                    out.append("None");
                }
                out.append(nl);
            }
        }
    }
}
Also used : LocalVariableTable(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable) J9MethodDebugInfoPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MethodDebugInfoPointer) LineNumberIterator(com.ibm.j9ddr.vm29.j9.walkers.LineNumberIterator) LocalVariableTableIterator(com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) LineNumber(com.ibm.j9ddr.vm29.j9.walkers.LineNumber)

Aggregations

LineNumber (com.ibm.j9ddr.vm29.j9.walkers.LineNumber)1 LineNumberIterator (com.ibm.j9ddr.vm29.j9.walkers.LineNumberIterator)1 LocalVariableTable (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTable)1 LocalVariableTableIterator (com.ibm.j9ddr.vm29.j9.walkers.LocalVariableTableIterator)1 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)1 J9MethodDebugInfoPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodDebugInfoPointer)1