Closed fa1conn closed 1 year ago
Have you tried to call MethodNode.load()
? Afterwards the list of instructions should be initialized.
Well, MethodNode
is considered internal, so better try to not use it. But if you really want to, there are several solutions:
MethodNode.load()
as @jpstotz mentionedProcessInstructionsVisitor
, so insert line should be:
addCustomPassAfter(passes, ProcessInstructionsVisitor.class, customPass);
This will work because instructions array available only in first passes working on input instructions, next it replaced with basic blocks tree.
Also, getInsnsCount()
return an approximation of instructions count, actually it is a size of code block in code units (2 bytes for DEX). Looks like I forget to rename this property after I rename ICodeReader.getUnitsCount()
.
I follow the issue #1482 and want to print the instructions of method,but it return null. Other member variables are normal, such as getInsnsCount() could return the count of instructions.