use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class MonitorsCommand method systemCommand.
private void systemCommand(FilterOptions filter, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
MonitorIterator iterator = new MonitorIterator(vm);
while (iterator.hasNext()) {
Object current = iterator.next();
if (current instanceof J9ThreadMonitorPointer) {
// System Monitor
SystemMonitor monitor = SystemMonitor.fromJ9ThreadMonitor((J9ThreadMonitorPointer) current);
writeSystemMonitor(filter, monitor, out);
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class QueryRomClassCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0) {
printUsage(out);
return;
}
try {
String[] queries = args[0].split(",");
long address = CommandUtils.parsePointer(queries[0], J9BuildFlags.env_data64);
J9ROMClassPointer romClass = J9ROMClassPointer.cast(address);
queries[0] = "";
ClassWalker classWalker = new RomClassWalker(romClass, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
for (String query : queries) {
if (query.length() != 0) {
queryROMClass(out, romClass, query, allRegionsNode);
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class MarkMapCommand method markBits.
protected void markBits(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 = J9ObjectPointer.cast(address).untag(markMap.getPageSize(object) - 1);
J9ObjectPointer top = base.addOffset(markMap.getPageSize(object));
MarkedObject[] result = markMap.queryRange(base, top);
if (result.length > 0) {
if (result[0].wasRelocated()) {
out.format("Mark bits for the compacted range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
} else {
out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
}
} else {
/* Either outside the heap, or just nothing there */
try {
UDATA[] indexAndMask = markMap.getSlotIndexAndMask(base);
UDATAPointer markBitsSlot = markMap.getHeapMapBits().add(indexAndMask[0]);
out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), markBitsSlot.getHexAddress());
} catch (IllegalArgumentException ex) {
out.format("Object %s is not in the heap\n", object.getHexAddress());
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class MarkMapCommand method scanRange.
protected void scanRange(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long baseAddress = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
long topAddress = CommandUtils.parsePointer(args[2], J9BuildFlags.env_data64);
J9ObjectPointer base = J9ObjectPointer.cast(baseAddress);
J9ObjectPointer top = J9ObjectPointer.cast(topAddress);
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 j9vmthreadCommand.
/**
* See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
* function documentation
*
* @param args
* command args
* @param out
* the output stream
* @throws DDRInteractiveCommandException
*/
private void j9vmthreadCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
if (args.length < 2) {
out.println("This command takes one address argument: \"!monitors j9vmthread <address>\"");
return;
}
try {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer thread = null;
GCVMThreadListIterator threadIterator = GCVMThreadListIterator.from();
while (threadIterator.hasNext()) {
if (ptr.equals(threadIterator.next())) {
thread = J9VMThreadPointer.cast(ptr);
}
}
if (null == thread) {
throw new DDRInteractiveCommandException(String.format("Could not find any j9vmthread at address %s\n", ptr.getHexAddress()));
}
// Step 1: Print the general info for the VM and native threads:
out.println(String.format("!j9vmthread 0x%08x\t!j9thread 0x%08x\t// %s", thread.getAddress(), thread.osThread().getAddress(), J9VMThreadHelper.getName(thread)));
printMonitorsForJ9VMThread(out, vm, thread);
printMonitorsForJ9Thread(out, vm, thread.osThread());
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations