use of com.ibm.j9ddr.corereaders.memory.IMemoryRange in project openj9 by eclipse.
the class J9DDRImageThread method getStackSections.
/* (non-Javadoc)
* @see com.ibm.dtfj.image.ImageThread#getStackSections()
*/
public Iterator<?> getStackSections() {
Collection<? extends IMemoryRange> ranges = thread.getMemoryRanges();
List<ImageSection> sections = new ArrayList<ImageSection>(ranges.size());
for (IMemoryRange range : ranges) {
sections.add(new J9DDRImageSection(process, range.getBaseAddress(), range.getSize(), "stack section at " + Long.toHexString(range.getBaseAddress())));
}
return sections.iterator();
}
use of com.ibm.j9ddr.corereaders.memory.IMemoryRange in project openj9 by eclipse.
the class J9DDRImageModule method getSections.
/* (non-Javadoc)
* @see com.ibm.dtfj.image.ImageModule#getSections()
*/
@SuppressWarnings("unchecked")
public Iterator getSections() {
Collection<? extends IMemoryRange> ranges = delegate.getMemoryRanges();
List<ImageSection> sections = new ArrayList<ImageSection>(ranges.size());
for (IMemoryRange range : ranges) {
sections.add(new J9DDRImageSection(process, range.getBaseAddress(), range.getSize(), range.getName()));
}
return sections.iterator();
}
use of com.ibm.j9ddr.corereaders.memory.IMemoryRange in project openj9 by eclipse.
the class DumpSegments method main.
/**
* @param args
*/
public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Expected 1 argument, got " + args.length);
}
String filename = args[0];
ICore core = CoreReader.readCoreFile(filename);
Collection<? extends IAddressSpace> addressSpaces = core.getAddressSpaces();
for (IAddressSpace as : addressSpaces) {
System.err.println("Address space: " + as.getAddressSpaceId());
List<? extends IMemoryRange> ranges = new ArrayList<IMemoryRange>(as.getMemoryRanges());
Collections.sort(ranges);
// System.err.println("Raw mappings");
// for(IMemoryRange thisRange : ranges) {
// System.err.println("Base: " +
// Long.toHexString(thisRange.getBaseAddress()) + " - size: " +
// Long.toHexString(thisRange.getSize()));
// if (thisRange.getBaseAddress() == 0xf95f000) {
// System.err.println("Found!");
// }
// }
List<Range> localRanges = new LinkedList<Range>();
for (IMemoryRange range : ranges) {
Range newRange = new Range();
newRange.base = range.getBaseAddress();
newRange.size = range.getSize();
localRanges.add(newRange);
}
localRanges = mergeRanges(localRanges);
for (Range range : localRanges) {
System.err.println("Base: " + Long.toHexString(range.base) + " - size: " + Long.toHexString(range.size));
try {
if (range.size > 7) {
/*
* Pick three addresses and read integers from them -
* proves that endian conversion is working
*/
long address1 = range.base;
long address2 = range.base + range.size - 5;
long address3 = (address1 + address2) / 2;
System.err.print(Long.toHexString(address1) + " - ");
System.err.println(Integer.toHexString(as.getIntAt(address1)));
System.err.print(Long.toHexString(address2) + " - ");
System.err.println(Integer.toHexString(as.getIntAt(address2)));
System.err.print(Long.toHexString(address3) + " - ");
if (0xf971ffd == address3) {
System.err.println("Found!");
}
System.err.println(Integer.toHexString(as.getIntAt(address3)));
}
} catch (MemoryFault ex) {
ex.printStackTrace();
}
}
}
}
use of com.ibm.j9ddr.corereaders.memory.IMemoryRange in project openj9 by eclipse.
the class TestAbstractMemory method testSubRange.
@Test
public void testSubRange() {
IMemoryRange a = null;
IMemoryRange b = null;
a = new UnbackedMemorySource(0x100, 0x300, "");
b = new UnbackedMemorySource(0x300, 0x100, "");
assertTrue(a.isSubRange(b));
assertFalse(b.isSubRange(a));
b = new UnbackedMemorySource(0x300, 0x101, "");
assertFalse(a.isSubRange(b));
assertFalse(b.isSubRange(a));
a = new MockMemorySource(new byte[] { 0xB }, 0, 0x200, 0x100);
b = new MockMemorySource(new byte[] { 0xC }, 0, 0x200, 0x150);
assertFalse(a.isSubRange(b));
assertTrue(b.isSubRange(a));
}
use of com.ibm.j9ddr.corereaders.memory.IMemoryRange in project openj9 by eclipse.
the class AIXDumpReader method loadModule.
private void loadModule(ILibraryResolver resolver, IProcess proc, long textVirtualAddress, long textSize, long dataVirtualAddress, long dataSize, String fileName, String objectName, String moduleName, boolean loadingExecutable) {
// .data range will be loaded in core. .text range will be in the module itself.
IMemoryRange data = new MemoryRange(proc.getAddressSpace(), dataVirtualAddress, dataSize, ".data");
IModule module;
IMemorySource text;
try {
LibraryDataSource library = null;
if (loadingExecutable) {
library = resolver.getLibrary(fileName, true);
} else {
library = resolver.getLibrary(fileName);
}
IModuleFile moduleFile = loadModuleFile(library, objectName);
text = moduleFile.getTextSegment(textVirtualAddress, textSize);
List<? extends ISymbol> symbols = moduleFile.getSymbols(textVirtualAddress);
List<IMemoryRange> moduleMemoryRanges = new LinkedList<IMemoryRange>();
moduleMemoryRanges.add(text);
moduleMemoryRanges.add(data);
module = new Module(proc, moduleName, symbols, moduleMemoryRanges, textVirtualAddress, moduleFile.getProperties());
} catch (Exception e) {
// Create a non-backed memory range for the text segment (so we know it exists)
text = new UnbackedMemorySource(textVirtualAddress, textSize, "Native library " + moduleName + " couldn't be found", 0, ".text");
List<IMemoryRange> moduleMemoryRanges = new LinkedList<IMemoryRange>();
moduleMemoryRanges.add(text);
moduleMemoryRanges.add(data);
// Can't find the library - put a stub in with the information we have.
module = new MissingFileModule(proc, moduleName, moduleMemoryRanges);
}
// Add .text to _memoryRanges so it becomes part of the native address space.
addMemorySource(text);
if (loadingExecutable) {
_executable = module;
_executableTextSection = text;
} else {
_modules.add(module);
}
}
Aggregations