use of com.ibm.j9ddr.corereaders.ICore in project openj9 by eclipse.
the class VMDataFactory method getBlobBasedirInArchive.
private static String getBlobBasedirInArchive(IProcess process) throws IOException {
ICore core = process.getAddressSpace().getCore();
Platform platform = core.getPlatform();
int bytesPerPointer = process.bytesPerPointer();
switch(platform) {
case AIX:
if (bytesPerPointer == 4) {
return "aix/ppc-32/";
} else {
return "aix/ppc-64/";
}
// break;
case LINUX:
String processorType = core.getProperties().getProperty(ICore.PROCESSOR_TYPE_PROPERTY);
// determine platform by processorType
if (bytesPerPointer == 4) {
if (processorType.equals("x86")) {
return "linux/ia32/";
} else if (processorType.equals("ppc")) {
return "linux/ppc-32/";
} else if (processorType.equals("s390")) {
return "linux/s390-31/";
}
} else {
if (processorType.equals("amd64")) {
return "linux/amd64/";
} else if (processorType.equals("ppc")) {
return "linux/ppc-64/";
} else if (processorType.equals("s390")) {
return "linux/s390-64/";
}
}
throw new UnknownArchitectureException(process, "Could not determine architecture for Linux core file.");
case WINDOWS:
if (bytesPerPointer == 4) {
return "win/ia32/";
} else {
return "win/amd64/";
}
// break;
case ZOS:
if (bytesPerPointer == 4) {
return "zos/s390-31/";
} else {
return "zos/s390-64/";
}
}
// shouldn't be here
throw new UnknownArchitectureException(process, "Could not determine platform of core file.");
}
use of com.ibm.j9ddr.corereaders.ICore in project openj9 by eclipse.
the class J9DDRImageFactory method getImage.
public Image getImage(File core) throws IOException {
J9DDRImage cachedImage = imageMap.get(core.getAbsoluteFile());
if (cachedImage != null) {
if (!cachedImage.isClosed()) {
/*
* Only return the cached Image if it has not been closed. If it has
* allow a new one to be created which will then be cached replacing this
* closed entry.
*/
return cachedImage;
}
}
// Divert the core readers logging to the ddr logger.
Logger coreLogger = Logger.getLogger(com.ibm.j9ddr.corereaders.ICoreFileReader.J9DDR_CORE_READERS_LOGGER_NAME);
Logger ddrLogger = Logger.getLogger(LOGGER_VIEW_DTFJ);
coreLogger.setParent(ddrLogger);
if (ddrLogger.getLevel() == null && coreLogger.getLevel() == null) {
// This blocks warning or below messages from the core readers
// unless logging has been manually configured via a properties
// file.
// To re-enable logging just from the core readers set:
// j9ddr.core_readers.level = <level>
// in a logging.properties file.
coreLogger.setLevel(Level.SEVERE);
}
ICore reader = CoreReader.readCoreFile(core.getPath());
if (reader == null) {
return null;
}
cachedImage = new J9DDRImage(core.toURI(), reader, null);
imageMap.put(core.getAbsoluteFile(), cachedImage);
return cachedImage;
}
use of com.ibm.j9ddr.corereaders.ICore in project openj9 by eclipse.
the class J9DDRImageFactory method getImage.
public Image getImage(ImageInputStream in, ImageInputStream meta, URI sourceID) throws IOException {
// Divert the core readers logging to the ddr logger.
Logger coreLogger = Logger.getLogger(com.ibm.j9ddr.corereaders.ICoreFileReader.J9DDR_CORE_READERS_LOGGER_NAME);
Logger ddrLogger = Logger.getLogger(LOGGER_VIEW_DTFJ);
coreLogger.setParent(ddrLogger);
if (ddrLogger.getLevel() == null && coreLogger.getLevel() == null) {
// This blocks warning or below messages from the core readers
// unless logging has been manually configured via a properties
// file.
// To re-enable logging just from the core readers set:
// j9ddr.core_readers.level = <level>
// in a logging.properties file.
coreLogger.setLevel(Level.SEVERE);
}
ICore reader = CoreReader.readCoreFile(in);
if (reader == null) {
return null;
}
return new J9DDRImage(sourceID, reader, meta);
}
use of com.ibm.j9ddr.corereaders.ICore in project openj9 by eclipse.
the class VMRegMapHelper method printRegisters.
/**
* This method find out which platform core file is generated
* and calls the method that prints that specific platforms registers.
* @param vm J9JavaVMPointer instance of vm from core file.
* @param level Level of registers to be printed.
* @param out PrintStream to print the output to the console.
* @throws UnknownArchitectureException In the case of unidentified platform of core file.
*/
public static void printRegisters(J9JavaVMPointer vm, int level, PrintStream out) throws UnknownArchitectureException {
IProcess process = vm.getProcess();
ICore core = process.getAddressSpace().getCore();
Platform platform = core.getPlatform();
boolean is64BitPlatform = (process.bytesPerPointer() == 8) ? true : false;
switch(platform) {
case AIX:
if (is64BitPlatform) {
printRegistersForAIX64BitPPC(level, out);
} else {
printRegistersForAIX32BitPPC(level, out);
}
break;
case LINUX:
String processorType = core.getProperties().getProperty(ICore.PROCESSOR_TYPE_PROPERTY);
if (is64BitPlatform) {
if (processorType.equals("amd64")) {
printRegistersForLinux64BitAMD64(level, out);
} else if (processorType.equals("ppc")) {
printRegistersForLinux64BitPPC(level, out);
} else if (processorType.equals("s390")) {
printRegistersForLinux64BitS390(level, out);
}
} else {
if (processorType.equals("x86")) {
printRegistersForLinux32BitX86(level, out);
} else if (processorType.equals("ppc")) {
printRegistersForLinux32BitPPC(level, out);
} else if (processorType.equals("s390")) {
printRegistersForLinux32BitS390(level, out);
}
}
break;
case WINDOWS:
if (is64BitPlatform) {
printRegistersForWindows64Bit(level, out);
} else {
printRegistersForWindows32Bit(level, out);
}
break;
case ZOS:
if (is64BitPlatform) {
printRegistersForZOS64BitS390(level, out);
} else {
printRegistersForZOS32BitS390(level, out);
}
break;
default:
throw new UnknownArchitectureException(process, "Could not determine platform of core file.");
}
}
use of com.ibm.j9ddr.corereaders.ICore in project openj9 by eclipse.
the class DDRTestLauncher method main.
public static void main(String[] args) throws Exception {
// This code would be located in the DTFJ ImageFactory
String testName = args[0];
String coreFileName = args[1];
List<String> remainingArguments = new LinkedList<String>();
for (int i = 2; i < args.length; i++) {
remainingArguments.add(args[i]);
}
ICore core = CoreReader.readCoreFile(coreFileName);
List<IAddressSpace> addressSpaces = new ArrayList<IAddressSpace>(core.getAddressSpaces());
IVMData aVMData = VMDataFactory.getVMData(addressSpaces.get(0).getProcesses().iterator().next());
aVMData.bootstrap(testName, remainingArguments);
}
Aggregations