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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations