diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 10:38:37 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 10:40:03 -0300 |
| commit | 6142fa676731e158622ca7956c150c58bc57f1f2 (patch) | |
| tree | 7413e5740a83c07caa769ee35c57cb770875e0dc /design/mock/context.py | |
| parent | 6a7a87b8ecb7902de5640cad00028997825024d2 (diff) | |
| download | computeranim-6142fa676731e158622ca7956c150c58bc57f1f2.tar.gz computeranim-6142fa676731e158622ca7956c150c58bc57f1f2.zip | |
design: the graph of a function's blocks; two runs as a pair
From the user. The disassembly's alternate form at a larger scale is the
graph of its basic blocks: a block a box of rows with its offset, lines
and visit count; execution flows down and a back edge is the one thing
that climbs, in its loop's lane with the turn count; what the run never
reached folds away. On the map it takes the disassembly's place; in the
working frame a blocks lens draws its shape and the rows are its view.
Verbs leave and turn carry the mark along an edge.
Two runs of one program share a frame as a pair: the seam is the gutter,
the source shared above, rows only one run has and values that differ
marked at the seam. The scene it is made for sets a plain build against
an ASan one in a stack overflow: the frame beside its shadow bytes, the
store beside its check, and the step where they part.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'design/mock/context.py')
| -rw-r--r-- | design/mock/context.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/design/mock/context.py b/design/mock/context.py index a040109..d58683c 100644 --- a/design/mock/context.py +++ b/design/mock/context.py @@ -332,14 +332,15 @@ def registers(g, y, regs, flags, marks): return where -def stack(g, y, rows, frames, note=None, rsp=None, roles=None, touched=(), chain_too=False): +def stack(g, y, rows, frames, note=None, rsp=None, roles=None, touched=(), chain_too=False, title="stack", + ink_of=None): """rows: (slot, pins, links, end[, marks]). frames: (name, first row, last row), newest first: the backtrace, drawn on the words that are each frame; a first row under 0 runs above the window. The window is the newest frame's. A frame's name is never cut for a chain: the chains on the rows it sits on end 12 before it. rsp: the slots' offsets from it are drawn (pwndbg's column). roles: {row: (what the slot is, ink)}: a local's name, `saved rbp`, `return`, ranged right where the chain's room ends; the chain ends 12 before it. Returns each row's y.""" - y0 = panel(g, RX, y, CW, len(rows), "stack", note=(note or "%s words from rsp" % {6: "six", 8: "eight"}[len(rows)]) + y0 = panel(g, RX, y, CW, len(rows), title, note=(note or "%s words from rsp" % {6: "six", 8: "eight"}[len(rows)]) + " ยท the frames they belong to") lead = shared([r[0] for r in rows]) room = {} # a row's chain ends here, where a frame's name begins @@ -376,7 +377,8 @@ def stack(g, y, rows, frames, note=None, rsp=None, roles=None, touched=(), chain text, ink = roles[i] g.t(end_x, b(yy), text, S, ink, MONO, "end") end_x -= len(text) * A + 12 - chain(g, first, yy, [(slot, STACK)] + links, end, marks[0] if marks else None, room=end_x, lead=lead) + chain(g, first, yy, [(slot, ink_of(slot) if ink_of else STACK)] + links, end, marks[0] if marks else None, + room=end_x, lead=lead) # the arcs: a word holding the address of a slot in the window. The frame chain (a saved rbp) is the spans' # already, and is drawn only when the step touches it. slots = {r[0]: ys[i] for i, r in enumerate(rows)} @@ -538,8 +540,8 @@ def insn_rows(g, y0, rows, cur_line, w=0, lead=None, sizes=False): for i, (a, line, mn, ops, st, note) in enumerate(rows): yy = y0 + i * ROW where[a] = yy - dim = st == "out" - if dim or st == "other_first": # a function ends: a rule, and the next one's name + dim = st in ("out", "skip") # skip: on the page, not on the path this run takes + if st in ("out", "other_first"): # a function ends: a rule, and the next one's name g.rect(LX + 2, yy, CW - 4, 2, RULE) if st == "cur": g.path(f"M{LX + 20},{yy + 12} l-10,-6 v12 Z", fill=current_row(g, LX + 2, yy, CW - 4, 24)) |
