From a2639cb76e9151cad6ceebc21857d2d6aa8cbc8a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 20 Jul 2009 16:25:35 -0700 Subject: 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 --- hash.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'hash.cxx') diff --git a/hash.cxx b/hash.cxx index 45ae05eb..e550be76 100644 --- a/hash.cxx +++ b/hash.cxx @@ -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"); } -- cgit From 9a193b06eb0e5ca463576e4fa9e8da0a70022a4a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 20 Jul 2009 17:57:56 -0700 Subject: Make sure that non-existent files still affect hashing The fact that a file _doesn't_ exist is significant, so adding such a file to a computed hash should still influence the output. * hash.cxx (hash::add_file): add bogus stat info for non-existent files --- hash.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'hash.cxx') diff --git a/hash.cxx b/hash.cxx index e550be76..a0608c03 100644 --- a/hash.cxx +++ b/hash.cxx @@ -52,12 +52,12 @@ hash::add_file(const std::string& filename) { struct stat st; - if (stat(filename.c_str(), &st) == 0) - { - add(filename); - add(st.st_size); - add(st.st_mtime); - } + if (stat(filename.c_str(), &st) != 0) + st.st_size = st.st_mtime = -1; + + add(filename); + add(st.st_size); + add(st.st_mtime); } -- cgit From f982c59b2c2b1c25684213c816a69f18a98fea8a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 20 Jul 2009 18:01:40 -0700 Subject: PR10424: Consider each tracepoint header separately With the current monolithic tracepoint query module, a failure in any of the discovered tracepoint headers means that you can't use any of the others either. This patch creates a separate query module for each header so they can pass or fail independently. * buildrun.cxx (make_tracequery): take a single header name instead of globbing for everything we can find. * hash.cxx (find_tracequery_hash): name the header file we're hashing. * tapsets.cxx (tracepoint_query::handle_query_func): make sure we don't duplicate tracepoints found through different headers. (tracepoint_builder::get_tracequery_module): get a header's module (tracepoint_builder::init_dw): glob for all tracepoint headers, and feed all their modules into dwflpp. --- hash.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'hash.cxx') diff --git a/hash.cxx b/hash.cxx index a0608c03..eac22f48 100644 --- a/hash.cxx +++ b/hash.cxx @@ -257,12 +257,13 @@ find_hash (systemtap_session& s, const string& script) string -find_tracequery_hash (systemtap_session& s) +find_tracequery_hash (systemtap_session& s, const string& header) { hash h; get_base_hash(s, h); - // The basic hash should be good enough for the tracepoint query module + // Add the tracepoint header to the computed hash + h.add_file(header); // Get the directory path to store our cached module string result, hashdir; -- cgit