fix(extractor): read a 6.1 case's facts from its member when run has no case region

Pinokio's unoptimised run(int, CXVector*) now parses as a switch, but the
decompiler gives Application's cases no region; a case that forwards to a
named runner member is read from that member, as name dispatch did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Patryk Gensch
2026-10-28 21:34:36 +01:00
co-authored by Claude Opus 5.5
parent 7d85a69274
commit be5a701db8
+9 -4
View File
@@ -1910,10 +1910,15 @@ def annotate_method_facts(program, method_dispatch, run_addrs, runner_map, types
rows = [r for r in rows if r.get("dispatch") != "name"] rows = [r for r in rows if r.get("dispatch") != "name"]
run_func = _function_at(program, run_addrs.get(runner)) run_func = _function_at(program, run_addrs.get(runner))
high = dec.high(run_func) if run_func is not None and rows else None high = dec.high(run_func) if run_func is not None and rows else None
if high is None: roles = _storage_roles(program, high, run_roles) if high is not None else {}
continue regions = _case_regions(high, set(int(r["case_addr"], 16) for r in rows)) if high is not None else {}
roles = _storage_roles(program, high, run_roles) for row in rows:
regions = _case_regions(high, set(int(r["case_addr"], 16) for r in rows)) impl = _function_at(program, row.get("impl_addr")) if row.get("impl") else None
if legacy and impl is not None and int(row["case_addr"], 16) not in regions:
# No case region (Pinokio's unoptimised run): the case forwards to a named member.
facts = _Facts(legacy)
_collect_function(program, dec, resolve_thunk(impl), _NAMED_IMPL_ROLES, getters, facts, 1, [])
row.update(facts.as_dict())
for row in rows: for row in rows:
region = regions.get(int(row["case_addr"], 16)) region = regions.get(int(row["case_addr"], 16))
if region is None: if region is None: