So, here's a possibly better way. The script-side interface
would look like:
probe process(PID).itrace { }
probe process(PID).btrace { } # block trace
probe process(NAME).itrace { }
probe process(NAME).btrace { }
The name variant could be implemented by a startup-time mapping of
execname->pid. There's probably a utrace hook that will let us be
notified of execs, so that we can keep the mapping up-to-date during
run time.
Since utrace will provide the pt_regs structure, the probe handler
bodies will be able to call e.g. backtrace(), probefunc(), and really
should have some structured access to the registers (a new tapset
function like register:long ("name") ?)
It's also a bit risky to expose the on/off functionality as explicit
functions (though an end-user script or tapset could be more assured
of proper cleanup using "probe end,error {...}".) But of course it's
desirable to turn things on/off dynamically, so how? A special case
of bug #4935 might be the ticket, once that is complete:
probe process(PID).itrace if (condition) { }
probe process(PID).function("NAME") { condition = 1 }
probe process(PID).function("NAME").return { condition = 0 }