From 6d4158af854a4e1d02f8ef32f3308e4c130e1828 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Thu, 14 Apr 2022 19:58:55 +0200 Subject: [PATCH] refactor: print surrounding opcodes of a warning --- .../app/revanced/patches/SignatureChecker.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt b/src/test/kotlin/app/revanced/patches/SignatureChecker.kt index 28cc27d6..3ee92528 100644 --- a/src/test/kotlin/app/revanced/patches/SignatureChecker.kt +++ b/src/test/kotlin/app/revanced/patches/SignatureChecker.kt @@ -17,14 +17,24 @@ internal class SignatureChecker { patcher.addPatches(Index.patches.map { it() }) val unresolved = mutableListOf() for (signature in patcher.resolveSignatures()) { - if (!signature.resolved) unresolved.add(signature) + if (!signature.resolved) { + unresolved.add(signature) + continue + } val patternScanMethod = signature.metadata.patternScanMethod if (patternScanMethod is PatternScanMethod.Fuzzy) { - val warnings = patternScanMethod.warnings + val warnings = patternScanMethod.warnings!! println("Signature ${signature.metadata.name} had ${warnings.size} warnings!") for (warning in warnings) { + val instructions = signature.result!!.method.implementation!!.instructions + for (i in warning.expectedIndex - 5 until warning.expectedIndex) { + println(instructions[i].opcode) + } println(warning.toString()) + for (i in warning.expectedIndex - 5 .. warning.expectedIndex + 1) { + println(instructions[i].opcode) + } } } }