use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class DTFJTest method writeObject.
@SuppressWarnings("unchecked")
protected void writeObject(JavaObject obj, long index) throws Exception {
startTag("<object");
write(" index=\"" + index + "\"");
write(" address=\"0x" + Long.toHexString(obj.getID().getAddress()) + "\"");
write(" size=\"0x" + Long.toHexString(obj.getSize()) + "\"");
write(">\n");
writeClass(obj.getJavaClass());
tag("<toString>" + obj.toString() + "</toString>\n");
tag("<persistentHashCode>" + obj.getPersistentHashcode() + "</persistentHashCode>\n");
if (obj.isArray()) {
tag("<array elementCount=\"0x" + Long.toHexString(obj.getArraySize()) + "\" />\n");
}
for (Iterator sections = obj.getSections(); sections.hasNext(); ) {
ImageSection section = (ImageSection) sections.next();
writeSection(section);
}
endTag("</object>\n");
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class XKCommand method printSymbol.
private boolean printSymbol(long pointer, long diff, int pointerSize) {
ImageProcess ip = ctx.getProcess();
Iterator itModule;
try {
itModule = ip.getLibraries();
} catch (CorruptDataException e) {
// FIXME
itModule = null;
} catch (DataUnavailable e) {
// FIXME
itModule = null;
}
while (null != itModule && itModule.hasNext()) {
ImageModule im = (ImageModule) itModule.next();
Iterator itImageSection = im.getSections();
while (itImageSection.hasNext()) {
ImageSection is = (ImageSection) itImageSection.next();
long startAddr = is.getBaseAddress().getAddress();
long endAddr = startAddr + is.getSize();
if (pointer >= startAddr && pointer < endAddr) {
/* can we find a matching symbol? */
long maxDifference = pointer - startAddr;
ImageSymbol bestSymbol = null;
for (Iterator iter = im.getSymbols(); iter.hasNext(); ) {
Object next = iter.next();
if (next instanceof CorruptData)
continue;
ImageSymbol symbol = (ImageSymbol) next;
long symbolAddress = symbol.getAddress().getAddress();
if (symbolAddress <= pointer && pointer - symbolAddress < maxDifference) {
maxDifference = pointer - symbolAddress;
bestSymbol = symbol;
}
}
try {
out.print(im.getName());
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print("::");
if (bestSymbol == null) {
out.print(is.getName());
} else {
out.print(bestSymbol.getName());
}
out.print("+");
out.print(Long.toString(maxDifference));
// trying to find it elsewhere in the address space
return true;
}
}
}
return false;
}
use of com.ibm.dtfj.image.ImageSection in project openj9 by eclipse.
the class J9DDRImageAddressSpace method getImageSections.
public Iterator<?> getImageSections() {
Collection<? extends IMemoryRange> ranges = as.getMemoryRanges();
List<ImageSection> sections = new ArrayList<ImageSection>(ranges.size());
IProcess proc = getPointerProcess();
// it may be the case that we can't determine the pointer size if there are no processes found in the address space
if (null == proc) {
return J9DDRDTFJUtils.emptyIterator();
}
for (IMemoryRange thisRange : ranges) {
J9DDRImageSection section = new J9DDRImageSection(proc, thisRange.getBaseAddress(), thisRange.getSize(), thisRange.getName());
sections.add(section);
}
return sections.iterator();
}
use of com.ibm.dtfj.image.ImageSection 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.dtfj.image.ImageSection 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();
}
Aggregations