This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] searching all Dwarf_Die for kernel.statement


Hi,
In recent systemtap source, the script kernel.statement(xxx) couldn't work well due to failing in founding matched probe point. Also the testcase systemtap.base/stmtvars.exp won't pass in machines. It came from the commit 6561773f763d40c00a115b53493ecf2d4f425d0d "PR5643: function caching for much faster syscall.* pass-2 processing".


The problem is like:

#stap -u -p2 -vve 'probe kernel.function("__kmalloc") {abc}'
SystemTap translator/driver (version 0.7/0.131 git branch master, commit dbb280c7)
Copyright (C) 2005-2008 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
Created temporary directory "/tmp/stapvBKkFm"
Searched '/usr/local/share/systemtap/tapset/i686/*.stp', found 2
Searched '/usr/local/share/systemtap/tapset/*.stp', found 40
Pass 1: parsed user script and 42 library script(s) in 380usr/40sys/421real ms.
probe __kmalloc@mm/slab.c:3747 kernel section=.text pc=0xc0140b30
semantic error: probe_1450 with unresolved type: identifier 'abc' at <input>:1:37


But if we run kernel.statement() with the pc equaling to the address of function __kmalloc

# stap -u -p2 -vve 'probe kernel.statement(0xc0140b30) {}'
SystemTap translator/driver (version 0.7/0.131 git branch master, commit dbb280c7)
Copyright (C) 2005-2008 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
Created temporary directory "/tmp/stapV2mvpd"
Searched '/usr/local/share/systemtap/tapset/i686/*.stp', found 2
Searched '/usr/local/share/systemtap/tapset/*.stp', found 40
Pass 1: parsed user script and 42 library script(s) in 420usr/30sys/453real ms.
semantic error: no match while resolving probe point kernel.statement(3222539056)
semantic error: no probes found


In fact, the probe point is there. The error message is not correct.
The following patch will solve the problem which enables searching all vectors in case of kernel.statement.


Best regards,
Wenji
diff --git a/tapsets.cxx b/tapsets.cxx
index f3f9b59..d61aa72 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2527,6 +2527,15 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, void * arg),
             }
         }
     }
+  else if (q->has_statement_num) // searching all for kernel.statement
+   {
+      for (cu_function_cache_t::iterator it = v->begin(); it != v->end(); it++)
+        {
+         Dwarf_Die die = it->second;
+         rc = (*callback)(& die, data);
+         if (rc != DWARF_CB_OK) break;
+        }
+   }
   else // not a wildcard and no match in this CU
     {
       // do nothing

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]