use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class ThreadsCommand method search.
private void search(PrintStream out, UDATA tid) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer mainThread = vm.mainThread();
if (mainThread.notNull()) {
J9VMThreadPointer threadCursor = vm.mainThread();
do {
if (threadCursor.osThread().tid().eq(tid)) {
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)));
break;
}
threadCursor = threadCursor.linkNext();
} while (!threadCursor.eq(mainThread));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class J9VTablesCommand method run.
public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
try {
final J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9ClassPointer ramClass;
UDATA vTableSlotCount;
// UDATA jitVTableSlotCount;
UDATAPointer jitVTable = UDATAPointer.NULL;
UDATAPointer vTable;
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
ramClass = J9ClassPointer.cast(address);
vTable = J9ClassHelper.vTable(ramClass);
vTableSlotCount = vTable.at(0);
if (J9BuildFlags.interp_nativeSupport) {
if (!vm.jitConfig().isNull()) {
jitVTable = UDATAPointer.cast(U8Pointer.cast(ramClass).sub((vTableSlotCount.longValue() + 1) * UDATA.SIZEOF));
// jitVTableSlotCount = vTableSlotCount.sub(1);
}
}
CommandUtils.dbgPrint(out, String.format("VTable for j9class %s (size=%d - 1 for skipped resolve method)\n", ramClass.getHexAddress(), vTableSlotCount.longValue()));
CommandUtils.dbgPrint(out, String.format("\tInterpreted%s\n", (!jitVTable.isNull()) ? "\t\tJitted\n" : ""));
/* First entry in vtable is the vtable count.
* Second entry is the magic method reference.
* Skip both and start from the third element in vTable which is the first virtual method reference.
**/
for (long i = 2; i < vTableSlotCount.longValue() + 1; i++) {
String name = J9MethodHelper.getName(J9MethodPointer.cast(vTable.at(i)));
String intAddr = U8Pointer.cast(vTable.at(i)).getHexAddress();
if (!jitVTable.isNull()) {
String jitAddr = U8Pointer.cast(jitVTable.at(vTableSlotCount.sub(i))).getHexAddress();
CommandUtils.dbgPrint(out, String.format(" %d\t!j9method %s\t%s\t%s\n", i - 1, intAddr, jitAddr, name));
} else {
CommandUtils.dbgPrint(out, String.format(" %d\t!j9method %s\t%s\t\n", i - 1, intAddr, name));
}
}
return;
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class MarkMapCommand method showActiveMarkMap.
protected void showActiveMarkMap(PrintStream out) {
out.format("Currently active mark map: !mm_heapmap %s\n", markMap.getHeapMap().getHexAddress());
out.format("\tHeap: %s -> %s\n", markMap.getHeapBase().getHexAddress(), markMap.getHeapTop().getHexAddress());
UDATA maxOffset = markMap.getSlotIndexAndMask(J9ObjectPointer.cast(markMap.getHeapTop().subOffset(markMap.getObjectGrain())))[0];
maxOffset = maxOffset.add(1);
out.format("\tBits: %s -> %s\n", markMap.getHeapMapBits().getHexAddress(), markMap.getHeapMapBits().add(maxOffset).getHexAddress());
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class J9MemTagCommands method runFindHeader.
private void runFindHeader(String command, String[] args, Context context) throws DDRInteractiveCommandException {
long address = 0;
J9MemTagPointer header = null;
if (args.length != 1) {
out.println("Usage: ");
out.println(" !findheader <address> (e.g. !findheader 0xa2b4c6d8)");
return;
}
address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
out.println(String.format("Searching memory allocation header for %s", U8Pointer.cast(address).getHexAddress()));
/*
* Search for an eyecatcher on or before the specified address. Start
* the search on the specified address since an eyecatcher may start on
* the address. Ensure that the eyecatcher that is found is on or before
* the address. If this condition is not satisfied, start searching for
* an eyecatcher 1K before the previous start address. Continue until an
* eyecatcher is found, or the start address of 0 is reached.
*/
long searchBase = address - SEARCH_SLAB_SIZE;
SEARCH_LOOP: do {
/* Add 3 (length of eyecatcher - 1) to the top address, to catch eyecatchers written between search slabs */
J9MemTagIterator it = J9MemTagIterator.iterateAllocatedHeaders(searchBase, searchBase + SEARCH_SLAB_SIZE + 3);
while (it.hasNext()) {
J9MemTagPointer potential = it.next();
if (Addresses.greaterThan(potential.getAddress(), address)) {
/* Walked past address */
break;
}
VoidPointer start = J9MemTagHelper.j9mem_get_memory_base(potential);
VoidPointer end;
try {
end = start.addOffset(potential.allocSize().longValue());
} catch (CorruptDataException e) {
continue;
}
if (Addresses.greaterThanOrEqual(address, start.getAddress()) && Addresses.lessThan(address, end.getAddress())) {
/* Match */
header = potential;
break SEARCH_LOOP;
}
}
if (Addresses.lessThan(searchBase, SEARCH_SLAB_SIZE)) {
searchBase = 0;
} else {
searchBase = searchBase - SEARCH_SLAB_SIZE;
}
} while (searchBase != 0);
if (header == null) {
out.println("No memory allocation header found");
} else {
String callsite;
try {
callsite = header.callSite().getCStringAtOffset(0);
} catch (CorruptDataException ex) {
callsite = "<FAULT> reading callsite string: " + ex.getMessage();
}
String categoryName;
try {
categoryName = header.category().name().getCStringAtOffset(0);
} catch (CorruptDataException ex) {
categoryName = "<FAULT> reading category name string: " + ex.getMessage();
}
try {
out.println(String.format("Found memory allocation header, !j9x %s,0x%#x", J9MemTagHelper.j9mem_get_memory_base(header).getHexAddress(), header.allocSize().longValue()));
out.println(String.format("J9MemTag at %s {", header.getHexAddress()));
out.println(String.format(" U_32 eyeCatcher = 0x%x;", header.eyeCatcher().longValue()));
out.println(String.format(" U_32 sumCheck = 0x%x;", header.sumCheck().longValue()));
out.println(String.format(" UDATA allocSize = 0x%x;", header.allocSize().longValue()));
out.println(String.format(" char* callSite = %s;", callsite));
out.println(String.format(" struct OMRMemCategory* category = !omrmemcategory 0x%x (%s);", header.category().longValue(), categoryName));
out.println("}");
} catch (CorruptDataException ex) {
out.println("CDE formatting J9MemTag at " + header.getHexAddress());
}
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class SegmentsUtil method dbgDumpJITCodeSegmentList.
public static void dbgDumpJITCodeSegmentList(PrintStream out, J9MemorySegmentListPointer segmentListPointer) throws CorruptDataException {
String fmt = null;
if (J9BuildFlags.env_data64) {
out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
out.append("| segment | start | warmAlloc | coldAlloc | end | size |\n");
out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
fmt = " %016x %016x %016x %016x %016x %8x";
} else {
out.append("+--------+--------+--------+--------+--------+--------+\n");
out.append("|segment | start | warm | cold | end | size |\n");
out.append("+--------+--------+--------+--------+--------+--------+\n");
fmt = " %08x %08x %08x %08x %08x %8x";
}
MemorySegmentIterator segmentIterator = new MemorySegmentIterator(segmentListPointer, MemorySegmentIterator.MEMORY_ALL_TYPES, false);
long totalMemory = 0L, totalMemoryInUse = 0L;
while (segmentIterator.hasNext()) {
J9MemorySegmentPointer seg = (J9MemorySegmentPointer) segmentIterator.next();
final UDATA heapBase = UDATAPointer.cast(seg.heapBase()).at(0);
long warmAlloc = UDATAPointer.cast(heapBase).at(0).longValue();
long coldAlloc = UDATAPointer.cast(heapBase.add(UDATA.SIZEOF)).at(0).longValue();
totalMemory += seg.size().longValue();
totalMemoryInUse += (warmAlloc - seg.heapBase().longValue()) + (seg.heapTop().longValue() - coldAlloc);
String msg = String.format(fmt, seg.getAddress(), seg.heapBase().getAddress(), warmAlloc, coldAlloc, seg.heapTop().getAddress(), seg.size().longValue());
out.append(msg);
out.append(nl);
seg = segmentListPointer.nextSegment();
}
if (J9BuildFlags.env_data64) {
out.append("+----------------+----------------+----------------+----------------+----------------+--------+\n");
} else {
out.append("+--------+--------+--------+--------+--------+--------+\n");
}
printMemoryUsed(out, totalMemory, totalMemoryInUse);
out.append(nl);
}
Aggregations