Search in sources :

Example 6 with ICore

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.");
}
Also used : UnknownArchitectureException(com.ibm.j9ddr.exceptions.UnknownArchitectureException) Platform(com.ibm.j9ddr.corereaders.Platform) ICore(com.ibm.j9ddr.corereaders.ICore)

Example 7 with ICore

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;
}
Also used : Logger(java.util.logging.Logger) ICore(com.ibm.j9ddr.corereaders.ICore)

Example 8 with ICore

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);
}
Also used : Logger(java.util.logging.Logger) ICore(com.ibm.j9ddr.corereaders.ICore)

Example 9 with ICore

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.");
    }
}
Also used : UnknownArchitectureException(com.ibm.j9ddr.exceptions.UnknownArchitectureException) Platform(com.ibm.j9ddr.corereaders.Platform) ICore(com.ibm.j9ddr.corereaders.ICore) IProcess(com.ibm.j9ddr.corereaders.memory.IProcess)

Example 10 with ICore

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);
}
Also used : IAddressSpace(com.ibm.j9ddr.corereaders.memory.IAddressSpace) ArrayList(java.util.ArrayList) ICore(com.ibm.j9ddr.corereaders.ICore) LinkedList(java.util.LinkedList) IVMData(com.ibm.j9ddr.IVMData)

Aggregations

ICore (com.ibm.j9ddr.corereaders.ICore)10 Platform (com.ibm.j9ddr.corereaders.Platform)3 IAddressSpace (com.ibm.j9ddr.corereaders.memory.IAddressSpace)3 IProcess (com.ibm.j9ddr.corereaders.memory.IProcess)3 ArrayList (java.util.ArrayList)3 CorruptDataException (com.ibm.j9ddr.CorruptDataException)2 UnknownArchitectureException (com.ibm.j9ddr.exceptions.UnknownArchitectureException)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9DDRImageProcess (com.ibm.j9ddr.view.dtfj.image.J9DDRImageProcess)2 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 Logger (java.util.logging.Logger)2 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)1 ImageModule (com.ibm.dtfj.image.ImageModule)1 IVMData (com.ibm.j9ddr.IVMData)1 ILibraryDependentCore (com.ibm.j9ddr.corereaders.ILibraryDependentCore)1 IMemoryRange (com.ibm.j9ddr.corereaders.memory.IMemoryRange)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1 J9RASPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RASPointer)1 FileNotFoundException (java.io.FileNotFoundException)1