From 638e3de3bf948fec8e1a0adfa89cbcde487cdeb8 Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 23 Jul 2026 15:42:23 +0200 Subject: listing: render opcode bytes (shared engine with disasm) — M4/UX step 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The flat listing was a subset of the disasm view (no opcodes). Now the listing carries an opcode-bytes column with the same format + o toggle: Head gains a raw field, ListingModel fills it for code heads via one bulk read per page (bounded, variable-length safe) + tracks the widest opcode; ListingView renders/pads the column, settling width as pages stream in. render_line/_line_plain share the addr+opcodes+label+mnem/text layout with DisasmView. Test harness all_funcs() reloads the index if a prior bump_items() cleared it (was crashing biggest() with max([])). Verified: code heads carry raw (max_raw_len 11); listing suite + continuous_view opcode-parity 26/0. --- tests/test_scenarios.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_scenarios.py b/tests/test_scenarios.py index b921c54..b441a2c 100644 --- a/tests/test_scenarios.py +++ b/tests/test_scenarios.py @@ -117,7 +117,10 @@ class Ctx: # -- discovery -------------------------------------------------------- # def all_funcs(self): - return self.prog.functions().all_loaded() + idx = self.prog.functions() + if len(idx) == 0 and not idx.complete: + idx.load_all() # a prior bump_items() cleared the index cache + return idx.all_loaded() def find_func(self, pred, limit=400): for f in self.all_funcs()[:limit]: @@ -1629,6 +1632,13 @@ async def s_continuous_view(c: Ctx): kinds = {c.lst.model.get(i).kind for i in range(len(c.lst.model))} c.check("continuous listing interleaves code with data/undefined", "code" in kinds and ("data" in kinds or "unknown" in kinds), str(kinds)) + # rendering parity with disasm: code lines carry opcode bytes + cidx = next((i for i in range(len(c.lst.model)) + if c.lst.model.get(i).kind == "code"), None) + c.check("continuous listing renders opcode bytes (parity with disasm)", + cidx is not None and c.lst.model.get(cidx).raw + and c.lst._op_field(c.lst.model.get(cidx)).strip() != "", + f"raw={c.lst.model.get(cidx).raw if cidx is not None else None!r}") # --------------------------------------------------------------------------- # -- cgit v1.3.1-sl0p