From f0180748b19eac5fe99124142aea60eac78cf4bd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 22:43:41 -0300 Subject: design: the dense stage is a map; the frame keeps its layout and gains a minimap From the user, on the 4K mocks: the space was not well used, and the dense view is better as where a scene starts or as a minimap than as the frame it works in. The map is the same moment with every panel at full length on 3840 by 2160, packed by content. The working frame is the 1920 stage again, each panel a window on its column of the map, with the map at a twentieth in the caption band: windows outlined, marks no window shows flashing there. dive and surface carry a scene between the two, each window travelling to its panel's place. The loupe hangs from its pointer in the working frame. Mocks 16 to 18 are withdrawn; 19 is the map, 20 the dive in four instants, 21 a loupe with the minimap. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/context.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'design/mock/context.py') diff --git a/design/mock/context.py b/design/mock/context.py index 303c7c1..069e894 100644 --- a/design/mock/context.py +++ b/design/mock/context.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """The frame: the machine's whole context, pwndbg's way, a lens over it, and the ties between them. - python3 -B context.py # writes 09-context.svg, 10-context-step.svg, 11-context-lens.svg, 12-calls-subject.svg + python3 -B context.py # writes 12-calls-subject.svg, 13-sqlite-row.svg, 14-sqlite-page.svg (9 to 11: map.py) Every function here is a block of design/README.md, under the block's name. @@ -333,6 +333,10 @@ def stack(g, y, rows, frames, note=None, rsp=None, roles=None): off = slot - rsp g.t(RX + 172, b(yy), ("+%x" % off) if off >= 0 else ("-%x" % -off), S, FAINT, MONO, "end") end_x = room.get(i, RX + CW - 136) + if marks and marks[0].get("free"): # above rsp: not the stack's yet; its word faint, no chain + g.t(first, b(yy), "%x" % slot, S, mix(STACK, PAGE, 0.6), MONO) + g.t(first + 13 * A, b(yy), "%x" % end[1], S, FAINT, MONO) + continue if i in roles: text, ink = roles[i] g.t(end_x, b(yy), text, S, ink, MONO, "end") @@ -464,7 +468,7 @@ def thread(g, ys, spans): # ---- the lens: a list, and beside it the bytes it is drawn from ------------------------- def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=(), title="its bytes", x=None, - framed=(), bare=False, rows_shown=None): + framed=(), bare=False, rows_shown=None, more_rows=True): """`hexdump` by `fields`: the region a scene names, read by the fields it gives it, in the band's view. flist: (at, len, reads, big, mark) with reads in number | pointer | text | bytes. mem: {address: byte} of what the stop shown saw (or the kernel took); a byte not in it is unread. marks: the field marks framed as read. @@ -555,7 +559,7 @@ def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=() g.t(x, b(yy), s_, S, sink, MONO) x += (len(s_) + 1) * A yy += ROW - if shown and shown[-1] < total - 1: # the rows after the last field: one row, and how many + if more_rows and shown and shown[-1] < total - 1: # the rows after the last field: one row, and how many more(g, X + 18 - 6, yy) g.t(X + 18 + 30 + 36, b(yy), "%d rows" % (total - 1 - shown[-1]), S, FAINT, MONO) return ys @@ -631,7 +635,8 @@ def dump_row(g, y, a, runs, lead, mark=None, node=False): g.t(x + 3 * A + 8 + 30, b(y), "NULL", S, DIM, MONO) -def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False, dw=None, k=1, view_rows=None): +def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False, dw=None, k=1, view_rows=None, + ties=True): """The band: the list drawn, over the program column, and the heap bytes it is drawn from, over the state column; two panels, h and hv high, the gutter between them the ties'. nodes: (address, value, next address or 0), in the list's order. pins: {address: [registers]}. @@ -704,8 +709,8 @@ def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject= (x + NW / 2, lane_bot)] pin_up(g, x + NW / 2, ny + NH, names, HEAP, LS, via, sw=tie_w[0]) - # the projection: the bytes a step read, and the part of the drawing that is those bytes - if marks.get("read"): + # the projection: the bytes a step read, and the part of the drawing that is those bytes (the map draws none) + if marks.get("read") and ties: a = marks["read"] & ~15 yy, x = rows[a], xs[a] bracket(g, RX + 7, yy + 2, yy + ROW - 2, READ, 3, 6) @@ -1008,7 +1013,7 @@ def frame_calls(name): yr = TOP + sp["view"] + 12 registers(g, yr, FIB_REGS, FIB_FLAGS, {"rsp": {0: "strike"}, "rdi": {0: "tick"}}) - rows = stack(g, yr + ph(17) + 12, FIB_STACK, FIB_FRAMES) + rows = stack(g, yr + ph(17) + 12, FIB_STACK, FIB_FRAMES, rsp=0x7fffffffed78, roles={5: ("saved rbp", DIM)}) backtrace(g, TOP, sp["view"], FIB_BACKTRACE) calls(g, TOP, sp["band"], fib_calls(5), 8, "main", project_from=rows[0]) @@ -1133,7 +1138,8 @@ def frame_sqlite(name, late): ys = y + TAG + PAD + 5 * ROW changed = {r: {0: "tick"} for r, _, _ in SQ_REGS_120 if r not in ("r12", "rip")} registers(g, yr, SQ_REGS_120, SQ_FLAGS_120, changed) - stack(g, yr + ph(17) + 12, SQ_STACK_120, [("sqlite3BtreeInsert", 0, 1), ("sqlite3VdbeExec", 2, 9)]) + stack(g, yr + ph(17) + 12, SQ_STACK_120, [("sqlite3BtreeInsert", 0, 1), ("sqlite3VdbeExec", 2, 9)], + rsp=0x7fffffffe980, roles={0: ("saved rbp", DIM)}) backtrace(g, TOP, sp["band"], SQ_BT_120, x=LX, note="newest on top", focus=True) base = 0x7fffffffea60 fields(g, TOP, sp["view"], "pX, the row: a BtreePayload, at rsi", base, 48, PAYLOAD, @@ -1147,7 +1153,8 @@ def frame_sqlite(name, late): ys = y + TAG + PAD + 4 * ROW changed = {r: {0: "tick"} for r, _, _ in SQ_REGS_169 if r not in ("r9", "rip")} registers(g, yr, SQ_REGS_169, SQ_FLAGS_169, changed) - stack(g, yr + ph(17) + 12, SQ_STACK_169, [("unixWrite", -1, 5)], note="rsp+20 to rsp+48") + stack(g, yr + ph(17) + 12, SQ_STACK_169, [("unixWrite", -1, 5)], note="rsp+20 to rsp+48", rsp=0x7fffffffe7a0, + roles={4: ("saved rbp", DIM)}) page = bytes(4096 - len(PAGE_END) - len(PAGE0)) # the middle of the page is not drawn: `more` page = PAGE0 + page + PAGE_END kernel(g, TOP, sp["band"], [("pwrite64", 4096), ("pwrite64", 4096), ("fsync", 0), ("pwrite64", 12), @@ -1173,9 +1180,7 @@ if __name__ == "__main__": assert ph(17) + 12 + ph(6) == BOTTOM - TOP - 200 - 12 and ph(7) == 200 # its view, and the stack under it assert ph(5) == 152 assert shared([0x1001910, 0x1001937]) == 5 and shared([0x28b41070]) == 6 - frame("09-context", False) - frame("10-context-step", True) - frame("11-context-lens", True, subject=True) + # 9 to 11 are map.py's: the working frame from the fresh recording, with its minimap frame_calls("12-calls-subject") frame_sqlite("13-sqlite-row", False) frame_sqlite("14-sqlite-page", True) -- cgit v1.3