use of com.ibm.dtfj.java.JavaMethod in project openj9 by eclipse.
the class WhatisCommand method isWithinImageSections.
private boolean isWithinImageSections(Iterator heapImageSections, Object memType, boolean isMethodCompiled, long address) {
while (heapImageSections.hasNext()) {
ImageSection imageSection = (ImageSection) heapImageSections.next();
long baseAddress = imageSection.getBaseAddress().getAddress();
long size = imageSection.getSize();
long endAddress = baseAddress + size;
if (address <= endAddress && address >= baseAddress) {
if (null == memType) {
out.print("\t\t0x" + Long.toHexString(address) + " is within heap segment: " + Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n");
return true;
}
if (memType instanceof JavaMethod) {
String methodName = "N/A", methodSig = "N/A", className = "N/A";
try {
methodName = ((JavaMethod) memType).getName();
methodSig = ((JavaMethod) memType).getSignature();
className = ((JavaMethod) memType).getDeclaringClass().getName();
} catch (CorruptDataException cde) {
} catch (DataUnavailable du) {
}
String codeType = isMethodCompiled ? "compiled code" : "byte code";
out.print("\t0x" + Long.toHexString(address) + " is within the " + codeType + " range: " + Long.toHexString(baseAddress) + " -- " + Long.toHexString(endAddress) + "\n\t" + "...of method " + methodName + " with signature " + methodSig + "\n\t" + "...in class " + className + "\n");
return true;
}
}
}
return false;
}
use of com.ibm.dtfj.java.JavaMethod in project openj9 by eclipse.
the class WhatisCommand method checkMethodInRange.
private void checkMethodInRange(Iterator objects, long address) {
while (objects.hasNext()) {
JavaObject jObject = (JavaObject) objects.next();
JavaClass jClass;
try {
jClass = jObject.getJavaClass();
} catch (CorruptDataException cde) {
// go to the next iteration
continue;
}
Iterator methods = jClass.getDeclaredMethods();
while (methods.hasNext()) {
JavaMethod jMethod = (JavaMethod) methods.next();
Iterator bytecodeSections = jMethod.getBytecodeSections();
Iterator compiledSections = jMethod.getCompiledSections();
if (isWithinImageSections(bytecodeSections, jMethod, false, address)) {
// found it, we are done
return;
}
if (isWithinImageSections(compiledSections, jMethod, true, address)) {
// found it, we are done
return;
}
}
}
}
use of com.ibm.dtfj.java.JavaMethod in project openj9 by eclipse.
the class InfoJitmCommand method showJITdMethods.
private void showJITdMethods() {
JavaRuntime jr = ctx.getRuntime();
Iterator itJavaClassLoader = jr.getJavaClassLoaders();
while (itJavaClassLoader.hasNext()) {
JavaClassLoader jcl = (JavaClassLoader) itJavaClassLoader.next();
Iterator itJavaClass = jcl.getDefinedClasses();
while (itJavaClass.hasNext()) {
JavaClass jc = (JavaClass) itJavaClass.next();
Iterator itJavaMethod = jc.getDeclaredMethods();
String jcName;
try {
jcName = jc.getName();
} catch (CorruptDataException e) {
jcName = Exceptions.getCorruptDataExceptionString();
}
while (itJavaMethod.hasNext()) {
JavaMethod jm = (JavaMethod) itJavaMethod.next();
String name;
String sig;
try {
name = jm.getName();
} catch (CorruptDataException e) {
name = Exceptions.getCorruptDataExceptionString();
}
try {
sig = jm.getSignature();
} catch (CorruptDataException e) {
sig = Exceptions.getCorruptDataExceptionString();
}
if (jm.getCompiledSections().hasNext()) {
Iterator itImageSection = jm.getCompiledSections();
while (itImageSection.hasNext()) {
ImageSection is = (ImageSection) itImageSection.next();
long startAddr = is.getBaseAddress().getAddress();
long size = is.getSize();
long endAddr = startAddr + size;
out.print("\n\t" + "start=" + Utils.toHex(startAddr) + " " + "end=" + Utils.toHex(endAddr) + " " + jcName + "::" + name + sig);
}
}
}
}
}
out.print("\n");
}
Aggregations