Search in sources :

Example 1 with IBlobFactory

use of com.ibm.j9ddr.blobs.IBlobFactory in project openj9 by eclipse.

the class VMDataFactory method getBlobFromLibrary.

/**
 * Try and determine a blob by scanning the process.
 * This can be very expensive and should be the last option tried.
 *
 * @param process process to scan
 * @return a blob if one can be identified, null if not
 */
private static ImageInputStream getBlobFromLibrary(IProcess process, StructureHeader header) throws JVMNotFoundException {
    try {
        if (header != null) {
            IBlobFactory factory = BlobFactory.getInstance();
            Platforms platform = null;
            switch(process.getPlatform()) {
                case LINUX:
                    platform = (process.bytesPerPointer() == 4) ? Platforms.xi32 : Platforms.xa64;
                    break;
                default:
                    break;
            }
            if (platform != null) {
                int[] data = header.getBlobVersionArray();
                return factory.getBlob(platform, header.getPackageID(), data[2], data[1], data[0]);
            }
        }
        return null;
    } catch (Exception e) {
        throw new JVMNotFoundException(process, e);
    }
}
Also used : JVMNotFoundException(com.ibm.j9ddr.exceptions.JVMNotFoundException) Platforms(com.ibm.j9ddr.blobs.IBlobFactory.Platforms) IBlobFactory(com.ibm.j9ddr.blobs.IBlobFactory) JVMNotFoundException(com.ibm.j9ddr.exceptions.JVMNotFoundException) CorruptStructuresException(com.ibm.j9ddr.exceptions.CorruptStructuresException) UnknownArchitectureException(com.ibm.j9ddr.exceptions.UnknownArchitectureException) IOException(java.io.IOException) JVMNotDDREnabledException(com.ibm.j9ddr.exceptions.JVMNotDDREnabledException) FileNotFoundException(java.io.FileNotFoundException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MissingDDRStructuresException(com.ibm.j9ddr.exceptions.MissingDDRStructuresException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

IBlobFactory (com.ibm.j9ddr.blobs.IBlobFactory)1 Platforms (com.ibm.j9ddr.blobs.IBlobFactory.Platforms)1 CorruptStructuresException (com.ibm.j9ddr.exceptions.CorruptStructuresException)1 JVMNotDDREnabledException (com.ibm.j9ddr.exceptions.JVMNotDDREnabledException)1 JVMNotFoundException (com.ibm.j9ddr.exceptions.JVMNotFoundException)1 MissingDDRStructuresException (com.ibm.j9ddr.exceptions.MissingDDRStructuresException)1 UnknownArchitectureException (com.ibm.j9ddr.exceptions.UnknownArchitectureException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1