3 # Copyright (C) 2010 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # ` = 0' is there to prevent: WARNING: never-assigned global variable
22 /* systemtap bug? /usr/share/doc/systemtap-1.3/SystemTap_Beginners_Guide.pdf
23 Example 3.19 reads or writes? */
33 function heading:string ()
35 foreach (tidi in trace limit 2)
40 /* strace really calls TID a "pid". */
41 return sprintf ("[pid %5d] ", tid ())
49 function destroy (tid:long)
54 function lhs:string (tid:long)
60 foreach (tid in namea)
61 printf ("%s = ? <tracer terminated>\n", lhs (tid))
64 /* BUG: sleeping function called from invalid context at kernel/mutex.c:94
65 %{static DEFINE_MUTEX (tracer_mutex);%}
68 mutex_lock (&tracer_mutex);
72 mutex_unlock (&tracer_mutex);
76 function lock () { dummy = 1; }
77 function unlock () { dummy = 1; }
89 if (opt_f && trace[tid ()] != 0)
91 /* systemtap bug? Why `new_pid' is provided but `new_tid' is not? */
92 new_tid = task_tid (task)
95 printf ("Process %d attached\n", new_tid);
99 probe kprocess.release
101 /* systemtap bug? Why `pid' is provided but `tid' is not? */
102 /* systemtap bug? Why `[pt]id' is not called `released_[pt]id' to keep the
103 naming in sync with kprocess.create? */
104 tid = task_tid (task)
107 if (namea[tid] != "")
109 printf ("%s = ?\n", lhs (tid))
115 /* systemtap bug? exit_group(2) systemtap calls "exit" and _exit(2)
116 is not caught at all. */
118 if (last_tid != tid () && namea[last_tid] != "")
119 printf (" <unfinished ...>\n")
121 printf ("%s_exit(?) = ?\n", heading ())
126 printf ("Process %d detached\n", tid);
131 if (trace[tid ()] != 0)
134 /* Why is mmap() called recursively twice? */
135 if (namea[last_tid] != "")
136 printf (" <unfinished ...>\n")
139 printf ("%s%s(%s", heading (), name, argstr)
143 probe syscall.*.return
145 if (trace[tid ()] != 0)
148 if (last_tid != tid () && namea[last_tid] != "")
149 printf (" <unfinished ...>\n")
150 if ((last_tid != tid () && namea[last_tid] != "")
151 || (last_tid == tid () && namea[last_tid] == ""))
152 printf ("%s<... %s resumed> ", heading (), name);
154 printf (") = %s\n", retstr)