From 8ac0639bfc0186acedb11759432a2cfa277193f2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:28:33 -0300 Subject: static probes from the debugger: -b usdt:PROVIDER:NAME, no root Debugger.usdt arms the USDT probes of every mapped module as breakpoints whose hook records a probe event with its arguments and lets the program run on, raising a probe's semaphore first; record and dbg take usdt:PROVIDER:NAME (* for any), running the loader through when the probe is a library's. glibc's own 78 probes are there for the asking: memory_sbrk_more shows malloc growing the heap. --- src/cli/dbg.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/cli/dbg.zig') diff --git a/src/cli/dbg.zig b/src/cli/dbg.zig index 6876f84..02cebbc 100644 --- a/src/cli/dbg.zig +++ b/src/cli/dbg.zig @@ -168,7 +168,13 @@ const Session = struct { _ = try if (is(cmd, "step", "s")) s.d.step() else if (is(cmd, "stepi", "si")) s.d.stepi() else s.d.cont(); try s.showStop(); } else if (is(cmd, "break", "b")) { - const addr = try s.d.resolve(arg orelse return error.MissingArgument); + const where = arg orelse return error.MissingArgument; + if (std.mem.startsWith(u8, where, "usdt:")) { + s.rec.cut |= zt.Kind.probe.bit(); + try s.w.print("{d} probes armed: each hit is recorded, the program runs on\n", .{try s.d.usdt(where[5..])}); + return true; + } + const addr = try s.d.resolve(where); try s.w.print("breakpoint {d} at ", .{try s.d.breakAt(addr, null)}); try s.d.describe(s.w, addr); try s.w.writeAll("\n"); -- cgit v1.3