From d4e703115e97fab72a79108e6a592743fd0d732b Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 26 Dec 2010 01:12:30 +0100 Subject: [PATCH] -ff output coherency fixes. --- src/staptrace.c | 4 +++- src/staptrace.stp | 31 +++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/staptrace.c b/src/staptrace.c index 3797008..c2cf39b 100644 --- a/src/staptrace.c +++ b/src/staptrace.c @@ -276,7 +276,8 @@ ff_filter (int fd_read) if (*start != '[') error (EXIT_FAILURE, 0, - _("'[' expected in the internal -ff stream")); + _("'[' (at 0x%lx) expected in the internal -ff stream"), + (unsigned long) (start - buf)); if (start[1] == 0) { /* We need more data. */ @@ -428,6 +429,7 @@ main (int argc, char **argv) break; } + *argp++ = "-g"; *argp++ = opt_Z; *argp = NULL; diff --git a/src/staptrace.stp b/src/staptrace.stp index 263a5b4..692abed 100755 --- a/src/staptrace.stp +++ b/src/staptrace.stp @@ -65,7 +65,7 @@ function realnl () probe end { - if (nest[last_tid]) + if (nest[last_tid] && funcname[last_tid] != "") { printf (") = ? ") realnl () @@ -80,26 +80,35 @@ probe end } } -/* BUG: sleeping function called from invalid context at kernel/mutex.c:94 +/* BUG: sleeping function called from invalid context at kernel/mutex.c:94 */ %{static DEFINE_MUTEX (tracer_mutex);%} -function lock () +function lock:long () %{ + if (in_atomic () || irqs_disabled()) + { + THIS->__retvalue = 0; + return; + } mutex_lock (&tracer_mutex); + THIS->__retvalue = 1; %} function unlock () %{ mutex_unlock (&tracer_mutex); %} -*/ +/* +# systamtap bug? on void function value use no warning is given. global lockvar -function lock () +function lock:long () { lockvar++ + return 1 } function unlock () { - lockvar++ + lockvar-- } +*/ #probe kprocess.start #{ @@ -152,11 +161,10 @@ probe kprocess.release } probe syscall.* { - if (trace[tid ()] != 0) + if (trace[tid ()] != 0 && lock ()) { - lock () /* Why is mmap() called recursively twice? */ - if (nest[last_tid]) + if (nest[last_tid] && funcname[last_tid] != "") { if (last_tid != tid ()) { @@ -181,10 +189,9 @@ probe syscall.* } probe syscall.*.return { - if (trace[tid ()] != 0) + if (trace[tid ()] != 0 && lock ()) { - lock () - if (last_tid != tid () && nest[last_tid]) + if (last_tid != tid () && nest[last_tid] && funcname[last_tid] != "") { if (opt_ff) print ("c\n") -- 1.8.3.1