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/>.
32 function heading:string ()
36 /* strace really calls TID a "pid". */
37 return sprintf ("[pid %5d] ", tid ())
45 function destroy (tid:long)
50 function lhs:string (tid:long)
56 foreach (tid in namea)
57 printf ("%s = ? <tracer terminated>\n", lhs (tid))
60 /* BUG: sleeping function called from invalid context at kernel/mutex.c:94
61 %{static DEFINE_MUTEX (tracer_mutex);%}
64 mutex_lock (&tracer_mutex);
68 mutex_unlock (&tracer_mutex);
72 function lock () { dummy = 1; }
73 function unlock () { dummy = 1; }
87 if (opt_f && trace[tid ()] != 0)
89 /* systemtap bug? Why `new_pid' is provided but `new_tid' is not? */
90 new_tid = task_tid (task)
94 printf ("Process %d attached\n", new_tid);
98 probe kprocess.release
100 /* systemtap bug? Why `pid' is provided but `tid' is not? */
101 /* systemtap bug? Why `[pt]id' is not called `released_[pt]id' to keep the
102 naming in sync with kprocess.create? */
103 tid = task_tid (task)
106 if (namea[tid] != "")
108 printf ("%s = ?\n", lhs (tid))
114 /* systemtap bug? exit_group(2) systemtap calls "exit" and _exit(2)
115 is not caught at all. */
117 if (last_tid != tid () && namea[last_tid] != "")
118 printf (" <unfinished ...>\n")
120 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)