]> sourceware.org Git - systemtap.git/commitdiff
PR5049: prefix with "*" any filenames given in "fn@filename:line" probes
authorFrank Ch. Eigler <fche@elastic.org>
Mon, 11 Aug 2008 17:18:12 +0000 (13:18 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Mon, 11 Aug 2008 17:24:57 +0000 (13:24 -0400)
ChangeLog
tapsets.cxx
testsuite/ChangeLog
testsuite/semok/thirtyone.stp [new file with mode: 0755]

index b312bc3453d87b8b0662eff036348a042aef1824..f0a2307d0d2d51720cee083026cb64ac3614c813 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-11  Frank Ch. Eigler  <fche@elastic.org>
+
+       PR5049
+       * tapsets.cxx (cu_name_matches, collect_srcfiles_matching):
+       Implicitly prefix probe source filenames with "*".
+
 2008-08-09  Frank Ch. Eigler  <fche@elastic.org>
 
        * main.cxx (main): Don't override $PATH etc.
index d9e0ebda882352fd75117b1dac3e3f2504c04736..48947a6011a5a9400612bcbfd70a4fc584b8dd14 100644 (file)
@@ -850,9 +850,14 @@ struct dwflpp
   bool cu_name_matches(string pattern)
   {
     assert(cu);
-    bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0);
+
+    // PR 5049: implicit * in front of given path pattern.
+    // NB: fnmatch() is used without FNM_PATHNAME.
+    string prefixed_pattern = string("*") + pattern;
+
+    bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0);
     if (t && sess.verbose>3)
-      clog << "pattern '" << pattern << "' "
+      clog << "pattern '" << prefixed_pattern << "' "
           << "matches "
           << "CU '" << cu_name << "'" << "\n";
     return t;
@@ -1292,13 +1297,17 @@ struct dwflpp
     size_t nfiles;
     Dwarf_Files *srcfiles;
 
+    // PR 5049: implicit * in front of given path pattern.
+    // NB: fnmatch() is used without FNM_PATHNAME.
+    string prefixed_pattern = string("*") + pattern;
+
     dwarf_assert ("dwarf_getsrcfiles",
                  dwarf_getsrcfiles (cu, &srcfiles, &nfiles));
     {
     for (size_t i = 0; i < nfiles; ++i)
       {
        char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL);
-       if (fnmatch (pattern.c_str(), fname, 0) == 0)
+       if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0)
          {
            filtered_srcfiles.insert (fname);
            if (sess.verbose>2)
index 9dd388ad57de37a25127df2c42d1650c33180bde..9ee9037edb04b5717125dfba13078b3e142cd1f4 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-11  Frank Ch. Eigler  <fche@elastic.org>
+
+       PR5049
+       * semok/thirtyone.stp: New test.
+
 2008-08-05  Stan Cox  <scox@redhat.com>
 
        * systemtap.base/warnings.stp: Use relative instead of absolute line.
diff --git a/testsuite/semok/thirtyone.stp b/testsuite/semok/thirtyone.stp
new file mode 100755 (executable)
index 0000000..5036e45
--- /dev/null
@@ -0,0 +1,5 @@
+#! stap -p2
+
+# PR5049
+
+probe kernel.function("*@module.c") {}
This page took 0.049461 seconds and 5 git commands to generate.