]> sourceware.org Git - systemtap.git/commitdiff
PR14297: Skip the user's input when scanning for resolved probes
authorJosh Stone <jistone@redhat.com>
Wed, 15 May 2013 19:51:33 +0000 (12:51 -0700)
committerJosh Stone <jistone@redhat.com>
Wed, 15 May 2013 19:51:33 +0000 (12:51 -0700)
* elaborate.cxx (derived_probe::script_location): Sweep the derivation
  chain from its second-to-last, so we get at least one level of
  resolution from the user's input.
* testsuite/systemtap.base/list.exp: Add a case for kernel init_once,
  which demonstrates listing the @file:line is useful to disambiguate.
  Add a case for 'begin' too, the simplest expansion we have.

elaborate.cxx
testsuite/systemtap.base/list.exp

index efae1666eacc21202c18d0732a89116bc83a8d4a..28282cd4745ecf6c0741e33cae487d6413bc3a25 100644 (file)
@@ -163,7 +163,11 @@ derived_probe::script_location () const
   vector<probe_point*> chain;
   collect_derivation_pp_chain (chain);
 
-  for (int i=chain.size()-1; i>=0; i--)
+  // NB: we actually start looking from the second-to-last item, so the user's
+  // direct input is not considered.  Input like 'kernel.function("init_once")'
+  // will thus be listed with the resolved @file:line too, disambiguating the
+  // distinct functions by this name, and matching our historical behavior.
+  for (int i=chain.size()-2; i>=0; i--)
     {
       probe_point pp_copy (* chain [i]);
       // drop any ?/! denotations that would confuse a glob-char search
index 9cc4d9ecccfa8cf4d130f08644879e20a6ab2d23..3e3fe94f7b2d34f16166e01a59f20009d07154c7 100644 (file)
@@ -85,3 +85,43 @@ expect {
     eof { fail $test }
 }
 catch { close }; catch { wait }
+
+set test init_once-glob
+spawn stap -l {kernel.function("init_once*")}
+expect {
+    -re {kernel.function."init_once@fs/inode.c:\d+".\r\n} { pass $test }
+    -re {^[^\r\n]*\r\n} { exp_continue }
+    timeout { fail $test }
+    eof { fail $test }
+}
+catch { close }; catch { wait }
+
+set test init_once-noglob
+spawn stap -l {kernel.function("init_once")}
+expect {
+    -re {kernel.function."init_once@fs/inode.c:\d+".\r\n} { pass $test }
+    -re {^[^\r\n]*\r\n} { exp_continue }
+    timeout { fail $test }
+    eof { fail $test }
+}
+catch { close }; catch { wait }
+
+set test begin-glob
+spawn stap -l {begin*}
+expect {
+    -re {begin\r\n} { pass $test }
+    -re {^[^\r\n]*\r\n} { exp_continue }
+    timeout { fail $test }
+    eof { fail $test }
+}
+catch { close }; catch { wait }
+
+set test begin-noglob
+spawn stap -l {begin}
+expect {
+    -re {begin\r\n} { pass $test }
+    -re {^[^\r\n]*\r\n} { exp_continue }
+    timeout { fail $test }
+    eof { fail $test }
+}
+catch { close }; catch { wait }
This page took 0.038336 seconds and 5 git commands to generate.