Search in sources :

Example 1 with IMemorySource

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

the class AIXDumpReader method readCore.

protected void readCore() throws IOException {
    // Note that this structure is core_dumpx defined in
    // "/usr/include/sys/core.h"
    seek(0);
    // Ignore signalNumber
    readByte();
    // CORE_TRUNC == 0x80
    byte flags = readByte();
    if ((flags & 0x80) != 0) {
        _isTruncated = true;
    }
    // Ignore entryCount
    readShort();
    // Ignore version (core file format number)
    readInt();
    // Ignore fdsinfox
    readLong();
    _loaderOffset = readLong();
    _loaderSize = readLong();
    _threadCount = readInt();
    // Ignore padding
    readInt();
    _threadOffset = readLong();
    long segmentCount = readLong();
    long segmentOffset = readLong();
    // Stack - this appears to be special handling for the main thread first
    // attached to the address space
    // (this is helpful for us since that is how we can find command line
    // and env vars)
    long stackOffset = readLong();
    long stackVirtualAddress = readLong();
    long stackSize = readLong();
    _structTopOfStackVirtualAddress = stackVirtualAddress + stackSize - sizeofTopOfStack();
    IMemorySource memoryRange1 = new DumpMemorySource(stackVirtualAddress, stackSize, stackOffset, 0, this, "stack", false, false, false);
    addMemorySource(memoryRange1);
    // User data
    long dataOffset = readLong();
    long dataVirtualAddress = readLong();
    long dataSize = readLong();
    IMemorySource memoryRange = new DumpMemorySource(dataVirtualAddress, dataSize, dataOffset, this);
    addMemorySource(memoryRange);
    // Ignore sdataVirtualAddress
    readLong();
    // Ignore sdataSize
    readLong();
    long vmRegionCount = readLong();
    long vmRegionOffset = readLong();
    _implementation = readInt();
    // Ignore padding
    readInt();
    // Ignore checkpointRestartOffset
    readLong();
    // Ignore unsigned long long c_extctx; (Extended Context
    readLong();
    // Table offset)
    // Ignore padding (6 longs)
    readBytes(6 * 8);
    // ignore struct thrdctx c_flt; (faulting thread's context) //this is
    // resolved later via that constant "FAULTING_THREAD_OFFSET"
    // ignore struct userx c_u; (copy of the user structure)
    // >> end of core_dumpx structure
    readVMRegions(vmRegionOffset, vmRegionCount);
    readSegments(segmentOffset, segmentCount);
    readLoaderInfoAsMemoryRanges();
    readModules();
    _isTruncated |= checkHighestOffset();
    createProperties();
}
Also used : DumpMemorySource(com.ibm.j9ddr.corereaders.memory.DumpMemorySource) IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource)

Example 2 with IMemorySource

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

the class AIXDumpReader method readLoaderInfoAsMemoryRanges.

private void readLoaderInfoAsMemoryRanges() throws IOException {
    int next = 0;
    long current = _loaderOffset;
    do {
        current += next;
        seek(current);
        next = readInt();
        // Ignore flags
        readLoaderInfoFlags();
        long dataOffset = readAddress();
        // Ignore textOrigin
        readAddress();
        // Ignore textSize
        readAddress();
        long dataVirtualAddress = readAddress();
        long dataSize = readAddress();
        if (0 != dataOffset) {
            IMemorySource memoryRange = new DumpMemorySource(dataVirtualAddress, dataSize, dataOffset, this);
            // memoryRange.setDescription(name + " " +
            // Long.toHexString(textOrigin) + "-" +
            // Long.toHexString(textOrigin + textSize));
            addMemorySource(memoryRange);
        }
    } while (0 != next && current + next < _loaderOffset + _loaderSize);
}
Also used : DumpMemorySource(com.ibm.j9ddr.corereaders.memory.DumpMemorySource) IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource)

Example 3 with IMemorySource

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

the class AIXDumpReader method readSegments.

private void readSegments(long offset, long count) throws IOException {
    seek(offset);
    for (int i = 0; i < count; i++) {
        long address = readLong();
        long size = readLong();
        long off = readLong();
        // Ignore segmentFlags
        readInt();
        // Ignore padding
        readInt();
        // Anonymously mapped area
        IMemorySource memoryRange = new DumpMemorySource(address, size, off, 0, this, "anon segment");
        addMemorySource(memoryRange);
    }
}
Also used : DumpMemorySource(com.ibm.j9ddr.corereaders.memory.DumpMemorySource) IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource)

Example 4 with IMemorySource

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

the class AIXDumpReader method readVMRegions.

