use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class ThreadsCommand method displayThreads.
private void displayThreads(PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer mainThread = vm.mainThread();
if (mainThread.notNull()) {
J9VMThreadPointer threadCursor = vm.mainThread();
do {
out.println(String.format("\t!stack 0x%08x\t!j9vmthread 0x%08x\t!j9thread 0x%08x\ttid 0x%x (%d) // (%s)", threadCursor.getAddress(), threadCursor.getAddress(), threadCursor.osThread().getAddress(), threadCursor.osThread().tid().longValue(), threadCursor.osThread().tid().longValue(), getThreadName(threadCursor)));
threadCursor = threadCursor.linkNext();
} while (!threadCursor.eq(mainThread));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class ACCommand method dumpOwnedRegions.
private void dumpOwnedRegions(J9JavaVMPointer vm, MM_AllocationContextPointer allocationContext, PrintStream out) throws CorruptDataException {
if (GCExtensions.isVLHGC()) {
Table table = new Table("Regions Owned by AC " + allocationContext.getHexAddress());
table.row("Region", "containsObjects");
GCHeapRegionIterator regionIterator = GCHeapRegionIterator.from();
while (regionIterator.hasNext()) {
GCHeapRegionDescriptor region = regionIterator.next();
MM_HeapRegionDescriptorVLHGCPointer vlhgcRegion = MM_HeapRegionDescriptorVLHGCPointer.cast(region.getHeapRegionDescriptorPointer());
MM_AllocationContextTarokPointer currentAllocationContextTarok = vlhgcRegion._allocateData()._owningContext();
if (currentAllocationContextTarok.eq(allocationContext)) {
table.row("!mm_heapregiondescriptorvlhgc " + vlhgcRegion.getHexAddress(), Boolean.toString(region.containsObjects()));
}
}
table.render(out);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class DumpAllSegmentsCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
out.append(String.format("memorySegments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.memorySegments().getAddress())));
SegmentsUtil.dbgDumpSegmentList(out, vm.memorySegments());
out.append(String.format("classMemorySegments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.classMemorySegments().getAddress())));
SegmentsUtil.dbgDumpSegmentList(out, vm.classMemorySegments());
if (J9BuildFlags.interp_nativeSupport) {
/* readJavaVM also reads converts the JITConfig pointer. */
if (!vm.jitConfig().isNull()) {
out.append(String.format("jit code segments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.jitConfig().codeCacheList().getAddress())));
SegmentsUtil.dbgDumpJITCodeSegmentList(out, vm.jitConfig().codeCacheList());
out.append(String.format("jit data segments - !j9memorysegmentlist 0x%s\n", Long.toHexString(vm.jitConfig().dataCacheList().getAddress())));
SegmentsUtil.dbgDumpSegmentList(out, vm.jitConfig().dataCacheList());
} else {
out.append("JIT not enabled\n");
}
}
out.append(nl);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class DumpContendedLoadTable method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (0 != args.length) {
String argument = args[0];
if (argument.equalsIgnoreCase("help")) {
help(out);
return;
}
}
try {
J9JavaVMPointer javaVM = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9HashTablePointer contTable = javaVM.contendedLoadTable();
J9PoolPointer poolPtr = contTable.listNodePool();
Pool<J9ContendedLoadTableEntryPointer> pool = Pool.fromJ9Pool(poolPtr, J9ContendedLoadTableEntryPointer.class);
SlotIterator<J9ContendedLoadTableEntryPointer> poolIterator = pool.iterator();
if (poolIterator.hasNext()) {
out.println("Active class loads:");
while (poolIterator.hasNext()) {
J9ContendedLoadTableEntryPointer entryPointer = poolIterator.next();
String ldStatus = loadingStatusValues.get(entryPointer.status().longValue());
if (null == ldStatus) {
ldStatus = "ILLEGAL VALUE: " + entryPointer.status();
}
J9VMThreadPointer loadingThread = entryPointer.thread();
out.print(String.format("\tClassname: %s;\n\t\tLoader: %s; Loading thread: %s %s\n\t\tStatus: %s; Table entry hash 0x%X\n", entryPointer.className().getCStringAtOffset(0, entryPointer.classNameLength().longValue()), entryPointer.classLoader().formatShortInteractive(), J9VMThreadHelper.getName(loadingThread), loadingThread.formatShortInteractive(), ldStatus, entryPointer.hashValue().longValue()));
}
MonitorIterator iterator = new MonitorIterator(javaVM);
while (iterator.hasNext()) {
Object current = iterator.next();
if (current instanceof J9ThreadMonitorPointer) {
// System Monitor
SystemMonitor monitor = SystemMonitor.fromJ9ThreadMonitor((J9ThreadMonitorPointer) current);
final String monitorName = monitor.getName();
if (monitorName.matches(".*VM class table.*")) {
List<J9ThreadPointer> waitingThreads = monitor.getWaitingThreads();
if (!waitingThreads.isEmpty()) {
out.print("Waiting threads:\n");
for (J9ThreadPointer tp : waitingThreads) {
J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(tp);
if (vmThread.notNull()) {
out.print(String.format("\t%s\t%s\n", vmThread.formatShortInteractive(), J9VMThreadHelper.getName(vmThread)));
} else {
out.print(String.format("\t%s\t%s\n", tp.formatShortInteractive(), "[osthread]"));
}
}
}
break;
}
}
}
} else {
out.println("No active class loads");
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class DumpRomClassCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long maps = 0;
if (args.length != 1 && args.length != 2) {
printUsage(out);
return;
}
if (args.length == 2 && args[1].equals("maps")) {
maps |= J9BCTranslationData.BCT_DumpMaps;
}
if (J9BuildFlags.env_littleEndian) {
maps |= J9BCTranslationData.BCT_LittleEndianOutput;
} else {
maps |= J9BCTranslationData.BCT_BigEndianOutput;
}
/* check for name:<name> */
if (args[0].startsWith("name:")) {
long hitCount = 0;
String searchClassName = args[0].substring(args[0].indexOf(':') + 1);
PatternString pattern = new PatternString(searchClassName);
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
ClassSegmentIterator iterator = new ClassSegmentIterator(vm.classMemorySegments());
while (iterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) iterator.next();
String javaName = J9ClassHelper.getJavaName(classPointer);
if (pattern.isMatch(javaName)) {
hitCount++;
J9ROMClassPointer clazz = classPointer.romClass();
String hexString = clazz.getHexAddress();
out.println(String.format("ROMClass %1$s named %2$s\n", hexString, javaName));
J9BCUtil.j9bcutil_dumpRomClass(out, clazz, maps);
}
}
out.println(String.format("Found %1$d class(es) with name %2$s\n", hitCount, searchClassName));
} else {
/* treat argument as address */
long addr = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
J9ROMClassPointer clazz = J9ROMClassPointer.cast(addr);
J9BCUtil.j9bcutil_dumpRomClass(out, clazz, maps);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations