summaryrefslogtreecommitdiffstats
path: root/buildrun.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-07-20 18:01:40 -0700
committerJosh Stone <jistone@redhat.com>2009-07-20 18:08:15 -0700
commitf982c59b2c2b1c25684213c816a69f18a98fea8a (patch)
treee0d9894b1fc114d79cc25a6a417d311a0c65f430 /buildrun.cxx
parent9a193b06eb0e5ca463576e4fa9e8da0a70022a4a (diff)
downloadsystemtap-steved-f982c59b2c2b1c25684213c816a69f18a98fea8a.tar.gz
systemtap-steved-f982c59b2c2b1c25684213c816a69f18a98fea8a.tar.xz
systemtap-steved-f982c59b2c2b1c25684213c816a69f18a98fea8a.zip
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.
Diffstat (limited to 'buildrun.cxx')
-rw-r--r--buildrun.cxx49
1 files changed, 12 insertions, 37 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 5967066e..e4b4b7bf 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -27,7 +27,6 @@ extern "C" {
#include <unistd.h>
#include <string.h>
#include <errno.h>
-#include <glob.h>
}
@@ -382,10 +381,15 @@ run_pass (systemtap_session& s)
// Build a tiny kernel module to query tracepoints
int
-make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_headers)
+make_tracequery(systemtap_session& s, string& name,
+ const std::string& header,
+ const vector<string>& extra_headers)
{
+ static unsigned tick = 0;
+ string basename("tracequery_kmod_" + lex_cast<string>(++tick));
+
// create a subdirectory for the module
- string dir(s.tmpdir + "/tracequery");
+ string dir(s.tmpdir + "/" + basename);
if (create_dir(dir.c_str()) != 0)
{
if (! s.suppress_warnings)
@@ -393,18 +397,18 @@ make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_
return 1;
}
- name = dir + "/tracequery.ko";
+ name = dir + "/" + basename + ".ko";
// create a simple Makefile
string makefile(dir + "/Makefile");
ofstream omf(makefile.c_str());
// force debuginfo generation, and relax implicit functions
omf << "EXTRA_CFLAGS := -g -Wno-implicit-function-declaration" << endl;
- omf << "obj-m := tracequery.o" << endl;
+ omf << "obj-m := " + basename + ".o" << endl;
omf.close();
// create our source file
- string source(dir + "/tracequery.c");
+ string source(dir + "/" + basename + ".c");
ofstream osrc(source.c_str());
osrc << "#ifdef CONFIG_TRACEPOINTS" << endl;
osrc << "#include <linux/tracepoint.h>" << endl;
@@ -424,37 +428,8 @@ make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_
for (unsigned z=0; z<extra_headers.size(); z++)
osrc << "#include <" << extra_headers[z] << ">\n";
- // dynamically pull in all tracepoint headers from include/trace/
- glob_t trace_glob;
- string globs[] = {
- "/include/trace/*.h",
- "/include/trace/events/*.h",
- "/source/include/trace/*.h",
- "/source/include/trace/events/*.h",
- };
- for (unsigned z = 0; z < sizeof(globs) / sizeof(globs[0]); z++)
- {
- string glob_str(s.kernel_build_tree + globs[z]);
- glob(glob_str.c_str(), 0, NULL, &trace_glob);
- for (unsigned i = 0; i < trace_glob.gl_pathc; ++i)
- {
- string header(trace_glob.gl_pathv[i]);
- size_t root_pos = header.rfind("/include/");
- assert(root_pos != string::npos);
- header.erase(0, root_pos + 9);
-
- // filter out a few known "internal-only" headers
- if (header.find("/ftrace.h") != string::npos)
- continue;
- if (header.find("/trace_events.h") != string::npos)
- continue;
- if (header.find("_event_types.h") != string::npos)
- continue;
-
- osrc << "#include <" << header << ">" << endl;
- }
- globfree(&trace_glob);
- }
+ // add the requested tracepoint header
+ osrc << "#include <" << header << ">" << endl;
// finish up the module source
osrc << "#endif /* CONFIG_TRACEPOINTS */" << endl;