From 601915ab6aebff06bfc830be3b0f69976a486d9d Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 19 Mar 2009 11:27:19 -0400 Subject: add runtime/autoconf magic for itrace on pre-find_task_by_vpid kernels --- buildrun.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index b9d648ef..0e9e0e17 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -148,6 +148,7 @@ compile_pass (systemtap_session& s) output_autoconf(s, o, "autoconf-vm-area.c", "STAPCONF_VM_AREA", NULL); output_autoconf(s, o, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL); output_autoconf(s, o, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL); + output_autoconf(s, o, "autoconf-find-task-pid.c", "STAPCONF_FIND_TASK_PID", NULL); #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our -- cgit From 701c41be909697d5ab36f7604a1f3620c7d04abc Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 20 Mar 2009 13:31:18 -0400 Subject: PR6930: stap: supports on-file flight recorder options Add on-file flight recorder options (the combination of -F and -o, and -S option) to stap command, and change manpages and NEWS. - Both of -F and -o is specified, stap passes -D option to staprun. - stap just passes -S option to staprun. --- buildrun.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 0e9e0e17..e3634545 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -329,7 +329,10 @@ run_pass (systemtap_session& s) staprun_cmd += "-u "; if (s.load_only) - staprun_cmd += "-L "; + staprun_cmd += (s.output_file.empty() ? "-L " : "-D "); + + if (!s.size_option.empty()) + staprun_cmd += "-S " + s.size_option + " "; staprun_cmd += s.tmpdir + "/" + s.module_name + ".ko"; -- cgit From a1c66a0f3d8795fbcf49ce936dee3c5645f0bfa6 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 20 Mar 2009 19:26:58 -0400 Subject: support tracepoint extraction for kernel build trees built with O=/path * buildrun.cxx (make_tracequery): Also search source/include/trace/*.h. --- buildrun.cxx | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index e3634545..6a266bd2 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -384,21 +384,25 @@ make_tracequery(systemtap_session& s, string& name) // dynamically pull in all tracepoint headers from include/trace/ glob_t trace_glob; - string glob_str(s.kernel_build_tree + "/include/trace/*.h"); - glob(glob_str.c_str(), 0, NULL, &trace_glob); - for (unsigned i = 0; i < trace_glob.gl_pathc; ++i) + string globs[2] = { "/include/trace/*.h", "/source/include/trace/*.h" }; + for (unsigned z=0; z<2; z++) { - string header(basename(trace_glob.gl_pathv[i])); - - // filter out a few known "internal-only" headers - if (header == "trace_events.h") - continue; - if (header.find("_event_types.h") != string::npos) - continue; - - osrc << "#include " << endl; + 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])); + + // filter out a few known "internal-only" headers + if (header == "trace_events.h") + continue; + if (header.find("_event_types.h") != string::npos) + continue; + + osrc << "#include " << endl; + } + globfree(&trace_glob); } - globfree(&trace_glob); // finish up the module source osrc << "#endif /* CONFIG_TRACEPOINTS */" << endl; -- cgit From 3c1b3d06ef3134b30e804d189d346c5f83c6f3a6 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 24 Mar 2009 12:53:17 -0400 Subject: PR9993: tracepoint toleration for undeclared types in trace/*.h headers * tapsets.cxx (tracepoint_extra_headers): New function to return needed header file names. (emit_module_decls): Emit them. * buildrun.cxx (make_tracequery): Emit them. * testsuite/systemtap.base/tracepoints.exp: Rewrite to exercise building each tracepoint. --- buildrun.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 6a266bd2..e19043cf 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -345,7 +345,7 @@ run_pass (systemtap_session& s) // 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& extra_headers) { // create a subdirectory for the module string dir(s.tmpdir + "/tracequery"); @@ -382,6 +382,11 @@ make_tracequery(systemtap_session& s, string& name) 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\n"; + // dynamically pull in all tracepoint headers from include/trace/ glob_t trace_glob; string globs[2] = { "/include/trace/*.h", "/source/include/trace/*.h" }; -- cgit From 5cad2d3b056059758d44b4dd56abe37ca9c841a6 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 30 Mar 2009 17:23:42 -0400 Subject: PR9998: adapt tapset/i686/registers.stp to latest kernel * buildrun.cxx (compile_pass): Add autoconf-x86-gs.c. * tapset/i686/registers.stp (_stp_register_regs): Update offsets. (test_x86_gs): Auxiliary function. * runtime/autoconf-x86-gs.c : New file. * testsuite/systemtap.base/x86_gs.exp : New test case. * testsuite/systemtap.base/x86_gs.stp : Ditto. --- buildrun.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index e19043cf..97357692 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -149,6 +149,7 @@ compile_pass (systemtap_session& s) output_autoconf(s, o, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL); output_autoconf(s, o, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL); output_autoconf(s, o, "autoconf-find-task-pid.c", "STAPCONF_FIND_TASK_PID", NULL); + output_autoconf(s, o, "autoconf-x86-gs.c", "STAPCONF_X86_GS", NULL); #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our -- cgit From 4cc40e829870dd6a1d9714706d38f5fd4b2ec982 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 1 Apr 2009 14:49:12 -0700 Subject: PR10016: Purge stap of all pgrp and system() usage We hereby no longer try to manipulate process groups in any way. We don't set a private process group, and we never kill() our entire group either. Instead of using system(), we now have a stap_system() which saves the child PID, so when we get a terminating signal we can pass it along to the child. Signals sent through the TTY have always worked, since the TTY sends it to the entire pgrp. However, if we're running as part of a wrapper script or GUI, which may not have a separate process group for stap, we still would like to allow "kill -TERM $STAPPID" to terminate stap nicely. There's still a short window of failure in the time that staprun is active, because we can't kill a setuid process from a user process. Once staprun drops privileges and execs to stapio though, everything should work fine. --- buildrun.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 97357692..71a34c96 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -56,7 +56,7 @@ run_make_cmd(systemtap_session& s, string& make_cmd) make_cmd += " -s >/dev/null 2>&1"; if (s.verbose > 1) clog << "Running " << make_cmd << endl; - rc = system (make_cmd.c_str()); + rc = stap_system (make_cmd.c_str()); return rc; } @@ -223,7 +223,7 @@ kernel_built_uprobes (systemtap_session& s) { string grep_cmd = string ("/bin/grep -q unregister_uprobe ") + s.kernel_build_tree + string ("/Module.symvers"); - int rc = system (grep_cmd.c_str()); + int rc = stap_system (grep_cmd.c_str()); return (rc == 0); } @@ -274,7 +274,7 @@ copy_uprobes_symbols (systemtap_session& s) string uprobes_home = s.runtime_path + "/uprobes"; string cp_cmd = string("/bin/cp ") + uprobes_home + string("/Module.symvers ") + s.tmpdir; - int rc = system (cp_cmd.c_str()); + int rc = stap_system (cp_cmd.c_str()); return rc; } @@ -339,7 +339,7 @@ run_pass (systemtap_session& s) if (s.verbose>1) clog << "Running " << staprun_cmd << endl; - rc = system (staprun_cmd.c_str ()); + rc = stap_system (staprun_cmd.c_str ()); return rc; } -- cgit From b51455af34a99768cc3a6ce50b251132f5fe752e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 2 Apr 2009 12:16:12 -0700 Subject: Disable ccache during kernel module builds Our module builds always have a 0% ccache hit rate, because the compiler commands always include the randomized tmpdir. Thus, I'm setting CCACHE_DISABLE=1 so ccache never saves these one-use objects. (Besides, we already have our own caching in place for this stuff...) --- buildrun.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 71a34c96..bcd4c1fe 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -48,6 +48,12 @@ run_make_cmd(systemtap_session& s, string& make_cmd) cerr << "unsetenv failed: " << e << endl; } + // Disable ccache to avoid saving files that will never be reused. + // (ccache is useless to us, because our compiler commands always + // include the randomized tmpdir path.) + // It's not critical if this fails, so the return is ignored. + (void) setenv("CCACHE_DISABLE", "1", 0); + if (s.verbose > 2) make_cmd += " V=1"; else if (s.verbose > 1) -- cgit From d5cd287f7860df8752f93de93fcd1cc68884d56b Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 9 Apr 2009 12:06:05 -0500 Subject: Uses when available. 2009-04-09 David Smith * buildrun.cxx (compile_pass): Compile autoconf test for . * runtime/autoconf-asm-syscall.c: New "autoconf" test the presence of . * runtime/syscall.h: If exists, use it. Otherwise, use our private copy of the functions for each architecture. (syscall_get_nr): Renamed from __stp_user_syscall_nr(). (syscall_get_return_value): Renamed from __stp_user_syscall_return_value(). (syscall_get_arguments): Renamed from __stp_user_syscall_arg(). * runtime/task_finder.c (__stp_utrace_task_finder_target_syscall_exit): Uses new syscall.h functions. * tapset/utrace.stp: Ditto. --- buildrun.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index bcd4c1fe..82ac9d4e 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -165,6 +165,8 @@ compile_pass (systemtap_session& s) #endif output_autoconf(s, o, "autoconf-save-stack-trace.c", "STAPCONF_KERNEL_STACKTRACE", NULL); + output_autoconf(s, o, "autoconf-asm-syscall.c", + "STAPCONF_ASM_SYSCALL_H", NULL); o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl; -- cgit 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 From 3e1c25aa1f788ad5075e2563cc208b58ab6273b5 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 17 Apr 2009 20:34:13 -0700 Subject: Add functions to build umod & kmod typequery --- buildrun.cxx | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index e0f22f29..71753e9f 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -443,4 +443,61 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ return run_make_cmd(s, make_cmd); } + +// Build a tiny kernel module to query type information +int +make_typequery_kmod(systemtap_session& s, const string& header, string& name) +{ + static unsigned tick = 0; + string basename("typequery_kmod_" + lex_cast(++tick)); + + // create a subdirectory for the module + string dir(s.tmpdir + "/" + basename); + if (create_dir(dir.c_str()) != 0) + { + if (! s.suppress_warnings) + cerr << "Warning: failed to create directory for querying types." << endl; + return 1; + } + + name = dir + "/" + basename + ".ko"; + + // create a simple Makefile + string makefile(dir + "/Makefile"); + ofstream omf(makefile.c_str()); + omf << "EXTRA_CFLAGS := -g -fno-eliminate-unused-debug-types" << endl; + omf << "CFLAGS_" << basename << ".o := -include " << header << endl; + omf << "obj-m := " + basename + ".o" << endl; + omf.close(); + + // create our empty source file + string source(dir + "/" + basename + ".c"); + ofstream osrc(source.c_str()); + osrc.close(); + + // make the module + string make_cmd = "make -C '" + s.kernel_build_tree + "'" + + " M='" + dir + "' modules"; + if (s.verbose < 4) + make_cmd += " >/dev/null 2>&1"; + return run_make_cmd(s, make_cmd); +} + + +// Build a tiny user module to query type information +int +make_typequery_umod(systemtap_session& s, const string& header, string& name) +{ + static unsigned tick = 0; + + name = s.tmpdir + "/typequery_umod_" + lex_cast(++tick) + ".so"; + + // make the module + string cmd = "gcc -shared -g -fno-eliminate-unused-debug-types -o " + + name + " -xc /dev/null -include " + header; + if (s.verbose < 4) + cmd += " >/dev/null 2>&1"; + return stap_system (cmd.c_str()); +} + /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ -- cgit From d90053e72a515371936e10bf83ecb822aec91b17 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 21 Apr 2009 12:08:42 -0700 Subject: Refine the @cast-with-header syntax The special syntax to generate a module for type information is now: - "kernel" to use the kernel's build environment - "" to use no special build environment, and so use gcc's default parameters only (for user mode). --- buildrun.cxx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 71753e9f..311937e2 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -445,7 +445,7 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ // Build a tiny kernel module to query type information -int +static int make_typequery_kmod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; @@ -485,7 +485,7 @@ make_typequery_kmod(systemtap_session& s, const string& header, string& name) // Build a tiny user module to query type information -int +static int make_typequery_umod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; @@ -500,4 +500,33 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) return stap_system (cmd.c_str()); } + +int +make_typequery(systemtap_session& s, string& module) +{ + int rc; + string new_module; + + if (module[module.size() - 1] != '>') + return -1; + + if (module[0] == '<') + { + string header = module.substr(1, module.size() - 2); + rc = make_typequery_umod(s, header, new_module); + } + else if (module.compare(0, 7, "kernel<") == 0) + { + string header = module.substr(7, module.size() - 8); + rc = make_typequery_kmod(s, header, new_module); + } + else + return -1; + + if (!rc) + module = new_module; + + return rc; +} + /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ -- cgit From 3ae4cdf91d758136cbf71c814c725c643d251f41 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 21 Apr 2009 12:12:43 -0700 Subject: NB @cast's relative header searching --- buildrun.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 311937e2..6c51d0cd 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -466,7 +466,16 @@ make_typequery_kmod(systemtap_session& s, const string& header, string& name) string makefile(dir + "/Makefile"); ofstream omf(makefile.c_str()); omf << "EXTRA_CFLAGS := -g -fno-eliminate-unused-debug-types" << endl; + + // NB: We use -include instead of #include because that gives us more power. + // Using #include searches relative to the source's path, which in this case + // is /tmp/..., so that's not helpful. Using -include will search relative + // to the cwd, which will be the kernel build root. This means if you have a + // full kernel build tree, it's possible to get at types that aren't in the + // normal include path, e.g.: + // @cast(foo, "bsd_acct_struct", "kernel")->... omf << "CFLAGS_" << basename << ".o := -include " << header << endl; + omf << "obj-m := " + basename + ".o" << endl; omf.close(); @@ -493,6 +502,11 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) name = s.tmpdir + "/typequery_umod_" + lex_cast(++tick) + ".so"; // make the module + // + // NB: As with kmod, using -include makes relative paths more useful. The + // cwd in this case will be the cwd of stap itself though, which may be + // trickier to deal with. It might be better to "cd `dirname $script`" + // first... string cmd = "gcc -shared -g -fno-eliminate-unused-debug-types -o " + name + " -xc /dev/null -include " + header; if (s.verbose < 4) -- cgit From 43e8f8d02ab60eb24b6d8cba1105ef92a080e5f1 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 21 Apr 2009 19:55:47 -0700 Subject: [tracepoints] Don't use TRACE_HEADER_MULTI_READ At one point that macro was needed to get all of the tracepoints on the tip tree, but now it's causing us to get duplicate stapprobe_X definitions. AFAICS, we're now getting all tracepoints even without MULTI_READ, so I'm pulling that workaround out. --- buildrun.cxx | 4 ---- 1 file changed, 4 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 6c51d0cd..41b593fa 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -390,10 +390,6 @@ 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 Date: Tue, 21 Apr 2009 19:57:59 -0700 Subject: [tracepoints] Resolve implicit trace_X use Some of the tracepoints are actually being called in inlines in the common headers (e.g. trace_kmalloc), which is causing errors about implicit function declarations. We don't care about ever running the code in the tracequery module, so I'm just suppressing that error. --- buildrun.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 41b593fa..14c6a395 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -370,7 +370,8 @@ make_tracequery(systemtap_session& s, string& name, const vector& extra_ // create a simple Makefile string makefile(dir + "/Makefile"); ofstream omf(makefile.c_str()); - omf << "EXTRA_CFLAGS := -g" << endl; // force debuginfo generation + // force debuginfo generation, and relax implicit functions + omf << "EXTRA_CFLAGS := -g -Wno-implicit-function-declaration" << endl; omf << "obj-m := tracequery.o" << endl; omf.close(); -- cgit From b7b8900677fad295a637912a3254e03c0758939e Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 30 Apr 2009 16:43:41 -0400 Subject: add verboser strerrors if posix_spawn failed * buildrun.cxx (run_make_cmd, kernel_built_uprobes, copy_uprobes_symbols, run_pass, make_typequery_umod): Print strerror after a failed stap_system() if verbose. --- buildrun.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 14c6a395..bbef1def 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -63,7 +63,8 @@ run_make_cmd(systemtap_session& s, string& make_cmd) if (s.verbose > 1) clog << "Running " << make_cmd << endl; rc = stap_system (make_cmd.c_str()); - + if (rc && s.verbose > 1) + clog << "Error " << rc << " " << strerror(rc) << endl; return rc; } @@ -232,6 +233,8 @@ kernel_built_uprobes (systemtap_session& s) string grep_cmd = string ("/bin/grep -q unregister_uprobe ") + s.kernel_build_tree + string ("/Module.symvers"); int rc = stap_system (grep_cmd.c_str()); + if (rc && s.verbose > 1) + clog << "Error " << rc << " " << strerror(rc) << endl; return (rc == 0); } @@ -283,6 +286,8 @@ copy_uprobes_symbols (systemtap_session& s) string cp_cmd = string("/bin/cp ") + uprobes_home + string("/Module.symvers ") + s.tmpdir; int rc = stap_system (cp_cmd.c_str()); + if (rc && s.verbose > 1) + clog << "Error " << rc << " " << strerror(rc) << endl; return rc; } @@ -348,6 +353,8 @@ run_pass (systemtap_session& s) if (s.verbose>1) clog << "Running " << staprun_cmd << endl; rc = stap_system (staprun_cmd.c_str ()); + if (rc && s.verbose > 1) + clog << "Error " << rc << " " << strerror(rc) << endl; return rc; } @@ -508,7 +515,10 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) + name + " -xc /dev/null -include " + header; if (s.verbose < 4) cmd += " >/dev/null 2>&1"; - return stap_system (cmd.c_str()); + int rc = stap_system (cmd.c_str()); + if (rc && s.verbose > 1) + clog << "Error " << rc << " " << strerror(rc) << endl; + return rc; } -- cgit From 2035bcd40b17832439df0a1eb28403b99a71b74f Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Mon, 4 May 2009 16:05:22 -0400 Subject: Module signing and verification using a separate file for the module signature. --- buildrun.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 14c6a395..31f7ec00 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -10,6 +10,9 @@ #include "buildrun.h" #include "session.h" #include "util.h" +#if HAVE_NSS +#include "modsign.h" +#endif #include #include @@ -218,6 +221,14 @@ compile_pass (systemtap_session& s) rc = run_make_cmd(s, make_cmd); +#if HAVE_NSS + // If a certificate database was specified, then try to sign the module. + // Failure to do so is not a fatal error. If the signature is actually needed, + // staprun will complain at that time. + assert (! s.cert_db_path.empty()); + sign_module (s); +#endif + return rc; } -- cgit From 620c2105eb1d928b97769006eb6eed79d6998531 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 8 May 2009 13:14:49 -0700 Subject: Don't attempt NSS if the module failed to build --- buildrun.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 1b441144..54aa5d4f 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -227,7 +227,8 @@ compile_pass (systemtap_session& s) // Failure to do so is not a fatal error. If the signature is actually needed, // staprun will complain at that time. assert (! s.cert_db_path.empty()); - sign_module (s); + if (!rc) + sign_module (s); #endif return rc; -- cgit