fix(script): use script log for show stages exceptions (#1912)
This commit is contained in:
+8
@@ -23,4 +23,12 @@ class Debug(private val jadx: JadxScriptInstance) {
|
||||
fun printPasses() {
|
||||
jadx.internalDecompiler.root.passes.forEach { jadx.log.info { it.name } }
|
||||
}
|
||||
|
||||
fun catchExceptions(label: String = "", code: () -> Unit) {
|
||||
try {
|
||||
code.invoke()
|
||||
} catch (e: Throwable) {
|
||||
jadx.log.error(e) { "Exception in '$label'" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-3
@@ -16,7 +16,9 @@ class Stages(private val jadx: JadxScriptInstance) {
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.instructions?.let {
|
||||
block.invoke(mth, it)
|
||||
jadx.debug.catchExceptions("Method instructions visit") {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -37,7 +39,9 @@ class Stages(private val jadx: JadxScriptInstance) {
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.basicBlocks?.let {
|
||||
block.invoke(mth, it)
|
||||
jadx.debug.catchExceptions("Method blocks visit") {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -51,7 +55,9 @@ class Stages(private val jadx: JadxScriptInstance) {
|
||||
) {
|
||||
override fun visit(mth: MethodNode) {
|
||||
mth.region?.let {
|
||||
block.invoke(mth, it)
|
||||
jadx.debug.catchExceptions("Method region visit") {
|
||||
block.invoke(mth, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user