summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-07-20 16:25:35 -0700
committerJosh Stone <jistone@redhat.com>2009-07-20 18:08:14 -0700
commita2639cb76e9151cad6ceebc21857d2d6aa8cbc8a (patch)
treefce5f2cb0fa8f4b6e9a76652e8659682bbcab5c3
parent1c47903b03c678470cf81c3a7d5c3ad95420d569 (diff)
downloadsystemtap-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.cxx14
-rw-r--r--hash.h5
-rw-r--r--session.h1
-rw-r--r--tapsets.cxx19
4 files changed, 19 insertions, 20 deletions
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");
}
diff --git a/hash.h b/hash.h
index 7e432216..a6397a52 100644
--- a/hash.h
+++ b/hash.h
@@ -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 : */
diff --git a/session.h b/session.h
index a617e47f..e68cd6df 100644
--- a/session.h
+++ b/session.h
@@ -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);