diff options
author | Josh Stone <jistone@redhat.com> | 2009-07-20 16:25:35 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-07-20 18:08:14 -0700 |
commit | a2639cb76e9151cad6ceebc21857d2d6aa8cbc8a (patch) | |
tree | fce5f2cb0fa8f4b6e9a76652e8659682bbcab5c3 | |
parent | 1c47903b03c678470cf81c3a7d5c3ad95420d569 (diff) | |
download | systemtap-steved-a2639cb76e9151cad6ceebc21857d2d6aa8cbc8a.tar.gz systemtap-steved-a2639cb76e9151cad6ceebc21857d2d6aa8cbc8a.tar.xz systemtap-steved-a2639cb76e9151cad6ceebc21857d2d6aa8cbc8a.zip |
Return hash module values directly as strings
* session.h (systemtap_session): remove tracequery_path
* hash.cxx (find_tracequery_hash, find_typequery_hash): return strings
* tapsets.cxx (dwarf_cast_expanding_visitor::filter_special_modules):
get the hashed path from the return value instead of a parameter
(tracepoint_builder::init_dw): ditto, and don't stuff it in session
-rw-r--r-- | hash.cxx | 14 | ||||
-rw-r--r-- | hash.h | 5 | ||||
-rw-r--r-- | session.h | 1 | ||||
-rw-r--r-- | tapsets.cxx | 19 |
4 files changed, 19 insertions, 20 deletions
@@ -256,7 +256,7 @@ find_hash (systemtap_session& s, const string& script) } -void +string find_tracequery_hash (systemtap_session& s) { hash h; @@ -268,14 +268,14 @@ find_tracequery_hash (systemtap_session& s) string result, hashdir; h.result(result); if (!create_hashdir(s, result, hashdir)) - return; + return ""; - s.tracequery_path = hashdir + "/tracequery_" + result + ".ko"; + return hashdir + "/tracequery_" + result + ".ko"; } -void -find_typequery_hash (systemtap_session& s, const string& name, string& module) +string +find_typequery_hash (systemtap_session& s, const string& name) { hash h; get_base_hash(s, h); @@ -287,9 +287,9 @@ find_typequery_hash (systemtap_session& s, const string& name, string& module) string result, hashdir; h.result(result); if (!create_hashdir(s, result, hashdir)) - return; + return ""; - module = hashdir + "/typequery_" + result + return hashdir + "/typequery_" + result + (name[0] == 'k' ? ".ko" : ".so"); } @@ -36,8 +36,7 @@ public: }; void find_hash (systemtap_session& s, const std::string& script); -void find_tracequery_hash (systemtap_session& s); -void find_typequery_hash (systemtap_session& s, const std::string& name, - std::string& module); +std::string find_tracequery_hash (systemtap_session& s); +std::string find_typequery_hash (systemtap_session& s, const std::string& name); /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ @@ -124,7 +124,6 @@ struct systemtap_session std::string cache_path; std::string hash_path; std::string stapconf_path; - std::string tracequery_path; // dwarfless operation bool consult_symtab; diff --git a/tapsets.cxx b/tapsets.cxx index 83f35e17..bb6f0daa 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -2645,7 +2645,7 @@ void dwarf_cast_expanding_visitor::filter_special_modules(string& module) if (s.use_cache) { // see if the cached module exists - find_typequery_hash(s, module, cached_module); + cached_module = find_typequery_hash(s, module); if (!cached_module.empty()) { int fd = open(cached_module.c_str(), O_RDONLY); @@ -5697,19 +5697,20 @@ tracepoint_builder::init_dw(systemtap_session& s) if (dw != NULL) return true; + string tracequery_path; if (s.use_cache) { // see if the cached module exists - find_tracequery_hash(s); - if (!s.tracequery_path.empty()) + tracequery_path = find_tracequery_hash(s); + if (!tracequery_path.empty()) { - int fd = open(s.tracequery_path.c_str(), O_RDONLY); + int fd = open(tracequery_path.c_str(), O_RDONLY); if (fd != -1) { if (s.verbose > 2) - clog << "Pass 2: using cached " << s.tracequery_path << endl; + clog << "Pass 2: using cached " << tracequery_path << endl; - dw = new dwflpp(s, s.tracequery_path, false); + dw = new dwflpp(s, tracequery_path, false); close(fd); return true; } @@ -5727,11 +5728,11 @@ tracepoint_builder::init_dw(systemtap_session& s) // try to save tracequery in the cache if (s.verbose > 2) clog << "Copying " << tracequery_ko - << " to " << s.tracequery_path << endl; + << " to " << tracequery_path << endl; if (copy_file(tracequery_ko.c_str(), - s.tracequery_path.c_str()) != 0) + tracequery_path.c_str()) != 0) cerr << "Copy failed (\"" << tracequery_ko << "\" to \"" - << s.tracequery_path << "\"): " << strerror(errno) << endl; + << tracequery_path << "\"): " << strerror(errno) << endl; } dw = new dwflpp(s, tracequery_ko, false); |