diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2009-07-08 13:04:10 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2009-07-08 13:09:36 -0400 |
commit | 665e12562a4aa4f40aeeed0cfd207b49f89c9fd1 (patch) | |
tree | 617016b8b0f71394217792ae7e571b4e40022383 /dwflpp.cxx | |
parent | 619d9aaf011c975159a79d34259083a596162bf1 (diff) | |
download | systemtap-steved-665e12562a4aa4f40aeeed0cfd207b49f89c9fd1.tar.gz systemtap-steved-665e12562a4aa4f40aeeed0cfd207b49f89c9fd1.tar.xz systemtap-steved-665e12562a4aa4f40aeeed0cfd207b49f89c9fd1.zip |
PR3498 cont'd, fix wildcard module("*") probes
* dwflpp.cxx (name_has_wildcard): Make static.
(dwfl_report_offline_predicate): Check & adjust behavior.
* dwflpp.h: Corresponding changes.
* tapsets.cxx: Note that kern_dw[] keys may be wildcard strings.
* testsuite/buildok/fortysix.stp: New test.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r-- | dwflpp.cxx | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -205,7 +205,7 @@ dwflpp::module_name_matches(const string& pattern) bool -dwflpp::name_has_wildcard(const string& pattern) +dwflpp::name_has_wildcard (const string& pattern) { return (pattern.find('*') != string::npos || pattern.find('?') != string::npos || @@ -258,19 +258,30 @@ static int dwfl_report_offline_predicate (const char* modname, const char* filen if (pending_interrupts) return -1; - if (offline_search_match_p) - return -1; - assert (offline_search_modname); - /* Reject mismatching module names */ - if (strcmp(modname, offline_search_modname)) - return 0; - else - { + if (dwflpp::name_has_wildcard (offline_search_modname)) { + int match_p = !fnmatch(offline_search_modname, modname, 0); + // In the wildcard case, we don't short-circuit (return -1) upon + // offline_search_match_p, analogously to dwflpp::module_name_final_match(). + + if (match_p) offline_search_match_p ++; - return 1; - } + + return match_p; + } else { /* non-wildcard mode */ + if (offline_search_match_p) + return -1; + + /* Reject mismatching module names */ + if (strcmp(modname, offline_search_modname)) + return 0; + else + { + offline_search_match_p ++; + return 1; + } + } } @@ -339,17 +350,6 @@ dwflpp::setup_kernel(const string& name, bool debuginfo_needed) sess.kernel_build_tree + string("'")); } - // XXX: it would be nice if we could do a single - // ..._report_offline call for an entire systemtap script, so - // that a selection predicate would filter out modules outside - // the union of all the requested wildcards. But we build - // derived_probes one-by-one and we don't have lookahead. - // PR 3498. - - // XXX: a special case: if we have only kernel.* probe points, - // we shouldn't waste time looking for module debug-info (and - // vice versa). - // NB: the result of an _offline call is the assignment of // virtualized addresses to relocatable objects such as // modules. These have to be converted to real addresses at |