diff options
| author | user <user@clank> | 2026-08-01 17:22:51 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-01 17:22:51 +0200 |
| commit | 384846df7469b1dcc1842b6bdd6ccb0732071058 (patch) | |
| tree | 67ca5bb960b4d7bc28a802bb1d138587ba838ede /tests/test_rawimage_rpc.py | |
| parent | rpc: make a raw firmware image drivable (load options, define, bulk symbols) (diff) | |
| download | ida-tui-384846df7469b1dcc1842b6bdd6ccb0732071058.tar.gz ida-tui-384846df7469b1dcc1842b6bdd6ccb0732071058.tar.xz ida-tui-384846df7469b1dcc1842b6bdd6ccb0732071058.zip | |
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.
Diffstat (limited to 'tests/test_rawimage_rpc.py')
| -rw-r--r-- | tests/test_rawimage_rpc.py | 17 |
1 files changed, 17 insertions, 0 deletions
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") |
