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
20 # `opt_f' is a boolean for both -f and -ff.
22 # Modify the [pid %5d] output to [%d] for the -ff postprocessor.
32 tid = opt_child > 0 ? opt_child : target ()
37 function heading (tid:long)
40 return printf ("[%d]", tid)
42 foreach (tidi in trace limit 2)
47 /* strace really calls TID a "pid". */
48 return printf ("[pid %5d] ", tid)
65 if (nest[last_tid] && funcname[last_tid] != "")
67 printf (") = ? <tracer terminated>")
74 printf ("<... %s resumed> ) = ? <tracer terminated>",
75 funcname[tid] != "" ? funcname[tid] : "?");
80 /* BUG: sleeping function called from invalid context at kernel/mutex.c:94 */
81 %{static DEFINE_MUTEX (tracer_mutex);%}
84 if (in_atomic () || irqs_disabled())
89 mutex_lock (&tracer_mutex);
94 mutex_unlock (&tracer_mutex);
97 # systamtap bug? on void function value use no warning is given.
110 #probe kprocess.start
118 probe kprocess.create
120 if (opt_f && trace[tid ()] != 0)
122 /* systemtap bug? Why `new_pid' is provided but `new_tid' is not? */
123 new_tid = task_tid (task)
127 printf ("Process %d attached", new_tid);
133 probe kprocess.release
135 /* systemtap bug? Why `pid' is provided but `tid' is not? */
136 /* systemtap bug? Why `[pt]id' is not called `released_[pt]id' to keep the
137 naming in sync with kprocess.create? */
138 tid = task_tid (task)
144 /* FIXME: Do not assume "exit" for the nested calls. */
145 printf ("<... %s resumed> = ?",
146 funcname[tid] != "" ? funcname[tid] : "exit")
154 printf ("Process %d detached", tid);
161 if (trace[tid ()] != 0 && lock ())
163 /* Why is mmap() called recursively twice? */
164 if (nest[last_tid] && funcname[last_tid] != "")
166 if (last_tid != tid ())
171 print (" <unfinished ...>\n")
175 print (" <unfinished ...>")
180 funcname[tid ()] = name
183 printf ("%s(%s",name, argstr)
187 probe syscall.*.return
189 if (trace[tid ()] != 0 && lock ())
191 if (last_tid != tid () && nest[last_tid] && funcname[last_tid] != "")
196 print (" <unfinished ...>\n")
198 if (last_tid != tid ())
202 printf ("<... %s resumed> ", name);
204 if (last_tid == tid () && funcname[last_tid] == "")
207 printf ("<... %s resumed> ", name);
210 printf (") = %s", retstr)
214 delete funcname[tid ()]