aboutsummaryrefslogtreecommitdiffstats
path: root/idatui/domain.py
diff options
context:
space:
mode:
authorblasty <peter@haxx.in>2026-09-25 14:28:45 +0200
committerblasty <peter@haxx.in>2026-09-25 14:28:45 +0200
commit9dea7bc83ff9b3b952a761a2d0f92b75abdd6e7e (patch)
treed0ccd92980a96250596a4aaaebccf21f0cffd74d /idatui/domain.py
parentREADME: friendlier rewrite; move IDA connection internals to CONTRIBUTING (diff)
parentFix parsing of pseudocode tags (diff)
downloadida-tui-9dea7bc83ff9b3b952a761a2d0f92b75abdd6e7e.tar.gz
ida-tui-9dea7bc83ff9b3b952a761a2d0f92b75abdd6e7e.tar.xz
ida-tui-9dea7bc83ff9b3b952a761a2d0f92b75abdd6e7e.zip
Merge PR #2 from mrexodia: fix pseudocode/listing tag parsing, ida-nexus 0.13.0
https://github.com/blasty/ida-tui/pull/2 — pseudocode address anchors are now split off only as the trailing /*0x…*/ our decompile tool appends, so a marker-shaped string literal or source comment survives display and cursor columns. The listing span walker asks the kernel (tag_skipcode) how long each colour code is instead of assuming two bytes, so semantic group tags with kind/TID headers stay invisible on kernels that emit them. Bumps ida-nexus to 0.13.0. Verified locally on IDA 9.4 + ida-nexus 0.13.0: full suite 974 passed (955 on main + 19 new pure checks). Old vs new span walker give identical output over 60k bash heads (no 0x36 tags on this kernel); the new walker costs 19.8 vs 12.3 us/line, next to 7.6 us for generate_disasm_line.
Diffstat (limited to 'idatui/domain.py')
-rw-r--r--idatui/domain.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/idatui/domain.py b/idatui/domain.py
index 1e5a863..941cc59 100644
--- a/idatui/domain.py
+++ b/idatui/domain.py
@@ -2626,6 +2626,21 @@ def _parse_xrefs(payload) -> list[Xref]:
return out
+_PSEUDOCODE_ANCHOR_RE = re.compile(r"[ \t]*/\*[ \t]*0x([0-9A-Fa-f]+)[ \t]*\*/[ \t]*$")
+
+
+def split_pseudocode_line(line: str) -> tuple[str, int | None]:
+ """Separate the legacy trailing address annotation from a pseudocode line.
+
+ Only the final annotation is metadata. Identical text inside a string or an
+ earlier source comment must survive, both for display and cursor columns.
+ """
+ match = _PSEUDOCODE_ANCHOR_RE.search(line)
+ if match is None:
+ return line.rstrip(), None
+ return line[: match.start()].rstrip(), int(match.group(1), 16)
+
+
def _parse_decompilation(ea: int, payload) -> Decompilation:
if not isinstance(payload, dict):
return Decompilation(ea, None, True, "unexpected payload", False, None)