use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.
the class StackWalkerUtils method swPrintMethod.
public static void swPrintMethod(WalkState walkState, J9MethodPointer method) throws CorruptDataException {
if (method.notNull()) {
J9UTF8Pointer className = UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
J9UTF8Pointer name = romMethod.nameAndSignature().name();
J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
swPrintf(walkState, 2, "\tMethod: {0}.{1}{2} !j9method {3}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), method.getHexAddress());
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.
the class TerseStackWalkerCallbacks method frameWalkFunction.
public FrameCallbackResult frameWalkFunction(J9VMThreadPointer walkThread, WalkState walkState) {
try {
if (walkState.method.notNull()) {
J9MethodPointer method = walkState.method;
J9UTF8Pointer className = StackWalkerUtils.UNTAGGED_METHOD_CP(method).ramClass().romClass().className();
J9ROMMethodPointer romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
J9UTF8Pointer name = romMethod.nameAndSignature().name();
J9UTF8Pointer sig = romMethod.nameAndSignature().signature();
StackWalkerUtils.swPrintf(walkState, 0, "\t!j9method {3} {0}.{1}{2}", J9UTF8Helper.stringValue(className), J9UTF8Helper.stringValue(name), J9UTF8Helper.stringValue(sig), walkState.method.getHexAddress());
return FrameCallbackResult.KEEP_ITERATING;
}
if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_JNI_NATIVE_METHOD) {
StackWalkerUtils.swPrintf(walkState, 0, "\t Native method frame");
} else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_GENERIC_SPECIAL) {
StackWalkerUtils.swPrintf(walkState, 0, "\t Generic special frame");
} else if (walkState.pc.getAddress() == J9SF_FRAME_TYPE_METHODTYPE) {
StackWalkerUtils.swPrintf(walkState, 0, "\t MethodType frame");
} else {
if (walkState.pc.getAddress() > J9SF_MAX_SPECIAL_FRAME_TYPE) {
if (walkState.pc.getAddress() == walkState.walkThread.javaVM().callInReturnPC().getAddress() || walkState.pc.getAddress() == (walkState.walkThread.javaVM().callInReturnPC().getAddress() + 3)) {
StackWalkerUtils.swPrintf(walkState, 0, "\t JNI call-in frame");
} else {
StackWalkerUtils.swPrintf(walkState, 0, "\t unknown frame type {0} *{1}", walkState.pc, walkState.pc.getHexAddress());
}
} else {
StackWalkerUtils.swPrintf(walkState, 0, "\t known but unhandled frame type {0}", walkState.pc);
}
}
} catch (CorruptDataException e) {
e.printStackTrace();
}
return FrameCallbackResult.KEEP_ITERATING;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.
the class J9ClassHelper method getMethodFromPCAndClass.
/*
* Returns a program space pointer to the matching J9Method for the
* specified class and PC.
*/
public static J9MethodPointer getMethodFromPCAndClass(J9ClassPointer localClass, U8Pointer pc) throws CorruptDataException {
J9ROMClassPointer localROMClass = localClass.romClass();
for (int i = 0; i < localROMClass.romMethodCount().longValue(); i++) {
J9MethodPointer localMethod = localClass.ramMethods().add(i);
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(localMethod);
boolean a = pc.gte(U8Pointer.cast(romMethod));
boolean b = pc.lte(J9ROMMethodHelper.bytecodeEnd(romMethod).subOffset(1));
if (a && b) {
return localMethod;
}
}
return J9MethodPointer.NULL;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.
the class BytecodesCommand method run.
// dbgext_bytecodes
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
J9MethodPointer ramMethod = J9MethodPointer.cast(address);
long maps = 0;
if (ramMethod.isNull()) {
CommandUtils.dbgPrint(out, "bad or missing ram method addr\n");
return;
}
J9ClassPointer ramClass = ConstantPoolHelpers.J9_CLASS_FROM_METHOD(ramMethod);
if (args.length == 2 && args[1].equals("maps")) {
maps |= BCT_DumpMaps;
}
if (J9BuildFlags.env_littleEndian) {
maps |= BCT_LittleEndianOutput;
} else {
maps |= BCT_BigEndianOutput;
}
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(ramMethod);
J9ROMClassPointer romClass = ramClass.romClass();
J9BCUtil.j9bcutil_dumpRomMethod(out, romMethod, romClass, maps, 0);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer in project openj9 by eclipse.
the class DumpRomMethodCommand method romMethodIteratorFromRamMethod.
private Iterable<J9ROMClassAndMethod> romMethodIteratorFromRamMethod(J9MethodPointer ramMethod) throws CorruptDataException {
Iterable<J9ROMClassAndMethod> methodIterator;
J9ClassPointer ramClass = ConstantPoolHelpers.J9_CLASS_FROM_METHOD(ramMethod);
J9ROMMethodPointer romMethod = J9MethodHelper.romMethod(ramMethod);
J9ROMClassPointer romClass = ramClass.romClass();
Vector<J9ROMClassAndMethod> methodInfoVector = new Vector<J9ROMClassAndMethod>(1);
methodInfoVector.add(new J9ROMClassAndMethod(romMethod, romClass));
methodIterator = methodInfoVector;
return methodIterator;
}
Aggregations