Debian Codegraph @

tapset/dyninst/target_set.stp

raw
1 // NB: functionally equivalent to linux/target_set.stp
2
3 @__private30 global _target_set # map: target-set-pid -> ancestor-pid
4
5 function target_set_pid (pid)
6 {
7 return ([pid] in _target_set)
8 }
9
10 probe init
11 {
12 if (target())
13 _target_set[target()] = stp_pid()
14 }
15
16 probe process.begin
17 {
18 // NB: by definition, every process we see in stapdyn is part of the
19 // target set, so we don't need to filter like linux/target_set.stp.
20 _target_set[pid()] = ppid()
21 }
22
23 probe process.end
24 {
25 delete _target_set[pid()]
26 }
27
28 function target_set_report ()
29 {
30 printf("target set:\n")
31 foreach (pid in _target_set+)
32 printf("%d begat %d\n", _target_set[pid], pid)
33 }