summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--stapprobes.5.in6
-rw-r--r--tapsets.cxx12
-rwxr-xr-xtestsuite/semko/fortyseven.stp5
4 files changed, 23 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e40f1e7..9b59e6e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-11 Frank Ch. Eigler <fche@elastic.org>
+
+ PR5049
+ PR5049
+ * tapsets.cxx (cu_name_matches, collect_srcfiles_matching):
+ Implicitly but optionally prefix probe source filenames with "*/".
+ * stapprobes.5.in: Document this.
+
2008-08-11 Dave Brolley <brolley@redhat.com>
* stap-client (disconnect_from_server): Call after receive_response.
diff --git a/stapprobes.5.in b/stapprobes.5.in
index bb82ac30..d20ea006 100644
--- a/stapprobes.5.in
+++ b/stapprobes.5.in
@@ -292,10 +292,10 @@ operators to match multiple names.
The second part is optional and begins with the "@" character.
It is followed by the path to the source file containing the function,
which may include a wildcard pattern, such as mm/slab*.
-An implicit "*" is added
+If it does not match as is, an implicit "*/" is optionally added
.I before
-the name, so that a script need only name the last few components of
-a possibly long source directory path.
+the pattern, so that a script need only name the last few components
+of a possibly long source directory path.
.IP \(bu 4
Finally, the third part is optional if the file name part was given,
and identifies the line number in the source file preceded by a ":"
diff --git a/tapsets.cxx b/tapsets.cxx
index d4745b9f..af9fda52 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -858,11 +858,12 @@ struct dwflpp
// PR 5049: implicit * in front of given path pattern.
// NB: fnmatch() is used without FNM_PATHNAME.
- string prefixed_pattern = string("*") + pattern;
+ string prefixed_pattern = string("*/") + pattern;
- bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0);
+ bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0 ||
+ fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0);
if (t && sess.verbose>3)
- clog << "pattern '" << prefixed_pattern << "' "
+ clog << "pattern '" << pattern << "' "
<< "matches "
<< "CU '" << cu_name << "'" << "\n";
return t;
@@ -1372,7 +1373,7 @@ struct dwflpp
// PR 5049: implicit * in front of given path pattern.
// NB: fnmatch() is used without FNM_PATHNAME.
- string prefixed_pattern = string("*") + pattern;
+ string prefixed_pattern = string("*/") + pattern;
dwarf_assert ("dwarf_getsrcfiles",
dwarf_getsrcfiles (cu, &srcfiles, &nfiles));
@@ -1380,7 +1381,8 @@ struct dwflpp
for (size_t i = 0; i < nfiles; ++i)
{
char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL);
- if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0)
+ if (fnmatch (pattern.c_str(), fname, 0) == 0 ||
+ fnmatch (prefixed_pattern.c_str(), fname, 0) == 0)
{
filtered_srcfiles.insert (fname);
if (sess.verbose>2)
diff --git a/testsuite/semko/fortyseven.stp b/testsuite/semko/fortyseven.stp
new file mode 100755
index 00000000..5b8cba38
--- /dev/null
+++ b/testsuite/semko/fortyseven.stp
@@ -0,0 +1,5 @@
+#! stap -p2
+
+# PR5049
+
+probe kernel.function("*@ket.c") {} # must not match "....packet.c"