// Build a tiny kernel module to query tracepoints
int
-make_tracequery(systemtap_session& s, string& name)
+make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_headers)
{
// create a subdirectory for the module
string dir(s.tmpdir + "/tracequery");
osrc << "#define DEFINE_TRACE(name, proto, args) \\" << endl;
osrc << " DECLARE_TRACE(name, TPPROTO(proto), TPARGS(args))" << endl;
+ // PR9993: Add extra headers to work around undeclared types in individual
+ // include/trace/foo.h files
+ 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[2] = { "/include/trace/*.h", "/source/include/trace/*.h" };
int compile_pass (systemtap_session& s);
int run_pass (systemtap_session& s);
-int make_tracequery(systemtap_session& s, std::string& name);
+int make_tracequery(systemtap_session& s, std::string& name, const std::vector<std::string>& extra_headers);
#endif // BUILDRUN_H
// tracepoints from FOO_event_types.h should really be included from FOO.h
// XXX can dwarf tell us the include hierarchy? it would be better to
// ... walk up to see which one was directly included by tracequery.c
+ // XXX: see also PR9993.
header_pos = header.find("_event_types");
if (header_pos != string::npos)
header.erase(header_pos, 12);
}
+static vector<string> tracepoint_extra_headers ()
+{
+ vector<string> they_live;
+ // PR 9993
+ // XXX: may need this to be configurable
+ they_live.push_back ("linux/skbuff.h");
+ return they_live;
+}
+
+
void
tracepoint_derived_probe_group::emit_module_decls (systemtap_session& s)
{
s.op->newline() << "/* ---- tracepoint probes ---- */";
s.op->newline();
+ // PR9993: Add extra headers to work around undeclared types in individual
+ // include/trace/foo.h files
+ const vector<string>& extra_headers = tracepoint_extra_headers ();
+ for (unsigned z=0; z<extra_headers.size(); z++)
+ s.op->newline() << "#include <" << extra_headers[z] << ">\n";
+
for (unsigned i = 0; i < probes.size(); ++i)
{
tracepoint_derived_probe *p = probes[i];
bool init_dw(systemtap_session& s);
public:
+
tracepoint_builder(): dw(0) {}
~tracepoint_builder() { delete dw; }
// no cached module, time to make it
string tracequery_ko;
- int rc = make_tracequery(s, tracequery_ko);
+ int rc = make_tracequery(s, tracequery_ko, tracepoint_extra_headers());
if (rc != 0)
return false;
+
+set tracepoints {}
+spawn stap -l {kernel.trace("*")}
+expect {
+ -re {^kernel.trace[^\r\n]*\r\n} {
+ append tracepoints $expect_out(0,string)
+ exp_continue
+ }
+ timeout {}
+ eof {}
+}
+catch {close}; catch { wait }
+
+foreach tp $tracepoints {
+ set test "tracepoint $tp -p4"
+ if {[catch {exec stap -w -p4 -e "probe $tp {}"} res]} {
+ fail "$test $res"
+ } else {
+ pass "$test"
+ }
+}
+
set test "tracepoints"
+if {![installtest_p]} { untested $test; return }
set ::result_string {tracepoints OK}
stap_run2 $srcdir/$subdir/$test.stp