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
24 /* systemtap bug? /usr/share/doc/systemtap-1.3/SystemTap_Beginners_Guide.pdf
25 Example 3.19 reads or writes? */
31 tid = opt_child > 0 ? opt_child : target ()
36 function heading:string (tid:long)
38 foreach (tidi in trace limit 2)
43 /* strace really calls TID a "pid". */
44 return sprintf ("[pid %5d] ", tid)
56 printf (") = ? <tracer terminated>\n")
59 printf ("%s<... %s resumed> ) = ? <tracer terminated>\n", heading (tid),
60 funcname[tid] != "" ? funcname[tid] : "?");
63 /* BUG: sleeping function called from invalid context at kernel/mutex.c:94
64 %{static DEFINE_MUTEX (tracer_mutex);%}
67 mutex_lock (&tracer_mutex);
71 mutex_unlock (&tracer_mutex);
94 if (opt_f && trace[tid ()] != 0)
96 /* systemtap bug? Why `new_pid' is provided but `new_tid' is not? */
97 new_tid = task_tid (task)
100 printf ("Process %d attached\n", new_tid);
104 probe kprocess.release
106 /* systemtap bug? Why `pid' is provided but `tid' is not? */
107 /* systemtap bug? Why `[pt]id' is not called `released_[pt]id' to keep the
108 naming in sync with kprocess.create? */
109 tid = task_tid (task)
114 /* FIXME: Do not assume "exit" for the nested calls. */
115 printf ("%s<... %s resumed> = ?\n", heading (tid),
116 funcname[tid] != "" ? funcname[tid] : "exit")
122 printf ("Process %d detached\n", tid);
127 if (trace[tid ()] != 0)
130 /* Why is mmap() called recursively twice? */
132 printf (" <unfinished ...>\n")
134 funcname[tid ()] = name
136 printf ("%s%s(%s", heading (tid ()), name, argstr)
140 probe syscall.*.return
142 if (trace[tid ()] != 0)
145 if (last_tid != tid () && nest[last_tid])
146 printf (" <unfinished ...>\n")
147 if (last_tid != tid () || (last_tid == tid () && !nest[last_tid]))
148 printf ("%s<... %s resumed> ", heading (tid ()), name);
150 printf (") = %s\n", retstr)
153 delete funcname[tid ()]