Search in sources :

Example 11 with J9ClassPointer

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

the class J9ClassHelper method getJavaName.

public static String getJavaName(J9ClassPointer clazz) throws CorruptDataException {
    String baseName = getName(clazz);
    char ch = baseName.charAt(0);
    if (ch != '[') {
        return baseName;
    }
    J9ArrayClassPointer arrayClass = J9ArrayClassPointer.cast(clazz);
    int arity = arrayClass.arity().intValue();
    StringBuilder buf = new StringBuilder();
    for (int i = 0; i < arity; i++) {
        buf.append("[]");
    }
    String aritySuffix = buf.toString();
    ch = baseName.charAt(1);
    switch(ch) {
        case 'B':
            return "byte" + aritySuffix;
        case 'C':
            return "char" + aritySuffix;
        case 'D':
            return "double" + aritySuffix;
        case 'F':
            return "float" + aritySuffix;
        case 'I':
            return "int" + aritySuffix;
        case 'J':
            return "long" + aritySuffix;
        case 'S':
            return "void" + aritySuffix;
        case 'V':
            return "void" + aritySuffix;
        case 'Z':
            return "boolean" + aritySuffix;
        case 'L':
            return getName(arrayClass.leafComponentType()) + aritySuffix;
    }
    // Should never happen
    return baseName;
}
Also used : J9ArrayClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)

Example 12 with J9ClassPointer

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

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

the class J9ClassHelper method superclass.

public static J9ClassPointer superclass(J9ClassPointer clazz) throws CorruptDataException {
    long index = classDepth(clazz).longValue() - 1;
    if (index < 0) {
        return J9ClassPointer.NULL;
    }
    VoidPointer j9ClassInstancePointer = clazz.superclasses().at(index);
    return J9ClassPointer.cast(j9ClassInstancePointer);
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer)

Example 14 with J9ClassPointer

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

the class RamClassWalker method allSlotsIniTableDo.

private void allSlotsIniTableDo() throws CorruptDataException {
    J9ITablePointer iTable = J9ITablePointer.cast(ramClass.iTable());
    int interfaceSize = 0;
    final J9ITablePointer superclassITable;
    final J9ClassPointer superclass = J9ClassHelper.superclass(ramClass);
    if (superclass.isNull()) {
        superclassITable = J9ITablePointer.NULL;
    } else {
        superclassITable = J9ITablePointer.cast(superclass.iTable());
    }
    /*
		 * Loops through the linked list of interfaces until it hit it's
		 * superclass'itable
		 */
    while (!iTable.eq(superclassITable)) {
        classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, iTable.interfaceClassEA(), "iTable->interfaceClass", "!j9class");
        classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, iTable.nextEA(), "iTable->next", "!j9itable");
        /*
			 * The iTables for the interface classes do not contain entries for
			 * methods.
			 */
        if (!ramClass.romClass().modifiers().allBitsIn(J9Consts.J9_JAVA_INTERFACE)) {
            int methodCount = iTable.interfaceClass().romClass().romMethodCount().intValue();
            for (int i = 0; i < methodCount; i++) {
                /*
					 * Add the method after the iTable. We add i + 1 to the
					 * iTable.nextEA() because we do not want to print the
					 * iTable.nextEA() but actually the value after it which 
					 * will be a method
					 */
                classWalkerCallback.addSlot(clazz, SlotType.J9_iTableMethod, iTable.nextEA().add(i + 1), "method", "!j9method");
                interfaceSize += UDATA.SIZEOF;
            }
        }
        iTable = iTable.next();
        interfaceSize += J9ITable.SIZEOF;
    }
    classWalkerCallback.addSection(clazz, ramClass.iTable(), interfaceSize, "iTable", false);
}
Also used : J9ITablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9ITablePointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Example 15 with J9ClassPointer

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

the class DumpAllRamClassLinearCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    long nestingThreashold;
    if (args.length > 1) {
        throw new DDRInteractiveCommandException("This debug extension accepts none or one argument!");
    } else if (args.length == 1) {
        nestingThreashold = Long.valueOf(args[0]);
    } else {
        nestingThreashold = 1;
    }
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        if (null != vm) {
            out.println();
            out.println("!j9javavm " + vm.getHexAddress());
        } else {
            throw new DDRInteractiveCommandException("Unable to find the VM in core dump!");
        }
        out.println();
        ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
        while (classSegmentIterator.hasNext()) {
            J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
            out.println("!dumpramclasslinear " + classPointer.getHexAddress());
            // RAM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
            out.println(String.format("RAM Class '%s' at %s", J9ClassHelper.getJavaName(classPointer), classPointer.getHexAddress()));
            out.println();
            ClassWalker classWalker = new RamClassWalker(classPointer, context);
            new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreashold);
            out.println();
        }
    } catch (CorruptDataException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
}
Also used : ClassSegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) RamClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)67 CorruptDataException (com.ibm.j9ddr.CorruptDataException)34 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)13 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)13 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)12 UDATA (com.ibm.j9ddr.vm29.types.UDATA)12 U32 (com.ibm.j9ddr.vm29.types.U32)11 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)9 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)9 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)8 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)8 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)7 NoSuchElementException (java.util.NoSuchElementException)7 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)6 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)6 GCClassHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator)5 GCSegmentIterator (com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)5 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)5 J9ITablePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ITablePointer)5