private void readVMRegions(long offset, long count) throws IOException {
    seek(offset);
    for (int i = 0; i < count; i++) {
        long address = readLong();
        long size = readLong();
        long off = readLong();
        // Anonymously mapped area
        IMemorySource memoryRange = new DumpMemorySource(address, size, off, 0, this, "anon vm region");
        // memoryRange.setDescription("anon vm region");
        addMemorySource(memoryRange);
    }
}
Also used : DumpMemorySource(com.ibm.j9ddr.corereaders.memory.DumpMemorySource) IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource)

Example 5 with IMemorySource

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

the class AIXDumpReader method executablePathHint.

// Passback of executable path. If we couldn't load the executable the first time, try again now.
public void executablePathHint(String path) {
    if (_executable instanceof MissingFileModule) {
        // Check the hint points at the same file name
        try {
            if (!getFileName(_executable.getName()).equals(getFileName(path))) {
                return;
            }
        } catch (CorruptDataException e1) {
            return;
        }
        // Remove placeholder memory source
        _process.removeMemorySource(_executableTextSection);
        // Remember the current placeholder in case this one fails too
        IModule currentExecutable = _executable;
        IMemorySource currentExecutableTextSection = _executableTextSection;
        ILibraryResolver resolver = LibraryResolverFactory.getResolverForCoreFile(this.coreFile);
        IProcess proc = getProcess();
        try {
            seek(_loaderOffset);
            readInt();
            // Ignore flags
            readLoaderInfoFlags();
            // Ignore dataOffset
            readAddress();
            long textVirtualAddress = readAddress();
            long textSize = readAddress();
            long dataVirtualAddress = readAddress();
            long dataSize = readAddress();
            // Disregard fileName from core
            readString();
            String fileName = path;
            String objectName = readString();
            String moduleName = fileName;
            if (0 < objectName.length()) {
                moduleName += "(" + objectName + ")";
            }
            loadModule(resolver, proc, textVirtualAddress, textSize, dataVirtualAddress, dataSize, fileName, objectName, moduleName, true);
        } catch (IOException e) {
        // TODO handle
        }
        // If the executable is still a MissingFileModule, the hint didn't work
        if (_executable instanceof MissingFileModule) {
            _process.removeMemorySource(_executableTextSection);
            _executableTextSection = currentExecutableTextSection;
            _process.addMemorySource(_executableTextSection);
            _executable = currentExecutable;
        }
    }
}
Also used : IMemorySource(com.ibm.j9ddr.corereaders.memory.IMemorySource) IModule(com.ibm.j9ddr.corereaders.memory.IModule) ILibraryResolver(com.ibm.j9ddr.corereaders.ILibraryResolver) CorruptDataException(com.ibm.j9ddr.CorruptDataException) IOException(java.io.IOException) IProcess(com.ibm.j9ddr.corereaders.memory.IProcess) MissingFileModule(com.ibm.j9ddr.corereaders.memory.MissingFileModule)

Aggregations

IMemorySource (com.ibm.j9ddr.corereaders.memory.IMemorySource)10 DumpMemorySource (com.ibm.j9ddr.corereaders.memory.DumpMemorySource)6 ArrayList (java.util.ArrayList)4 CorruptDataException (com.ibm.j9ddr.CorruptDataException)3 IModule (com.ibm.j9ddr.corereaders.memory.IModule)3 MissingFileModule (com.ibm.j9ddr.corereaders.memory.MissingFileModule)3 UnbackedMemorySource (com.ibm.j9ddr.corereaders.memory.UnbackedMemorySource)3 IOException (java.io.IOException)3 Properties (java.util.Properties)3 IMemoryRange (com.ibm.j9ddr.corereaders.memory.IMemoryRange)2 Module (com.ibm.j9ddr.corereaders.memory.Module)2 ILibraryResolver (com.ibm.j9ddr.corereaders.ILibraryResolver)1 IModuleFile (com.ibm.j9ddr.corereaders.IModuleFile)1 InvalidDumpFormatException (com.ibm.j9ddr.corereaders.InvalidDumpFormatException)1 LibraryDataSource (com.ibm.j9ddr.corereaders.LibraryDataSource)1 DetailedDumpMemorySource (com.ibm.j9ddr.corereaders.memory.DetailedDumpMemorySource)1 IDetailedMemoryRange (com.ibm.j9ddr.corereaders.memory.IDetailedMemoryRange)1 IProcess (com.ibm.j9ddr.corereaders.memory.IProcess)1 MemoryFault (com.ibm.j9ddr.corereaders.memory.MemoryFault)1 MemoryRange (com.ibm.j9ddr.corereaders.memory.MemoryRange)1