You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@icepng basic blocks available only during decompilation process inside jadx passes. Right now there is no nice API to insert custom passes, but if you really want to, you can get passes list after jadx.load() like this:
You need to implement IDexTreeVisitor and add it to passes list, or better insert at desired position. This list building in Jadx class depending on input options, so to insert it after desired pass you need to use method like this:
publicstaticvoidaddCustomPassAfter(List<IDexTreeVisitor> passes, Class<?> passCls, IDexTreeVisitorcustomPass) {
for (inti = 0; i < passes.size(); i++) {
IDexTreeVisitorpass = passes.get(i);
if (pass.getClass().equals(passCls)) {
passes.add(i + 1, customPass);
break;
}
}
}
Complete example will be like this:
jadx.load();
List<IDexTreeVisitor> passes = jadx.getRoot().getPasses();
IDexTreeVisitorcustomPass = newAbstractVisitor() {
@Overridepublicvoidvisit(MethodNodemth) {
if (mth.isNoCode()) {
return;
}
List<BlockNode> basicBlocks = mth.getBasicBlocks();
System.out.println(basicBlocks);
}
};
addCustomPassAfter(passes, TypeInferenceVisitor.class, customPass);
for (JavaClasscls : jadx.getClasses()) {
// your pass will be executed during decompilationcls.decompile();
}
I try to use jadx as a library following the document: https://github.com/skylot/jadx/wiki/Use-jadx-as-a-library.
However, all methods' basicBlocks are null, is there any extra options for generating blocks?
The text was updated successfully, but these errors were encountered: