Search in sources :

Example 71 with DDRInteractiveCommandException

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

the class MarkMapCommand method setMarkMap.

protected void setMarkMap(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    GCHeapMap newMap = null;
    try {
        if (args[1].equalsIgnoreCase("active") || args[1].equalsIgnoreCase("default")) {
            newMap = GCHeapMap.from();
        } else if (args[1].equalsIgnoreCase("previous")) {
            if (GCExtensions.isVLHGC()) {
                MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
                MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
                newMap = GCHeapMap.fromHeapMap(igc._markMapManager()._previousMarkMap());
            } else {
                throw new DDRInteractiveCommandException("Only valid when running balanced!");
            }
        } else if (args[1].equalsIgnoreCase("next")) {
            if (GCExtensions.isVLHGC()) {
                MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
                MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
                newMap = GCHeapMap.fromHeapMap(igc._markMapManager()._nextMarkMap());
            } else {
                throw new DDRInteractiveCommandException("Only valid when running balanced!");
            }
        } else {
            long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
            MM_HeapMapPointer heapMap = MM_HeapMapPointer.cast(address);
            newMap = GCHeapMap.fromHeapMap(heapMap);
        }
        /* Quick test for validity */
        newMap.queryObject(J9ObjectPointer.cast(newMap.getHeapBase()));
        newMap.queryObject(J9ObjectPointer.cast(newMap.getHeapTop().subOffset(newMap.getObjectGrain())));
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
    /* If we got here, the new map must be ok */
    if (newMap != null) {
        markMap = newMap;
        showActiveMarkMap(out);
    }
}
Also used : MM_IncrementalGenerationalGCPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_IncrementalGenerationalGCPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MM_HeapMapPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapMapPointer) GCHeapMap(com.ibm.j9ddr.vm29.j9.gc.GCHeapMap) MM_GCExtensionsPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 72 with DDRInteractiveCommandException

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

the class MarkMapCommand method near.

protected void near(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        J9ObjectPointer object = J9ObjectPointer.cast(address);
        J9ObjectPointer base = object.untag(markMap.getPageSize(object) - 1);
        J9ObjectPointer top = base.addOffset(markMap.getPageSize(object));
        MarkedObject[] results = markMap.queryRange(base, top);
        reportResults(base, top, results, out);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MarkedObject(com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 73 with DDRInteractiveCommandException

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

the class MonitorsCommand method tablesCommand.

/**
 * See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
 * function documentation
 *
 * @param args
 *            command args
 * @param out
 *            the output stream
 */
private void tablesCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
    try {
        MonitorTableListIterator iterator = new MonitorTableListIterator();
        MonitorTable previousMonitorTable = null;
        while (iterator.hasNext()) {
            MonitorTable currentMonitorTable = iterator.currentMonitorTable();
            if (!currentMonitorTable.equals(previousMonitorTable)) {
                /* Print header for new monitor table */
                out.println(iterator.currentMonitorTable().extraInfo());
            }
            previousMonitorTable = currentMonitorTable;
            iterator.next();
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MonitorTableListIterator(com.ibm.j9ddr.vm29.j9.MonitorTableListIterator) MonitorTable(com.ibm.j9ddr.vm29.j9.MonitorTable)

Example 74 with DDRInteractiveCommandException

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

the class SearchStringTableCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        if (1 == args.length) {
            J9ObjectPointer objectPointer = J9ObjectPointer.cast(CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64));
            J9ObjectPointer data = StringTable.from().search(objectPointer);
            if (data.notNull()) {
                String stringValue = J9ObjectHelper.stringValue(data);
                String hexAddr = data.formatShortInteractive();
                out.println(String.format("%s <%s>", hexAddr, stringValue));
            } else {
                out.println("Not found");
            }
        } else {
            throw new DDRInteractiveCommandException("This debug extension needs an address argument !searchstringtable <addr>");
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 75 with DDRInteractiveCommandException

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

the class MonitorsCommand method objectsCommand.

private void objectsCommand(FilterOptions filter, PrintStream out) throws DDRInteractiveCommandException {
    try {
        HashSet<ObjectMonitor> monitors = new HashSet<ObjectMonitor>();
        MonitorTableListIterator iterator = new MonitorTableListIterator();
        MonitorTable previousMonitorTable = null;
        StringBuilder builder = new StringBuilder();
        while (iterator.hasNext()) {
            J9ObjectMonitorPointer objectMonitorPointer = iterator.next();
            MonitorTable currentMonitorTable = iterator.currentMonitorTable();
            ObjectMonitor found = tablePrintHelper(filter, builder, objectMonitorPointer);
            if (null != found) {
                monitors.add(found);
            }
            if (!currentMonitorTable.equals(previousMonitorTable) && (builder.length() > 0)) {
                /* Print header for new monitor table */
                if (null != previousMonitorTable) {
                    out.println();
                }
                out.println(iterator.currentMonitorTable().extraInfo());
                previousMonitorTable = currentMonitorTable;
            }
            out.append(builder);
            builder.setLength(0);
        }
        // Don't forget leftover flatlocked monitors on heap, these have no associated table:
        Iterator<ObjectMonitor> flatMonitorIterator = HeapWalker.getFlatLockedMonitors().iterator();
        while (flatMonitorIterator.hasNext()) {
            ObjectMonitor objMon = flatMonitorIterator.next();
            if (!monitors.contains(objMon)) {
                writeObjectMonitorToBuffer(filter, objMon, builder);
            }
        }
        if (builder.length() > 0) {
            out.append("<Flatlocked Monitors on Heap>\n");
            out.append(builder);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ObjectMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) MonitorTableListIterator(com.ibm.j9ddr.vm29.j9.MonitorTableListIterator) MonitorTable(com.ibm.j9ddr.vm29.j9.MonitorTable) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor) HashSet(java.util.HashSet)

Aggregations

DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)86 CorruptDataException (com.ibm.j9ddr.CorruptDataException)81 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)38 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)16 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)16 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)16 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)11 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)8 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)8 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)7 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)6 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)6 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)6 PatternString (com.ibm.j9ddr.util.PatternString)5 ROMClassesIterator (com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator)5 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)5 RomClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.RomClassWalker)5 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)4 MonitorTableListIterator (com.ibm.j9ddr.vm29.j9.MonitorTableListIterator)4