I am trying to implement method call application with CHA,XTA,RTA .For this purpose i use ASM.What should be bytecode variable below?How can i traverse all classes of Java project.
ClassReader cr = new ClassReader(bytecode);
ClassNode cn = new ClassNode();
cr.accept(cn, ClassReader.SKIP_DEBUG);
List methods = cn.methods;
for (int i = 0; i < methods.size(); ++i) {
MethodNode method = (MethodNode) methods.get(i);
if (method.instructions.size() > 0) {..}
}
Each class is in its own file. You traverse classes, in the same manner as you traverse files. e.g.
If the classes are in a JAR or ZIP file, you need to read that file.