use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class JitMetadataFromPcCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
UDATA searchValue = new UDATA(Long.decode(args[0]));
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9JITExceptionTablePointer metaData = JITLook.jit_artifact_search(vm.jitConfig().translationArtifacts(), searchValue);
if (!metaData.isNull()) {
dbgext_j9jitexceptiontable(out, metaData);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class ObjectRefsCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (args.length < 1) {
throw new DDRInteractiveCommandException("This debug extension takes an address argument \" !objectrefs <address> [ heapWalk ] [ rootWalk ]\"");
}
long addr = Long.decode(args[0]);
J9ObjectPointer targetObject = J9ObjectPointer.cast(addr);
boolean dumpHeap = false;
boolean dumpRoots = false;
if (1 == args.length) {
dumpHeap = true;
dumpRoots = true;
} else {
for (int i = 1; i < args.length; i++) {
if ("heapWalk".equals(args[i])) {
dumpHeap = true;
} else if ("rootWalk".equals(args[i])) {
dumpRoots = true;
}
}
}
if (dumpHeap) {
try {
dumpHeapReferences(vm, targetObject, out);
} catch (CorruptDataException cde) {
cde.printStackTrace();
}
}
if (dumpRoots) {
try {
dumpLiveReferences(vm, targetObject, out);
} catch (CorruptDataException cde) {
cde.printStackTrace();
}
}
} catch (DDRInteractiveCommandException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace(out);
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class RootPathCommand method run.
public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
switch(args.length) {
case 0:
if (args.length == 0) {
if (command.equals("!rootpathverbose")) {
out.println("verbose output enabled for rootpath command. run !rootpathnoverbose to disable verbose output");
_verboseEnabled = true;
} else if (command.equals("!rootpathnoverbose")) {
out.println("verbose output disabled for rootpath command. run !rootpathverbose to enable verbose output");
_verboseEnabled = false;
} else {
throw new UnsupportedOperationException("Unrecognized command passed to RoothPathCommand");
}
}
break;
case 1:
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
final J9ObjectPointer objectToFind = J9ObjectPointer.cast(address);
try {
J9ClassPointer clazz = J9ObjectHelper.clazz(objectToFind);
if (!J9ClassHelper.hasValidEyeCatcher(clazz)) {
throw new DDRInteractiveCommandException("object class is not valid (eyecatcher is not 0x99669966)");
}
} catch (CorruptDataException cde) {
throw new DDRInteractiveCommandException("memory fault de-referencing address argument", cde);
}
try {
/* Create a custom event listener so that CorruptDataExceptions that are found
* while iterating through the live set aren't all printed to the output stream
*/
RootPathCommandListener listener = new RootPathCommandListener();
EventManager.register(listener);
if (command.equals("!rootpathfindall") || command.equals("!strongrootpathfindall")) {
LiveSetWalker.walkLiveSet(new RootPathsFinder(objectToFind, out), RootSetType.STRONG_REACHABLE);
} else if (command.equals("!anyrootpathfindall")) {
LiveSetWalker.walkLiveSet(new RootPathsFinder(objectToFind, out), RootSetType.ALL);
} else if (command.equals("!weakrootpathfindall")) {
LiveSetWalker.walkLiveSet(new RootPathsFinder(objectToFind, out), RootSetType.WEAK_REACHABLE);
} else if (command.equals("!rootpathfind") || command.equals("!strongrootpathfind")) {
RootPathFinder pathFinder = new RootPathFinder(objectToFind, out);
LiveSetWalker.walkLiveSet(pathFinder, RootSetType.STRONG_REACHABLE);
if (!pathFinder._pathFound) {
out.println("No paths from roots found");
}
} else if (command.equals("!anyrootpathfind")) {
RootPathFinder pathFinder = new RootPathFinder(objectToFind, out);
LiveSetWalker.walkLiveSet(pathFinder, RootSetType.ALL);
if (!pathFinder._pathFound) {
out.println("No paths from roots found");
}
} else if (command.equals("!weakrootpathfindall")) {
RootPathFinder pathFinder = new RootPathFinder(objectToFind, out);
LiveSetWalker.walkLiveSet(pathFinder, RootSetType.WEAK_REACHABLE);
if (!pathFinder._pathFound) {
out.println("No paths from roots found");
}
} else if (command.equals("!isobjectalive")) {
ObjectFinderVisitor objectFinder = new ObjectFinderVisitor(objectToFind);
LiveSetWalker.walkLiveSet(objectFinder);
if (objectFinder._objectFound) {
out.println("Object is live");
} else {
out.println("Object is not live");
}
}
if (listener._corruptionFound) {
out.println("Corruption detected walking live set");
if (!_verboseEnabled) {
out.println("run !rootpathverbose and re-run command to see corruptions");
}
}
EventManager.unregister(listener);
} catch (CorruptDataException cde) {
throw new DDRInteractiveCommandException("Memory fault while walking live set", cde);
}
break;
default:
throw new DDRInteractiveCommandException("Invalid number of arguments");
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class MarkMapCommand method findSource.
protected void findSource(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
J9ObjectPointer object = J9ObjectPointer.cast(address);
J9ObjectPointer scanPtr = J9ObjectPointer.cast(markMap.getHeapBase());
J9ObjectPointer heapTop = J9ObjectPointer.cast(markMap.getHeapTop());
if (object.gte(scanPtr) && object.lt(heapTop)) {
int count = 0;
while (scanPtr.lt(heapTop)) {
J9ObjectPointer base = scanPtr;
J9ObjectPointer top = base.addOffset(markMap.getPageSize(scanPtr));
MarkedObject[] results = markMap.queryRange(base, top);
for (int i = 0; i < results.length; i++) {
MarkedObject result = results[i];
if (result.wasRelocated()) {
if (result.relocatedObject.eq(object)) {
// A match!
out.format("Object %s was relocated to %s\n", result.object.getHexAddress(), result.relocatedObject.getHexAddress());
count += 1;
}
}
}
scanPtr = top;
}
if (count > 0) {
out.format("%1 relocation candidates found\n", count);
} else {
out.format("No relocation candidates found\n");
}
} else {
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 showMarkMap.
protected void showMarkMap(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
showActiveMarkMap(out);
try {
out.format("\nKnown mark maps:\n");
MM_GCExtensionsPointer extensions = GCExtensions.getGCExtensionsPointer();
if (GCExtensions.isStandardGC()) {
MM_ParallelGlobalGCPointer pgc = MM_ParallelGlobalGCPointer.cast(extensions._globalCollector());
MM_MarkMapPointer markMap = pgc._markingScheme()._markMap();
out.format("\tactive: %s\n", markMap.getHexAddress());
} else if (GCExtensions.isVLHGC()) {
// probably needs a proper subclass
MM_IncrementalGenerationalGCPointer igc = MM_IncrementalGenerationalGCPointer.cast(extensions._globalCollector());
out.format("\tprevious: %s\n", igc._markMapManager()._previousMarkMap().getHexAddress());
out.format("\tnext: %s\n", igc._markMapManager()._nextMarkMap().getHexAddress());
} else if (GCExtensions.isMetronomeGC()) {
MM_HeapMapPointer markMap = extensions.realtimeGC()._markingScheme()._markMap();
out.format("\tactive: %s\n", markMap.getHexAddress());
} else {
out.format("\tUnrecognized GC policy!\n");
}
try {
if (extensions.referenceChainWalkerMarkMap().notNull()) {
out.format("\treference chain walker: %s\n", extensions.referenceChainWalkerMarkMap().getHexAddress());
}
} catch (NoSuchFieldError nsf) {
// guess we don't have one
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations