Search in sources :

Example 1 with RamClassWalker

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker 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)

Example 2 with RamClassWalker

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker in project openj9 by eclipse.

the class RamClassSummaryCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        ClassSummaryHelper classSummaryHelper = new ClassSummaryHelper(preferredOrder);
        ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
        while (classSegmentIterator.hasNext()) {
            J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
            numberOfClasses++;
            ClassWalker classWalker = new RamClassWalker(classPointer, context);
            LinearDumper linearDumper = new LinearDumper();
            J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
            classSummaryHelper.addRegionsForClass(allRegionsNode);
        }
        classSummaryHelper.printStatistics(out);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : ClassSegmentIterator(com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator) J9ClassRegionNode(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) ClassSummaryHelper(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassSummaryHelper) 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)

Example 3 with RamClassWalker

use of com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker in project openj9 by eclipse.

the class DumpRamClassLinearCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (args.length == 0)
        throw new DDRInteractiveCommandException("This debug extension needs an address argument !dumpramclasslinear <addr>[,n]");
    String[] arguments = args[0].split(",");
    long addr = Long.decode(arguments[0]);
    long nestingThreshold;
    if (arguments.length > 1) {
        nestingThreshold = Long.decode(arguments[1]);
    } else {
        nestingThreshold = 1;
    }
    J9ClassPointer clazz = J9ClassPointer.cast(addr);
    try {
        out.println(String.format("RAM Class '%s' at %s", J9UTF8Helper.stringValue(clazz.romClass().className()), clazz.getHexAddress()));
        ClassWalker classWalker = new RamClassWalker(clazz, context);
        new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreshold);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) 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

CorruptDataException (com.ibm.j9ddr.CorruptDataException)3 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)3 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)3 RamClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.RamClassWalker)3 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)2 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)2 ClassSummaryHelper (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassSummaryHelper)1 J9ClassRegionNode (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode)1