-ff output coherency fixes.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 26 Dec 2010 00:12:30 +0000 (01:12 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 26 Dec 2010 00:12:30 +0000 (01:12 +0100)
src/staptrace.c
src/staptrace.stp

index 3797008..c2cf39b 100644 (file)
@@ -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;
 
index 263a5b4..692abed 100755 (executable)
@@ -65,7 +65,7 @@ function realnl ()
 
 probe end
 {
-  if (nest[last_tid])
+  if (nest[last_tid] && funcname[last_tid] != "")
     {
       printf (") = ? <tracer terminated>")
       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")