use of com.ibm.jvm.dtfjview.JdmpviewContextManager in project openj9 by eclipse.
the class OpenCommand method createCombinedContext.
private void createCombinedContext(final Image loadedImage, final int major, final int minor, final ImageAddressSpace space, final ImageProcess proc, final JavaRuntime rt, String coreFilePath) {
// take the DTFJ context and attempt to combine it with a DDR interactive one
Object obj = ctx.getProperties().get(SessionProperties.SESSION_PROPERTY);
if (obj == null) {
logger.fine("Could not create a new context as the session property has not been set");
return;
}
if (!(obj instanceof Session)) {
logger.fine("Could not create a new context as the session type was not recognised [" + obj.getClass().getName() + "]");
return;
}
JdmpviewContextManager mgr = (JdmpviewContextManager) ((ISession) obj).getContextManager();
CombinedContext cc = (CombinedContext) mgr.createContext(loadedImage, major, minor, space, proc, rt);
cc.startDDRInteractiveSession(loadedImage, out);
cc.getProperties().put(CORE_FILE_PATH_PROPERTY, coreFilePath);
cc.getProperties().put(IMAGE_FACTORY_PROPERTY, getFactory());
if (ctx.hasPropertyBeenSet(VERBOSE_MODE_PROPERTY)) {
cc.getProperties().put(VERBOSE_MODE_PROPERTY, "true");
}
try {
// flag to indicate if native libs are required but not present
boolean hasLibError = true;
String os = cc.getImage().getSystemType().toLowerCase();
if (os.contains("linux") || (os.contains("aix"))) {
if (cc.getProcess() != null) {
Iterator<?> modules = cc.getProcess().getLibraries();
if (modules.hasNext()) {
obj = modules.next();
if (obj instanceof ImageModule) {
// there is at least one native lib available
hasLibError = false;
}
}
}
} else {
hasLibError = false;
}
if (hasLibError) {
out.println("Warning : native libraries are not available for " + coreFilePath);
}
} catch (DataUnavailable e) {
logger.log(Level.FINE, "Warning : native libraries are not available for " + coreFilePath);
} catch (Exception e) {
logger.log(Level.FINE, "Error determining if native libraries are required for " + coreFilePath, e);
}
}
Aggregations