From 384846df7469b1dcc1842b6bdd6ccb0732071058 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 1 Aug 2026 17:22:51 +0200 Subject: rpc: rename_many drops the Hex-Rays cache too Hex-Rays caches per function and does not notice that a *callee* was renamed; worse, that cache is persisted in the .i64, so a bulk import left pseudocode calling sub_98C0 forever while the listing and every readback said memset -- the exact readback disagreement a driver cannot detect. Batch now calls force_recompile before bumping the local caches. Test extended: decompile, rename via rename_many, read the pseudocode back. --- tests/test_rawimage_rpc.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') diff --git a/tests/test_rawimage_rpc.py b/tests/test_rawimage_rpc.py index ab7eb96..fe2629f 100644 --- a/tests/test_rawimage_rpc.py +++ b/tests/test_rawimage_rpc.py @@ -151,6 +151,23 @@ def main() -> int: check("rename_many takes inline items", r["rename_many"]["ok"] == 1, json.dumps(r["rename_many"])) + # -- the stale-pseudocode trap ------------------------------ # + # Hex-Rays caches per function and does not notice that a + # CALLEE was renamed -- and that cache is persisted in the + # .i64. Decompile first, then rename, then read it back: the + # call site must show the new name. (fibonacci is recursive, so + # the function's own body cites it.) + before = c.call("pseudocode", target=hex(ea)) + pc_before = json.dumps(before) + r = c.call("rename_many", items=[{"addr": hex(ea), + "name": "after_cache_fn"}]) + pc_after = json.dumps(c.call("pseudocode", target=hex(ea))) + check("pseudocode was cached before the rename", + "inline_named_fn" in pc_before, pc_before[:200]) + check("rename_many invalidates the decompile cache", + "after_cache_fn" in pc_after + and "inline_named_fn" not in pc_after, pc_after[:300]) + empty = None try: c.call("rename_many") -- cgit v1.3.1-sl0p