use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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.J9ROMMethodPointer 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.J9ROMMethodPointer 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.J9ROMMethodPointer in project openj9 by eclipse.
the class RomClassWalker method allSlotsInROMMethodDo.
private J9ROMMethodPointer allSlotsInROMMethodDo(J9ROMMethodPointer method) throws CorruptDataException {
U32Pointer cursor;
addObjectsasSlot(method);
cursor = ROMHelp.J9_EXTENDED_MODIFIERS_ADDR_FROM_ROM_METHOD(method);
allSlotsInBytecodesDo(method);
if (J9ROMMethodHelper.hasExtendedModifiers(method)) {
classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "extendedModifiers");
cursor = cursor.add(1);
}
if (J9ROMMethodHelper.hasGenericSignature(method)) {
classWalkerCallback.addSlot(clazz, SlotType.J9_ROM_UTF8, cursor, "methodUTF8");
cursor = cursor.add(1);
}
if (J9ROMMethodHelper.hasExceptionInfo(method)) {
J9ExceptionInfoPointer exceptionInfo = J9ExceptionInfoPointer.cast(cursor);
long exceptionInfoSize = J9ExceptionInfo.SIZEOF + exceptionInfo.catchCount().longValue() * J9ExceptionHandler.SIZEOF + exceptionInfo.throwCount().longValue() * SelfRelativePointer.SIZEOF;
allSlotsInExceptionInfoDo(exceptionInfo);
cursor = cursor.addOffset(exceptionInfoSize);
}
if (J9ROMMethodHelper.hasMethodAnnotations(method)) {
cursor = cursor.add(allSlotsInAnnotationDo(cursor, "methodAnnotation"));
}
if (J9ROMMethodHelper.hasParameterAnnotations(method)) {
cursor = cursor.add(allSlotsInAnnotationDo(cursor, "parameterAnnotations"));
}
if (J9ROMMethodHelper.hasMethodTypeAnnotations(method)) {
cursor = cursor.add(allSlotsInAnnotationDo(cursor, "method typeAnnotations"));
}
if (J9ROMMethodHelper.hasCodeTypeAnnotations(method)) {
cursor = cursor.add(allSlotsInAnnotationDo(cursor, "code typeAnnotations"));
}
if (J9ROMMethodHelper.hasDefaultAnnotation(method)) {
cursor = cursor.add(allSlotsInAnnotationDo(cursor, "defaultAnnotation"));
}
if (J9ROMMethodHelper.hasDebugInfo(method)) {
cursor = cursor.add(allSlotsInMethodDebugInfoDo(cursor));
}
if (J9ROMMethodHelper.hasStackMap(method)) {
long stackMapSize = cursor.at(0).longValue();
U8Pointer stackMap = U8Pointer.cast(cursor.add(1));
classWalkerCallback.addSection(clazz, cursor, stackMapSize, "stackMap", true);
classWalkerCallback.addSlot(clazz, SlotType.J9_U32, cursor, "stackMapSize");
allSlotsInStackMapDo(stackMap);
cursor = cursor.addOffset(stackMapSize);
}
if (J9ROMMethodHelper.hasMethodParameters(method)) {
cursor = cursor.add(allSlotsInMethodParametersDataDo(cursor));
}
return J9ROMMethodPointer.cast(cursor);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer 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);
}
}
Aggregations