summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-10-13 23:50:21 +0300
committerOxore <oxore@protonmail.com>2024-11-21 00:18:24 +0300
commit55245a2c76baeaebb032613617e426df899e9ee7 (patch)
tree79121f986a61dd7c32cadb4b9b22133d310e3ac3
parent7581621f49890a2d48e7ee4f1eb5e58679751187 (diff)
Fix -fwalk and -ffollow-jumps bug
I can't properly explain it and neither I can provide a concise test case, but the bug happened when I tried to decompile the binary of SEGA MegaDrive/Genesis game called DUNE 2 with reduced trace table. It is huge (1 MiB) to take it as a test case and also probably illegal. So anyway here is a fix.
-rw-r--r--src/disasm.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/disasm.cpp b/src/disasm.cpp
index bf72674..847d11d 100644
--- a/src/disasm.cpp
+++ b/src/disasm.cpp
@@ -195,9 +195,6 @@ void DisasmMap::Disasm(
}
}
inside_code_span = s.walk && IsNextLikelyAnInstruction(node->op);
- if (nested && !inside_code_span) {
- return;
- }
at += node->size;
// NOTE: There is not much information about a reference passed further,
// so just don't add a reference of immediate if s.imm_labels is false
@@ -236,6 +233,9 @@ void DisasmMap::Disasm(
}
}
}
+ if (nested && !inside_code_span) {
+ return;
+ }
}
}