From 1902aec1df32bb36c7e71b829a65543e9475ced3 Mon Sep 17 00:00:00 2001 From: fche Date: Fri, 17 Aug 2007 02:25:22 +0000 Subject: 2007-08-16 Frank Ch. Eigler PR 1315. * target_set.stp: New tapset file. * stapfuncs.5.in: Document new target_set tapset. * buildok/fortyfive.stp: New test. --- tapset/target_set.stp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tapset/target_set.stp (limited to 'tapset/target_set.stp') diff --git a/tapset/target_set.stp b/tapset/target_set.stp new file mode 100644 index 00000000..c7878c52 --- /dev/null +++ b/tapset/target_set.stp @@ -0,0 +1,27 @@ + +global _target_set # map: target-set-pid -> ancestor-pid + +function target_set_pid (pid) +{ + return ([pid] in _target_set) +} + +probe begin +{ + if (target()) _target_set [target()] = stp_pid() +} + +probe syscall.fork.return +{ + pid=pid() + if (pid in _target_set) next + ppid=ppid() + if (ppid in _target_set) _target_set[pid]=ppid +} + +function target_set_report () +{ + printf("target set:\n") + foreach (pid in _target_set+) + printf("%d begat %d\n", _target_set[pid], pid) +} -- cgit