Search in sources :

Example 61 with J9ObjectPointer

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

the class ACCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        if (command.equalsIgnoreCase("!acforobject")) {
            if (null == heapRegionManager) {
                MM_HeapRegionManagerPointer hrmPointer;
                hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
                heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
            }
            if (args.length < 1) {
                throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
            }
            long addr = Long.decode(args[0]);
            J9ObjectPointer objectPointer = J9ObjectPointer.cast(addr);
            dumpACForObject(vm, objectPointer, out);
        } else {
            MM_GCExtensionsPointer gcExtensions = MM_GCExtensionsPointer.cast(vm.gcExtensions());
            if (args.length < 1) {
                throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
            }
            boolean dumpACExternalReferences = false;
            boolean dumpOwnedRegions = false;
            for (int i = 1; i < args.length; i++) {
                String arg = args[i];
                if (arg.equalsIgnoreCase("xrefs")) {
                    dumpACExternalReferences = true;
                } else if (arg.equalsIgnoreCase("ownedRegions")) {
                    dumpOwnedRegions = true;
                } else {
                    throw new DDRInteractiveCommandException("Unrecognized acforobject subcommand -->" + arg);
                }
            }
            long addr = Long.decode(args[0]);
            MM_AllocationContextPointer ac = MM_AllocationContextPointer.cast(addr);
            if (dumpACExternalReferences) {
                // TODO: handle other AC types
                if (GCExtensions.isVLHGC()) {
                    context.execute("!mm_allocationcontexttarok", new String[] { args[0] }, out);
                }
                dumpLiveReferences(vm, ac, out);
            }
            if (dumpOwnedRegions) {
                dumpOwnedRegions(vm, ac, out);
            }
        }
    } catch (DDRInteractiveCommandException e) {
        throw e;
    } catch (Throwable e) {
        e.printStackTrace(out);
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : MM_AllocationContextPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextPointer) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 62 with J9ObjectPointer

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

the class AnalyseRomClassUTF8Command method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        boolean printUTF8WeightList = false;
        int maxDistributionPercent = 85;
        if ((args.length >= 1) && (args[0].equals("UTF8WeightList"))) {
            printUTF8WeightList = true;
        }
        for (int i = 0; i < args.length; i++) {
            if (args[i].endsWith("%")) {
                try {
                    // Parses the maxDistribution string such as 85%
                    maxDistributionPercent = DecimalFormat.getInstance().parse(args[i]).intValue();
                } catch (ParseException e) {
                    out.println("Usage: !analyseromClassutf8 [UTF8WeightList] [maxDistribution%]		maxDistribution defaults to 85%");
                }
            }
        }
        Statistics statistics = new Statistics();
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        ROMClassesIterator classSegmentIterator = new ROMClassesIterator(out, vm.classMemorySegments());
        J9ObjectPointer bootstraploader = vm.systemClassLoader().classLoaderObject();
        while (classSegmentIterator.hasNext()) {
            J9ROMClassPointer classPointer = (J9ROMClassPointer) classSegmentIterator.next();
            ClassWalker classWalker = new RomClassWalker(classPointer, context);
            LinearDumper linearDumper = new LinearDumper();
            J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
            statistics.add(allRegionsNode, classSegmentIterator, bootstraploader);
        }
        statistics.getResult(printUTF8WeightList, maxDistributionPercent, out);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : ROMClassesIterator(com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator) J9ROMClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) J9ClassRegionNode(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper.J9ClassRegionNode) LinearDumper(com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) RomClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker) ClassWalker(com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker) ParseException(java.text.ParseException)

Example 63 with J9ObjectPointer

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

the class DumpStringTableCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    Set<J9ObjectPointer> stringTableObjects = null;
    try {
        stringTableObjects = getStringTableObjects();
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e.getMessage(), e);
    }
    for (J9ObjectPointer objectPointer : stringTableObjects) {
        String value = "**CORRUPT STRING TABLE ELEMENT **";
        try {
            value = J9ObjectHelper.stringValue(objectPointer);
        } catch (CorruptDataException e) {
        // ignore
        }
        String hexAddr = objectPointer.formatShortInteractive();
        out.println(String.format("%s value = <%s>", hexAddr, value));
    }
    out.println("Table Size = " + stringTableObjects.size());
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 64 with J9ObjectPointer

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

the class CompressedRefMappingCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    if (args.length == 0) {
        printHelp(out);
        return;
    }
    long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
    VoidPointer ptr = VoidPointer.cast(address);
    if (command.startsWith("!fj9object")) {
        J9ObjectPointer mappedValue;
        if (J9BuildFlags.gc_compressedPointers) {
            mappedValue = ObjectAccessBarrier.convertPointerFromToken(ptr.getAddress());
        } else {
            mappedValue = J9ObjectPointer.cast(ptr);
        }
        if (command.startsWith("!fj9objecttoj9object")) {
            out.println(String.format("!fj9object %s -> !j9object %s", ptr.getHexAddress(), mappedValue.getHexAddress()));
        } else {
            context.execute("!j9object", new String[] { mappedValue.getHexAddress() }, out);
        }
    } else {
        long tokenValue;
        if (J9BuildFlags.gc_compressedPointers) {
            tokenValue = ObjectAccessBarrier.convertTokenFromPointer(J9ObjectPointer.cast(ptr));
        } else {
            tokenValue = ptr.getAddress();
        }
        out.println(String.format("!j9object %s -> !fj9object 0x%s\n", ptr.getHexAddress(), Long.toHexString(tokenValue)));
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 65 with J9ObjectPointer

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

the class HashCodeCommand method run.

public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
    if (args.length != 1) {
        throw new DDRInteractiveCommandException("This debug extension needs a single address argument: !hashcode <object addr>");
    }
    long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
    final J9ObjectPointer objectPointer = J9ObjectPointer.cast(address);
    try {
        J9ClassPointer clazz = J9ObjectHelper.clazz(objectPointer);
        if (!J9ClassHelper.hasValidEyeCatcher(clazz)) {
            throw new DDRInteractiveCommandException("object class is not valid (eyecatcher is not 0x99669966)");
        }
    } catch (CorruptDataException cde) {
        throw new DDRInteractiveCommandException("memory fault de-referencing address argument", cde);
    }
    try {
        out.println(ObjectModel.getObjectHashCode(objectPointer).getHexValue());
    } catch (CorruptDataException cde) {
        throw new DDRInteractiveCommandException("error calculating hashcode", cde);
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Aggregations

J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)76 CorruptDataException (com.ibm.j9ddr.CorruptDataException)48 UDATA (com.ibm.j9ddr.vm29.types.UDATA)22 NoSuchElementException (java.util.NoSuchElementException)18 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)17 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)12 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)7 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)6 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)5 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)5 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)4 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)4 ArrayList (java.util.ArrayList)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)3 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)3