diff options
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)) |
