use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class ClassloadersSummaryCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
Collection<ClassloadersSummaryNode> stats = getStat();
printStat(stats, out, args.length > 0 && args[0].equalsIgnoreCase("segs"));
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class WhatIsCommand method walkStructuresFrom.
private boolean walkStructuresFrom(StructurePointer startPoint) throws DDRInteractiveCommandException {
Set<AbstractPointer> walked = new HashSet<AbstractPointer>();
SearchStack searchStack = new SearchStack(maxDepth);
if (UDATA.cast(startPoint).eq(searchValue)) {
out.println("Found " + searchValue.getHexValue() + " as " + startPoint.formatShortInteractive());
return true;
}
/* Seed with startPoint */
searchStack.push(new SearchFrame(startPoint));
walked.add(startPoint);
boolean found = false;
while (!searchStack.isEmpty() && !found) {
SearchFrame current = searchStack.peek();
int fieldIndex = current.fieldIndex++;
if (current.fieldAccessors.length <= fieldIndex) {
// We've walked all the fields on this object
searchStack.pop();
continue;
}
try {
current.fieldName = current.fieldAccessors[fieldIndex].getName();
Object result = current.fieldAccessors[fieldIndex].invoke(current.ptr);
if (result == null) {
continue;
}
fieldCount++;
if (result instanceof StructurePointer) {
StructurePointer ptr = (StructurePointer) result;
found = checkPointer(searchStack, ptr);
if (!searchStack.isFull() && !walked.contains(ptr)) {
walked.add(ptr);
searchStack.push(new SearchFrame(ptr));
}
} else if (result instanceof AbstractPointer) {
AbstractPointer ptr = (AbstractPointer) result;
found = checkPointer(searchStack, ptr);
} else if (result instanceof Scalar) {
Scalar s = (Scalar) result;
found = checkScalar(searchStack, s);
} else {
out.println("Unexpected type walked: " + result.getClass().getName());
continue;
}
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof CorruptDataException || cause instanceof NoSuchFieldError || cause instanceof NoClassDefFoundError) {
// Skip this field
continue;
} else {
throw new DDRInteractiveCommandException("Unexpected exception during walk", cause);
}
} catch (Exception e) {
throw new DDRInteractiveCommandException("Unexpected exception during !whatis walk", e);
}
}
return found;
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class BytecodesCommand method run.
// dbgext_bytecodes
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
J9MethodPointer ramMethod = J9MethodPointer.cast(address);
long maps = 0;
if (ramMethod.isNull()) {
CommandUtils.dbgPrint(out, "bad or missing ram method addr\n");
return;
}
J9ClassPointer ramClass = ConstantPoolHelpers.J9_CLASS_FROM_METHOD(ramMethod);
if (args.length == 2 && args[1].equals("maps")) {
maps |= BCT_DumpMaps;
}
if (J9BuildFlags.env_littleEndian) {
maps |= BCT_LittleEndianOutput;
} else {
maps |= BCT_BigEndianOutput;
}
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(ramMethod);
J9ROMClassPointer romClass = ramClass.romClass();
J9BCUtil.j9bcutil_dumpRomMethod(out, romMethod, romClass, maps, 0);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException 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.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class ThreadsCommand method flags.
private void flags(PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer mainThread = vm.mainThread();
if (mainThread.notNull()) {
J9VMThreadPointer threadCursor = vm.mainThread();
do {
out.append(String.format(" !j9vmthread 0x%s publicFlags=%s privateFlags=%s // %s", Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.publicFlags().longValue()), Long.toHexString(threadCursor.privateFlags().longValue()), getThreadName(threadCursor)));
out.append(nl);
threadCursor = threadCursor.linkNext();
} while (!threadCursor.eq(mainThread));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations