Search in sources :

Example 16 with IProcess

use of com.ibm.j9ddr.corereaders.memory.IProcess in project openj9 by eclipse.

the class AIXDumpReader method readModules.

// 
// // NOTE modules must be read before thread information in order to
// properly support stack traces.
// // Thread information is required before building the process, so the
// following order must be maintained:
// // 1) Read module information.
// // 2) Read thread information.
// // 3) Build process.
// List<J9DDRImageModule> modules = getModules(addressSpace);
// J9DDRImageModule executable = null;
// if (!modules.isEmpty()) {
// executable = modules.get(0);
// }
// List<J9DDRImageThread> threads = readThreads(addressSpace);
// //the current thread is parsed before the rest so it is put first
// J9DDRImageThread currentThread = threads.get(0);
// 
// // Get the process environment variables
// Properties environment = new Properties();
// //on AIX, we should truse the env var pointer found in the core and
// ignore whatever the XML told us it is since this internal value is more
// likely correct
// environment = getEnvironmentVariables(reg5);
// 
// J9DDRImageProcess process = new J9DDRImageProcess(String.valueOf(pid),
// commandLine, environment, currentThread, threads, executable, modules,
// pointerSize());
// process.setAddressSpace(addressSpace);
// process.setMemory(getMemory());
// return process;
// }
private void readModules() throws IOException {
    int next = 0;
    long current = _loaderOffset;
    if (coreFile == null) {
        resolver = LibraryResolverFactory.getResolverForCoreFile(_fileReader);
    } else {
        resolver = LibraryResolverFactory.getResolverForCoreFile(coreFile);
    }
    IProcess proc = getProcess();
    boolean firstModule = true;
    do {
        current += next;
        seek(current);
        next = readInt();
        // Ignore flags
        readLoaderInfoFlags();
        // Ignore dataOffset
        readAddress();
        long textVirtualAddress = readAddress();
        long textSize = readAddress();
        long dataVirtualAddress = readAddress();
        long dataSize = readAddress();
        String fileName = readString();
        String objectName = readString();
        String moduleName = fileName;
        if (0 < objectName.length()) {
            moduleName += "(" + objectName + ")";
        }
        loadModule(resolver, proc, textVirtualAddress, textSize, dataVirtualAddress, dataSize, fileName, objectName, moduleName, firstModule);
        firstModule = false;
    } while (0 != next && current + next < _loaderOffset + _loaderSize);
}
Also used : IProcess(com.ibm.j9ddr.corereaders.memory.IProcess)

Example 17 with IProcess

use of com.ibm.j9ddr.corereaders.memory.IProcess in project openj9 by eclipse.

the class MemoryRangesCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    IProcess process = context.process;
    String format = "0x%0" + (process.bytesPerPointer() * 2) + "x%" + (16 - process.bytesPerPointer()) + "s";
    Collection<? extends IMemoryRange> ranges = process.getMemoryRanges();
    if (ranges != null && !ranges.isEmpty()) {
        out.println("Base                  Top                   Size");
        for (IMemoryRange range : ranges) {
            out.print(String.format(format, range.getBaseAddress(), " "));
            out.print(String.format(format, range.getTopAddress(), " "));
            out.print(String.format(format, range.getSize(), " "));
            out.print("\n");
        }
    } else {
        out.println("No memory ranges found (Note: this has not yet been implemented for execution from a native debugger such as gdb)");
    }
}
Also used : IMemoryRange(com.ibm.j9ddr.corereaders.memory.IMemoryRange) IProcess(com.ibm.j9ddr.corereaders.memory.IProcess)

Example 18 with IProcess

use of com.ibm.j9ddr.corereaders.memory.IProcess 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

IProcess (com.ibm.j9ddr.corereaders.memory.IProcess)18 IOException (java.io.IOException)6 CorruptDataException (com.ibm.j9ddr.CorruptDataException)5 IAddressSpace (com.ibm.j9ddr.corereaders.memory.IAddressSpace)4 ICore (com.ibm.j9ddr.corereaders.ICore)3 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)2 IVMData (com.ibm.j9ddr.IVMData)2 Platform (com.ibm.j9ddr.corereaders.Platform)2 IMemoryRange (com.ibm.j9ddr.corereaders.memory.IMemoryRange)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9DDRImageProcess (com.ibm.j9ddr.view.dtfj.image.J9DDRImageProcess)2 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)2 J9RASPointer (com.ibm.j9ddr.vm29.pointer.generated.J9RASPointer)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 ImageSection (com.ibm.dtfj.image.ImageSection)1 ILibraryResolver (com.ibm.j9ddr.corereaders.ILibraryResolver)1 IMemorySource (com.ibm.j9ddr.corereaders.memory.IMemorySource)1 IModule (com.ibm.j9ddr.corereaders.memory.IModule)1