diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 20:41:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 20:41:07 -0300 |
| commit | 147cc03a90af3782936787bf1da54314a2a4e385 (patch) | |
| tree | ce1fa13ee05c69f6b9464ebb6d00fc56e27bb1b5 /src/trace/debugger_test.zig | |
| parent | dbfab7b5cdd76787b6cca72f792acfa3cebcbab5 (diff) | |
| download | computeranim-147cc03a90af3782936787bf1da54314a2a4e385.tar.gz computeranim-147cc03a90af3782936787bf1da54314a2a4e385.zip | |
backtrace: an outer frame is on its call's line
The debugger records the call each frame returns from, as an instruction
with its line; canim reads it. main is at list.c:41 while reverse()
runs, not at 42, and the rows of a stop deep in SQLite have their lines.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'src/trace/debugger_test.zig')
| -rw-r--r-- | src/trace/debugger_test.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/trace/debugger_test.zig b/src/trace/debugger_test.zig index 370876a..512dc6f 100644 --- a/src/trace/debugger_test.zig +++ b/src/trace/debugger_test.zig @@ -130,6 +130,18 @@ test "a recording by `ztrace record` has the line of each instruction round the } else return error.NoCall; try std.testing.expectEqual(@as(?u8, 1), call.params); try std.testing.expectEqual(@as(u32, 5), call.line.?.line); + // The frame that called fib is on its call's line: the call is recorded, `back` from where it returns. + const tids = try m.threads(gpa); + defer gpa.free(tids); + const regs = (try m.regs(tids[0])).?; + var chain: [4]u64 = undefined; + const frames = try zt.telescope.backtrace(m, ®s, &chain); + try std.testing.expect(frames.len >= 2); + const after = (try zt.telescope.instruction(m, frames[1], &text)).?; + try std.testing.expect(after.back != 0); + const caller = (try zt.telescope.instruction(m, frames[1] - after.back, &text)).?; + try std.testing.expect(std.mem.startsWith(u8, caller.text, "call")); + try std.testing.expect(caller.line != null); } test "step walks the source lines, in and out of calls, as gdb does" { |
