This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix target_set tapset.


Add pid removal on exit syscall. Use dwarfless syscall probe aliases.
Correct formatting.
---
 tapset/target_set.stp |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tapset/target_set.stp b/tapset/target_set.stp
index c7878c5..e27c3c7 100644
--- a/tapset/target_set.stp
+++ b/tapset/target_set.stp
@@ -3,25 +3,33 @@ global _target_set # map: target-set-pid -> ancestor-pid
 
 function target_set_pid (pid)
 {
-  return ([pid] in _target_set)	 
+	return ([pid] in _target_set)
 }
 
 probe begin
 {
-  if (target()) _target_set [target()] = stp_pid()
+	if (target())
+		_target_set[target()] = stp_pid()
 }
 
-probe syscall.fork.return
+probe nd_syscall.fork.return
 {
-  pid=pid()
-  if (pid in _target_set) next
-  ppid=ppid()
-  if (ppid in _target_set) _target_set[pid]=ppid
+	pid = pid()
+	if (pid in _target_set)
+		next
+	ppid = ppid()
+	if (ppid in _target_set)
+		_target_set[pid] = ppid
+}
+
+probe nd_syscall.exit
+{
+	delete _target_set[pid()]
 }
 
 function target_set_report ()
 {
-  printf("target set:\n")
-  foreach (pid in _target_set+)
-    printf("%d begat %d\n", _target_set[pid], pid)
+	printf("target set:\n")
+	foreach (pid in _target_set+)
+		printf("%d begat %d\n", _target_set[pid], pid)
 }
-- 
1.5.6.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]