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.
28 /* systemtap bug? /usr/share/doc/systemtap-1.3/SystemTap_Beginners_Guide.pdf
29 Example 3.19 reads or writes? */
35 tid = opt_child > 0 ? opt_child : target ()
40 function heading (tid:long)
43 return printf ("[%d]", tid)
45 foreach (tidi in trace limit 2)
50 /* strace really calls TID a "pid". */
51 return printf ("[pid %5d] ", tid)
70 printf (") = ? <tracer terminated>")
77 printf ("<... %s resumed> ) = ? <tracer terminated>",
78 funcname[tid] != "" ? funcname[tid] : "?");
83 /* BUG: sleeping function called from invalid context at kernel/mutex.c:94
84 %{static DEFINE_MUTEX (tracer_mutex);%}
87 mutex_lock (&tracer_mutex);
91 mutex_unlock (&tracer_mutex);
104 #probe kprocess.start
112 probe kprocess.create
114 if (opt_f && trace[tid ()] != 0)
116 /* systemtap bug? Why `new_pid' is provided but `new_tid' is not? */
117 new_tid = task_tid (task)
121 printf ("Process %d attached", new_tid);
127 probe kprocess.release
129 /* systemtap bug? Why `pid' is provided but `tid' is not? */
130 /* systemtap bug? Why `[pt]id' is not called `released_[pt]id' to keep the
131 naming in sync with kprocess.create? */
132 tid = task_tid (task)
138 /* FIXME: Do not assume "exit" for the nested calls. */
139 printf ("<... %s resumed> = ?",
140 funcname[tid] != "" ? funcname[tid] : "exit")
148 printf ("Process %d detached", tid);
155 if (trace[tid ()] != 0)
158 /* Why is mmap() called recursively twice? */
161 if (last_tid != tid ())
166 print (" <unfinished ...>\n")
170 print (" <unfinished ...>")
175 funcname[tid ()] = name
178 printf ("%s(%s",name, argstr)
182 probe syscall.*.return
184 if (trace[tid ()] != 0)
187 if (last_tid != tid () && nest[last_tid])
192 print (" <unfinished ...>\n")
194 if (last_tid != tid ())
198 printf ("<... %s resumed> ", name);
200 if (last_tid == tid () && funcname[last_tid] == "")
203 printf ("<... %s resumed> ", name);
206 printf (") = %s", retstr)
210 delete funcname[tid ()]