Instrumenting bytecode at method level
-
02-07-2021 - |
Pergunta
if(iHandles[f].getInstruction() instanceof IFEQ ) {
getFieldInstruction = iHandles[f+1].getInstruction();
System.out.println("found IF");
InstructionList iprint = iFactory.createPrintln("The control is in IF");
iList.setPositions();
main.setMaxStack();
main.setMaxLocals();
main.removeLineNumbers();
iList.insert(getFieldInstruction, iprint);
main.setInstructionList(iList);
}
In the above code I am instrumenting the bytecode at if statements. I'm using constants like IFEQ or IF_ICMPNE to search for an if statement in a bytecode. I want to instrument the bytecode at every method. What constants can I use to do this ? Or how is it possible?
Solução
The above code works for if ... getFieldInstruction = iHandles[0].getInstruction();
to instrument methods.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow