diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 00:06:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 01:16:48 -0300 |
| commit | c3d9f7ba5effd615374b1359ad98ecf801559f83 (patch) | |
| tree | 07f85932abc1df23c722bcd1bd1b3b65bca28f2e /anim/src/Recording.zig | |
| parent | c94ade9e77a811d3ff75ffc2889a65375262ab1f (diff) | |
| download | computeranim-c3d9f7ba5effd615374b1359ad98ecf801559f83.tar.gz computeranim-c3d9f7ba5effd615374b1359ad98ecf801559f83.zip | |
canim: a call followed down to the kernel; rows that say what they do; the heap from the inside
From the user. The disassembly can descend: the syscalls scene is glibc's
hello by instruction, and open is followed from main through its PLT
stub, whose jmp reads the GOT, into libc's wrapper to the syscall row,
which crosses to the kernel's window under it, and back up. The band
keeps the calls so far as strace writes them. Operands lose their size
words and show a width as byte cells only where nothing else says it. A
compare shows its values and the flags it leaves, a jump the flags it
reads, lea its result, an indirect jump its target and the slot it read,
a call that has run its C form. The backtrace has its newest frame at
the bottom. A new scene shows glibc 2.44's heap from blocks that exist:
chunks read by fields (a size with its bits, a protected pointer), the
free list as arcs, the tcache in a loupe, the program's list over
malloc's own.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/Recording.zig')
| -rw-r--r-- | anim/src/Recording.zig | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/anim/src/Recording.zig b/anim/src/Recording.zig index 833d17b..1a4d859 100644 --- a/anim/src/Recording.zig +++ b/anim/src/Recording.zig @@ -218,6 +218,14 @@ pub fn ownLine(r: *const Recording, i: u64) ?u32 { return l.line; } +/// Whether the pc at moment `i` is in the program's own source: not in a +/// library's code, a PLT stub, the vDSO (where `own` keeps the last line). +pub fn sourced(r: *const Recording, i: u64) bool { + var buf: [256]u8 = undefined; + const here = r.instruction(i, r.register(i, "rip"), &buf) orelse return r.ownLine(i) != null; + return here.line != null; +} + /// The first line a source panel of `fit` lines shows when the program is /// on `line`: the whole file when it fits; else a window that has the line /// in its middle third, and is the same window for every line of that @@ -425,7 +433,13 @@ fn index(r: *Recording) !void { try touch_list.append(arena, touched); pending = touched; try branch_list.append(arena, branched); - if (ours and regs != null) try code_lines.put(gpa, regs.?.rip, line.line); + // Not where the instruction says it has no line: a library's code (a + // PLT stub, libc) keeps the last line of ours in `lines`, and is not of it. + if (ours and regs != null) { + var text: [256]u8 = undefined; + const here = zt.telescope.instruction(m, regs.?.rip, &text) catch null; + if (here == null or here.?.line != null) try code_lines.put(gpa, regs.?.rip, line.line); + } try registers.append(arena, regs orelse before orelse .{}); if (!told and stepped and regs != null and before != null) { |
