diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-13 13:56:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-13 13:56:12 -0300 |
| commit | 4b76c25dc90417a9d6c3d4cd5af0dd3d4c087520 (patch) | |
| tree | 36b9649bc711e49c595369b38f38226dd263e24b /gui | |
| parent | 5adffa613619eea42405d0cfdb402705e0f4751f (diff) | |
| download | computeranim-4b76c25dc90417a9d6c3d4cd5af0dd3d4c087520.tar.gz computeranim-4b76c25dc90417a9d6c3d4cd5af0dd3d4c087520.zip | |
debugger: link computed operands and stack offsets
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/README.md | 7 | ||||
| -rw-r--r-- | gui/bench/RESULTS.md | 17 | ||||
| -rw-r--r-- | gui/src/app.zig | 2 | ||||
| -rw-r--r-- | gui/targets/segments.c | 9 | ||||
| -rw-r--r-- | gui/test/lenses.py | 89 |
5 files changed, 120 insertions, 4 deletions
diff --git a/gui/README.md b/gui/README.md index 288261e..36e4a1c 100644 --- a/gui/README.md +++ b/gui/README.md @@ -91,6 +91,12 @@ surrounding rows dim. Shift-wheel, headers and gaps scroll the lens chain. Right-click sends stack addresses to the stack pane and every other address to memory. Matching addresses get staggered background highlights: the selected occurrence appears first, followed by its peers. Lens ancestry keeps its connectors. +Stack offsets use the same hover/click behavior as their storage addresses. +Disassembly brackets also link simple 64-bit base/index/scale/displacement addresses, +including `lea`, using the selected stop's registers only at its PC. RIP-relative +and absolute addresses work on other rows too. Future/past register values, +segment overrides and 32-bit addressing are not inferred. Truncated brackets +have no hidden hit target. These links work in executable lenses too. Memory's two header controls choose 8/16/32/64-bit groups and hexadecimal, unsigned, signed or floating-point values (little endian). `memory-format SIZE @@ -99,6 +105,7 @@ floats require 4 or 8 bytes. Unknown bytes stay unknown; these controls only change rendering. Recognized pointer fields are clickable across all their bytes, including 8-bit view: left-click opens a lens; right-click opens stack or memory. Wide values remain reachable with Shift-h/l. +Hex bytes have no persistent group background; hover and access highlights remain. Lenses keep an opaque reading surface, with a native GPU backdrop shader for edge refraction, subtle color separation and a cyan rim. A canvas-sized texture and one reusable lens snapshot diff --git a/gui/bench/RESULTS.md b/gui/bench/RESULTS.md index 54ecf4e..af16175 100644 --- a/gui/bench/RESULTS.md +++ b/gui/bench/RESULTS.md @@ -196,3 +196,20 @@ The updated native session (GUI20122, d8 20207) remains at `Deoptimizer::New+4` `0x7f24dbbe3f74`, with wrong-map origin `0x7f247ac00ffa` and JS guard `0x7f247ac00c14`; recording `/tmp/ztrace-gui-20122-9224949592653.ztrace`. A native 8-bit hexdump click opened the saved-stack-pointer lens successfully. + +Stack offsets now expose their storage addresses to the shared hover/click path. +Hex bytes no longer have persistent group backgrounds. Disassembly brackets link +simple 64-bit effective addresses, including LEA, only from registers at the +selected moment's PC; RIP-relative and absolute addresses also work on other rows. +The shared renderer suppresses links when the complete bracket is not displayed. +Native and headless checks cover hover, both buttons, indexed operands, future +register operands staying inactive, and historical inspection. The GUI suite +passes with `-j1`; the shared-renderer suite exits successfully, including gallery +comparisons (its usual headless Vulkan warnings remain). Independent code and +screenshot review found no blocking issues. V8 timings were not remeasured. + +Reloaded live session: GUI25666, d8 25705, recording +`/tmp/ztrace-gui-25666-14341833166407.ztrace`. The target is stopped at +`Deoptimizer::New+4`, `0x7f99e5be3f74`, on `deoptimizer.cc:290`. +`rdx = 0x7f9984c00ffa` exactly matches the naturally optimized `jitWork` wrong-map +exit return; originating JS context uses guard `0x7f9984c00c14` at `jit.js:3`. diff --git a/gui/src/app.zig b/gui/src/app.zig index c9600b8..f5ebf3d 100644 --- a/gui/src/app.zig +++ b/gui/src/app.zig @@ -1283,7 +1283,7 @@ fn memoryRow(u: ui.Ui, m: zt.store.Moment, addr: u64, y: f32, room: f32, ascii: if (changed == null) changed = .{ @intCast(j - offset), @intCast(j - offset) } else changed.?[1] = @intCast(j - offset); }; const read: f32 = if (touch) |t| if (t.addr < addr +| offset +| 8 and t.addr +| t.len > addr +| offset) 1 else 0 else 0; - run.* = .{ .first = @intCast(offset), .len = 8, .kind = if (canim.rows.regionOf(m, word) != .none) .pointer else .number, .read = read, .heat = if (changed != null) heat else .none, .changed = changed }; + run.* = .{ .first = @intCast(offset), .len = 8, .background = false, .kind = if (canim.rows.regionOf(m, word) != .none) .pointer else .number, .read = read, .heat = if (changed != null) heat else .none, .changed = changed }; } const shift = canim.rows.addressRoom(addr); const text_x: f32 = if (unit == 1 and format == .hex) blk: { diff --git a/gui/targets/segments.c b/gui/targets/segments.c index c52ad3b..b1c51aa 100644 --- a/gui/targets/segments.c +++ b/gui/targets/segments.c @@ -9,6 +9,13 @@ struct node head, middle, tail; volatile uint64_t counter; uint64_t *stack_pointer; __attribute__((noinline)) void checkpoint(void) { __asm__ volatile("" ::: "memory"); } +__attribute__((naked, noinline)) void address_probe(uint64_t *stack, struct node *data, size_t index) { + __asm__ volatile( + ".globl operand_stack\noperand_stack: lea 8(%rdi), %rax\n" + ".globl operand_indexed\noperand_indexed: lea (%rsi,%rdx,8), %rax\n" + ".globl operand_relative\noperand_relative: mov head(%rip), %rax\n" + "ret\n"); +} int main(void) { uint64_t stack_value = 42; @@ -24,5 +31,5 @@ int main(void) { head = (struct node){&middle, 1}; middle = (struct node){&tail, 2}; tail = (struct node){&head, 3}; - for (;;) { ++counter; checkpoint(); } + for (;;) { ++counter; checkpoint(); address_probe(&stack_value, &head, 2); } } diff --git a/gui/test/lenses.py b/gui/test/lenses.py index 9d287fa..528c656 100644 --- a/gui/test/lenses.py +++ b/gui/test/lenses.py @@ -27,6 +27,33 @@ console break checkpoint console continue await execution 1 frames 40 +# Offsets, including negative/zero/positive ones, address their stack storage. +move 0 0 +frames 30 +screenshot {out / 'offset-before.png'} +move 185 863 +frames 30 +screenshot {out / 'offset-hover.png'} +expect-different-screenshot {out / 'offset-before.png'} {out / 'offset-hover.png'} 156 852 42 24 +click 250 863 +print lenses[0].address +key escape +click 185 863 +print lenses[0].address +key escape +console mouse-button 3 185 863 +expect focus stack +print nav[1].place.address +expect nav[1].place.follow false +key f +frames 40 +click 185 935 +print lenses[0].address +key escape +click 185 959 +print lenses[0].address +key escape +expect execution 1 console lens {code} expect lens_count 1 expect lenses[0].first {code} @@ -141,6 +168,60 @@ frames 30 print stops expect execution 1 key escape +# Computed operands use this stop's registers; future register operands stay inert. +hold left_shift +key f +release left_shift +console break operand_stack +key c +await execution 2 +expect pc {symbols['operand_stack']} +console set source false +console set annotations false +console goto code {symbols['operand_stack']} +frames 40 +click 400 180 +expect lens_count 0 +move 0 0 +frames 30 +screenshot {out / 'operand-before.png'} +move 400 156 +frames 30 +screenshot {out / 'operand-hover.png'} +expect-different-screenshot {out / 'operand-before.png'} {out / 'operand-hover.png'} 348 144 108 24 +click 400 156 +expect lens_count 1 +print lenses[0].address +key escape +console mouse-button 3 400 156 +expect focus stack +print nav[1].place.address +# RIP-relative storage is independent of future register values. +click 400 204 +expect lenses[0].address {head} +key escape +console mouse-button 3 400 204 +expect focus memory +expect nav[2].place.address {head} +key s +await execution 3 +expect pc {symbols['operand_indexed']} +frames 40 +click 400 180 +expect lenses[0].address {head + 16} +key escape +console mouse-button 3 400 180 +expect focus memory +expect nav[2].place.address {head + 16} +# Historical operands use historical registers, without another execution. +key left_bracket +expect following false +console goto code {symbols['operand_stack']} +frames 40 +click 400 156 +print lenses[0].address +key escape +expect execution 3 expect-no-log CommandFailed expect-no-log backdrop shader ''' @@ -155,9 +236,13 @@ expect-no-log backdrop shader first = int(re.search(r'lenses\[0\].first = (\d+)', stderr)[1]) assert first > code, (first, code) stack_addresses = re.findall(r'(?:lenses\[0\].address|nav\[1\].place.address) = (\d+)', stderr) - assert len(stack_addresses) == 2 and stack_addresses[0] == stack_addresses[1], stack_addresses + assert len(stack_addresses) == 10, stack_addresses + base, negative, followed, zero, positive, pointer, pointer_followed, operand, operand_followed, historical = map(int, stack_addresses) + assert base == negative == followed and zero == base + 24 and positive == base + 32, stack_addresses + assert pointer == pointer_followed, stack_addresses + assert operand == operand_followed == historical == pointer + 8, stack_addresses stops = re.findall(r'stops = (\d+)', stderr) assert len(stops) == 2 and stops[0] == stops[1], stops for recording in Path('/tmp').glob(f'ztrace-gui-{run.pid}-*.ztrace'): recording.unlink() - print(('Native' if a.native else 'Headless') + ': code/data lenses, context scrolling, pointer recursion, memory formats and historical isolation passed') + print(('Native' if a.native else 'Headless') + ': lenses, stack offsets, computed operands, pointer bytes, formats and historical isolation passed') |
