refactor: print surrounding opcodes of a warning

This commit is contained in:
Lucaskyy 2022-04-14 19:58:55 +02:00
parent a0dcea3a13
commit 6d4158af85
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89

View File

@ -17,14 +17,24 @@ internal class SignatureChecker {
patcher.addPatches(Index.patches.map { it() })
val unresolved = mutableListOf<MethodSignature>()
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)
}
}
}
}