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();
}
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);
}
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);
}
}
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);
}
}
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;
}
}
}
Aggregations