use of com.ibm.j9ddr.view.dtfj.image.J9DDRImageAddressSpace in project openj9 by eclipse.
the class DDRInteractive method addDDRContextFromDTFJ.
private void addDDRContextFromDTFJ(Object dtfjctx) throws Exception {
Method getAddressSpace = findMethod(dtfjctx.getClass(), "getAddressSpace", (Class<?>[]) null);
Method getProcess = findMethod(dtfjctx.getClass(), "getProcess", (Class<?>[]) null);
Method getRuntime = findMethod(dtfjctx.getClass(), "getRuntime", (Class<?>[]) null);
Object addressSpace = getAddressSpace.invoke(dtfjctx, (Object[]) null);
Object process = getProcess.invoke(dtfjctx, (Object[]) null);
Object runtime = getRuntime.invoke(dtfjctx, (Object[]) null);
if (addressSpace == null) {
throw new IOException("Cannot create a context without an associated address space");
}
if (!(addressSpace instanceof J9DDRImageAddressSpace)) {
throw new UnsupportedOperationException("The supplied DTFJ context is not backed by a DDR implementation");
}
IAddressSpace space = ((J9DDRImageAddressSpace) addressSpace).getIAddressSpace();
IProcess proc = null;
if (process != null) {
proc = ((J9DDRImageProcess) process).getIProcess();
}
if (proc == null) {
ASNoProcess as = new ASNoProcess(space);
addMissingJVMToContexts(as);
return;
}
if (runtime == null) {
addMissingJVMToContexts(proc);
return;
}
// DDR will cache the VM data, so if the DTFJ context has already found it then this should be in the cache
IVMData vmData = VMDataFactory.getVMData(proc);
if (vmData != null) {
contexts.add(new Context(proc, vmData, nonVMCommands));
} else {
addMissingJVMToContexts(proc);
}
}
Aggregations