From 4d98bf31a5fc99350c47a7ec84d00da618a15ca6 Mon Sep 17 00:00:00 2001 From: blasty Date: Wed, 22 Jul 2026 23:55:51 +0200 Subject: app: 'd' — define typed data in the listing (make_data, M3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Press 'd' on a listing head to define typed data at that address via a prompt (the ".data type definitions" backlog item). Mirrors the retype prompt flow: MakeDataRequested -> #makedata Input (prefilled with a size-appropriate default type: unsigned __int8/16/32/64 or char[N]) -> _do_make_data worker -> Program.make_data -> bump_items -> reopen the listing in place. Accepts any C type IDA's SetType understands: int, char[16], my_struct, T *arr[4], ... Pilot: listing_view gains a deterministic sub-test — undefine a data head to synthesize an unknown run, assert it renders as `unknown`, then 'd' char[4] over it and assert it becomes a `data` head. 118 pass / 1 pre-existing flaky (filter); rpc_smoke 29/0. --- idatui/domain.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'idatui/domain.py') diff --git a/idatui/domain.py b/idatui/domain.py index fd673ca..4f33211 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -1071,6 +1071,17 @@ class Program: if res.get("error"): raise IDAToolError(f"undefine @ {ea:#x}: {res['error']}") + def make_data(self, ea: int, type_decl: str, name: str | None = None) -> None: + """Create a typed data item at ``ea`` (IDA's 'd', but typed). ``type_decl`` + is a C type, e.g. 'int', 'unsigned __int32', 'char[5]', 'my_struct'.""" + item: dict = {"addr": hex(ea), "type": type_decl} + if name: + item["name"] = name + res = self._first_result(self.client.call("make_data", items=[item])) + if res.get("ok") is False or res.get("error"): + raise IDAToolError( + f"make data @ {ea:#x}: {res.get('error') or 'rejected'}") + def region_label(self, ea: int) -> str: """Display name for a non-function address (segment-qualified).""" try: -- cgit v1.3.1-sl0p