use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class DTFJJavaRuntime method getHeapFromAddress.
/*
* Returns the JavaHeap which contains the passed-in address
* Returns null if no containing JavaHeap is found
*/
@SuppressWarnings("rawtypes")
public DTFJJavaHeap getHeapFromAddress(ImagePointer address) {
try {
VoidPointer pointer = VoidPointer.cast(address.getAddress());
Iterator heapsIterator = getHeaps();
while (heapsIterator.hasNext()) {
DTFJJavaHeap heap = (DTFJJavaHeap) heapsIterator.next();
Iterator sectionsIterator = heap.getSections();
while (sectionsIterator.hasNext()) {
ImageSection section = (ImageSection) sectionsIterator.next();
VoidPointer base = VoidPointer.cast(section.getBaseAddress().getAddress());
VoidPointer top = base.addOffset(section.getSize());
if (pointer.gte(base) && pointer.lt(top)) {
// Object is within this section
return heap;
}
}
}
} catch (Throwable t) {
// just log exceptions and allow it to fall through
J9DDRDTFJUtils.handleAsCorruptDataException(DTFJContext.getProcess(), t);
}
return null;
}
use of com.ibm.j9ddr.vm29.pointer.VoidPointer in project openj9 by eclipse.
the class DTFJJavaRuntime method getHeaps.
@SuppressWarnings("rawtypes")
public Iterator getHeaps() throws UnsupportedOperationException {
try {
LinkedList<Object> heaps = new LinkedList<Object>();
VoidPointer memorySpace = DTFJContext.getVm().defaultMemorySpace();
MM_MemorySpacePointer defaultMemorySpace = MM_MemorySpacePointer.cast(memorySpace);
U8Pointer namePtr = defaultMemorySpace._name();
// MEMORY_SPACE_NAME_UNDEFINED
String name = "No name";
if (namePtr != null && namePtr != U8Pointer.NULL) {
try {
name = namePtr.getCStringAtOffset(0);
} catch (com.ibm.j9ddr.CorruptDataException e) {
name = "<<corrupt heap name>>";
}
}
heaps.add(new DTFJJavaHeap(defaultMemorySpace, name, DTFJContext.getImagePointer(memorySpace.getAddress())));
return heaps.iterator();
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
return corruptIterator(cd);
}
}
Aggregations