diff options
| author | blasty <blasty@local> | 2026-07-26 20:35:41 +0200 |
|---|---|---|
| committer | blasty <blasty@local> | 2026-07-26 20:35:41 +0200 |
| commit | e02dae30a36a730620740bea195bb8eeba40d8bd (patch) | |
| tree | 638b777bf1fcee0079fe92aade8974f93f678e5a | |
| parent | decomp: say WHY a function won't decompile (diff) | |
| download | ida-tui-e02dae30a36a730620740bea195bb8eeba40d8bd.tar.gz ida-tui-e02dae30a36a730620740bea195bb8eeba40d8bd.tar.xz ida-tui-e02dae30a36a730620740bea195bb8eeba40d8bd.zip | |
decomp: say the FIX, not the diagnosis
The 64-bit failure now reported Hex-Rays verbatim — "only 64-bit functions can
be decompiled in the current database" — with the actionable half appended after
it. A status bar cuts off the end, so the user got a perfect description of their
problem and nothing about what to do, which is the same dead end as before with
extra words.
before: sub_0: cannot decompile — only 64-bit functions can be decompiled in
the current database — Ctrl+L and pick arm:ARMv7-A (125 chars)
after: sub_0: cannot decompile — this database is 64-bit — Ctrl+L, pick
arm:ARMv7-A (76 chars)
For this one failure the instruction IS the whole message: it can't be fixed in
place (bitness is decided at load), so describing the database serves nobody.
Other Hex-Rays reasons still pass through verbatim — they're usually about the
function, and there the description is the useful part.
Verified the whole path in a live pane on experiments/fibonacci.bin: the load
dialog now shows arm vs arm:ARMv7-A/M/v6-M/v5TE with their bitness spelled out,
picking arm:ARMv7-A gives 54 functions, and sub_0 decompiles:
void __fastcall __noreturn sub_0(int a1) { ... v2 = sub_E3C(a1, 0); ... }
tests: thumb (16) now asserts the message names the fix rather than quoting
Hex-Rays, and that it fits under 110 chars — the truncation is what made the
last version useless, so it's worth a check. 209/0 scenarios, 30/0 blob.
| -rw-r--r-- | idatui/domain.py | 10 | ||||
| -rw-r--r-- | tests/test_thumb_ui.py | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/idatui/domain.py b/idatui/domain.py index a92ea49..084312a 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -1383,8 +1383,14 @@ class Program: return "" reason = str(r.get("reason") or "") if reason and r.get("bitness") == 64 and "64-bit" in reason: - # Unfixable in place: the database's bitness is decided at load. - reason += " \u2014 Ctrl+L and pick arm:ARMv7-A" + # Say the FIX, not the diagnosis. Hex-Rays' own sentence ("only + # 64-bit functions can be decompiled in the current database") is + # accurate and useless: it describes the database, not what to do, + # and it's long enough that a status bar cuts off the end — which is + # exactly where an appended hint would live. This is unfixable in + # place (bitness is decided at load), so the whole message is the + # instruction. + return "this database is 64-bit \u2014 Ctrl+L, pick arm:ARMv7-A" return reason def set_thumb(self, ea: int, mode: str = "toggle") -> dict: diff --git a/tests/test_thumb_ui.py b/tests/test_thumb_ui.py index 5b6f18e..84afcaf 100644 --- a/tests/test_thumb_ui.py +++ b/tests/test_thumb_ui.py @@ -161,10 +161,16 @@ async def run() -> int: await wait(lambda: "cannot decompile" in str(app.query_one("#status", Static).render()), pilot, 90) status = str(app.query_one("#status", Static).render()) - check("a failed decompile says why, in Hex-Rays' own words", - "only 64-bit functions" in status, status[:130]) + # The message must say what to DO. Hex-Rays' own sentence ("only 64-bit + # functions can be decompiled in the current database") describes the + # database, not the fix, and is long enough that a status bar cuts off + # the end — which is where an appended hint would have lived. + check("a failed decompile names the fix, not just the diagnosis", + "Ctrl+L" in status and "ARMv7-A" in status, status[:130]) check("and the reason survives the view reloading under it", "cannot decompile" in status, status[:130]) + check("the message fits a narrow status bar", + len(status) < 110, f"{len(status)} chars: {status[:130]}") # -- the whole point: a 32-bit database decompiles ---------------------- # for ext in (".i64", ".id0", ".id1", ".id2", ".nam", ".til"): |
