From 3ca9e1ea6dacd9cdfd545902eb8c0838dd383eed Mon Sep 17 00:00:00 2001 From: user Date: Fri, 7 Aug 2026 05:52:49 +0200 Subject: CORRECTNESS FIX, kept despite a worse metric. The un-chunked refresh was showing STALE NAMES on any wide read: one heads call for a search-sized window overflows the tool's 2000-row cap, the short response fails the sequence check, and the block is left with its old text. Refresh is now done a block at a time. Adds .auto/check_rename.py to the gate, which fails hard on the previous code and passes on this one. Result: {"status":"keep","total_ms":28651.3,"lg_boot_ms":720.6,"lg_decomp_ms":2427.4,"lg_graph_ms":1222.4,"lg_hex_ms":440.9,"lg_index_ms":72.6,"lg_listing_cold_ms":433.6,"lg_listing_warm_ms":465.9,"lg_nav_ms":6809.7,"lg_palette_ms":4.7,"lg_rename_ms":710.1,"lg_render_ms":228.7,"lg_search_ms":6891.2,"lg_split_ms":2259.2,"pure_graph_ms":214.5,"sm_boot_ms":457.7,"sm_decomp_ms":1303.6,"sm_graph_ms":700.2,"sm_hex_ms":445.4,"sm_index_ms":2.4,"sm_listing_cold_ms":271.4,"sm_listing_warm_ms":270.9,"sm_nav_ms":309.2,"sm_palette_ms":0.3,"sm_rename_ms":386.6,"sm_render_ms":265.8,"sm_search_ms":70.1,"sm_split_ms":1266.2,"fails":0} --- idatui/domain.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'idatui/domain.py') diff --git a/idatui/domain.py b/idatui/domain.py index 386b3e8..1f8263d 100644 --- a/idatui/domain.py +++ b/idatui/domain.py @@ -919,24 +919,37 @@ class ListingModel: def _ensure_text(self, j0: int, j1: int) -> None: """Re-render physical heads [j0, j1) if a rename staled them. - The block is snapped out to whole ADDRESS groups. A function start emits - three banner rows and its code row at the same ea, and a labelled - instruction emits two -- so a block boundary that fell inside one of - those groups would refetch the whole group and never line up again. + Done a block at a time. One call for the whole range would be simpler but + the ``heads`` tool caps a response at 2000 rows, so a wide request (the + search body asks for thousands at once) would come back short, fail the + sequence check, and condemn the model to a rebuild it did not need. + """ + blk = self.TEXT_BLOCK + with self._lock: + n = len(self._heads) + start = (max(j0, 0) // blk) * blk + while start < min(j1, n): + self._ensure_text_block(start, min(start + blk, n)) + start += blk + + def _ensure_text_block(self, j0: int, j1: int) -> None: + """Re-render one block, snapped out to whole ADDRESS groups. + + A function start emits three banner rows and its code row at the same ea, + and a labelled instruction emits two -- so a boundary falling inside one + of those groups would refetch the whole group, never line up, and leave + the old names on screen for good. """ with self._lock: gen = self._text_gen n = len(self._heads) - j0 = max(j0, 0) - j1 = min(j1, n) - if j1 <= j0: + a = max(j0, 0) + b = min(j1, n) + if b <= a: return head_gen = self._head_gen - if all(head_gen[j] == gen for j in range(j0, j1)): + if all(head_gen[j] == gen for j in range(a, b)): return - blk = self.TEXT_BLOCK - a = (j0 // blk) * blk - b = min(((j1 - 1) // blk + 1) * blk, n) eas = self._head_eas while a > 0 and eas[a - 1] == eas[a]: a -= 1 -- cgit v1.3.1-sl0p