Search in sources :

Example 1 with UnknownArchitectureException

use of com.ibm.j9ddr.exceptions.UnknownArchitectureException in project openj9 by eclipse.

the class J9RegCommand method run.

/**
 * Run method for !j9reg extension.
 *
 * @param command  !j9reg
 * @param args	args passed by !j9reg extension.
 * @param context Context of current core file.
 * @param out PrintStream to print the output to the console.
 * @throws DDRInteractiveCommandException
 */
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    int level = 0;
    if (0 == args.length) {
        level = 1;
    } else if (1 == args.length) {
        try {
            level = Integer.parseInt(args[0]);
        } catch (NumberFormatException e) {
            out.println(args[0] + " is not a valid integer. Please try again.");
            return;
        }
    } else {
        printUsage(out);
    }
    J9JavaVMPointer vm;
    try {
        vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        VMRegMapHelper.printRegisters(vm, level, out);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException("Failed to get vm address from RAS");
    } catch (UnknownArchitectureException uae) {
        throw new DDRInteractiveCommandException(uae.getMessage(), uae);
    }
}
Also used : UnknownArchitectureException(com.ibm.j9ddr.exceptions.UnknownArchitectureException) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 2 with UnknownArchitectureException

use of com.ibm.j9ddr.exceptions.UnknownArchitectureException 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 3 with UnknownArchitectureException

use of com.ibm.j9ddr.exceptions.UnknownArchitectureException 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)

Aggregations

UnknownArchitectureException (com.ibm.j9ddr.exceptions.UnknownArchitectureException)3 ICore (com.ibm.j9ddr.corereaders.ICore)2 Platform (com.ibm.j9ddr.corereaders.Platform)2 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 IProcess (com.ibm.j9ddr.corereaders.memory.IProcess)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)1