From 0f2c85234527a02ca73909169a6750446a5a94f5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 16 Apr 2009 15:20:02 -0700 Subject: Keep up with tracepoint changes in kernel-tip - Define TRACE_HEADER_MULTI_READ to allow re-pulling headers that were already included indirectly elsewhere. - Some tracepoint headers were moved down to include/trace/events/, so add that to our glob paths. - Add ftrace.h as a header that we should never include. --- buildrun.cxx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 82ac9d4e..aac0c356 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -391,6 +391,10 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ osrc << "#define DEFINE_TRACE(name, proto, args) \\" << endl; osrc << " DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))" << endl; + // some headers may have been pulled in already indirectly, so we need this + // to ensure that they still use our definition + osrc << "#define TRACE_HEADER_MULTI_READ 1" << endl; + // PR9993: Add extra headers to work around undeclared types in individual // include/trace/foo.h files for (unsigned z=0; z& extra_ // dynamically pull in all tracepoint headers from include/trace/ glob_t trace_glob; - string globs[2] = { "/include/trace/*.h", "/source/include/trace/*.h" }; - for (unsigned z=0; z<2; z++) + 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(basename(trace_glob.gl_pathv[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 == "trace_events.h") + 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 " << endl; + osrc << "#include <" << header << ">" << endl; } globfree(&trace_glob); } -- cgit From a544586160e1a0b5bfcb7dd7abdf84dfdb0ed082 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 17 Apr 2009 20:22:29 -0700 Subject: Remove module boilerplate from tracequery Kernel modules will actually build just fine with none of the module boilerplate code. We don't care about ever actually loading the tracequery module that we make, so don't bother emitting code we don't need. --- buildrun.cxx | 5 ----- 1 file changed, 5 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index aac0c356..e0f22f29 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -377,7 +377,6 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ // create our source file string source(dir + "/tracequery.c"); ofstream osrc(source.c_str()); - osrc << "#include " << endl; osrc << "#ifdef CONFIG_TRACEPOINTS" << endl; osrc << "#include " << endl; @@ -434,10 +433,6 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ // finish up the module source osrc << "#endif /* CONFIG_TRACEPOINTS */" << endl; - osrc << "int init_module(void) { return 0; }" << endl; - osrc << "void cleanup_module(void) {}" << endl; - osrc << "MODULE_DESCRIPTION(\"tracepoint query\");" << endl; - osrc << "MODULE_LICENSE(\"GPL\");" << endl; osrc.close(); // make the module -- cgit