From b40af7ee2b7ec2a0bdabf4e1b2ecfceec1de33be Mon Sep 17 00:00:00 2001 From: dsmith Date: Fri, 30 Jun 2006 18:24:43 +0000 Subject: 2006-06-30 David Smith * tapsets.cxx (dwflpp::dwfl_assert): Added optional extra_msg parameter to be able to print out extra error message. (dwflpp::setup): Uses new 'extra_msg' parameter to dwfl_assert() to ask user to install kernel-debuginfo when dwfl_linux_kernel_report_kernel() or dwfl_linux_kernel_report_modules() fails (Bugzilla #2669). * buildrun.cxx (compile_pass): Checks to make sure module build directory exists before trying to run make there (Bugzilla #2669). --- ChangeLog | 12 ++++++++++++ buildrun.cxx | 18 +++++++++++++++++- tapsets.cxx | 18 +++++++++++------- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6432eaf5..4321b316 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-06-30 David Smith + + * tapsets.cxx (dwflpp::dwfl_assert): Added optional extra_msg + parameter to be able to print out extra error message. + (dwflpp::setup): Uses new 'extra_msg' parameter to dwfl_assert() + to ask user to install kernel-debuginfo when + dwfl_linux_kernel_report_kernel() or + dwfl_linux_kernel_report_modules() fails (Bugzilla #2669). + + * buildrun.cxx (compile_pass): Checks to make sure module build + directory exists before trying to run make there (Bugzilla #2669). + 2006-06-27 Roland McGrath * runtest.sh: Don't use eval, use proper quoting. diff --git a/buildrun.cxx b/buildrun.cxx index ab2b85f6..8573fbf6 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -16,6 +16,11 @@ extern "C" { #include "signal.h" #include #include +#include +#include +#include +#include +#include } @@ -81,9 +86,20 @@ compile_pass (systemtap_session& s) o.close (); - // Run make + // Generate module directory pathname and make sure it exists. string module_dir = string("/lib/modules/") + s.kernel_release + "/build"; + struct stat st; + rc = stat(module_dir.c_str(), &st); + if (rc != 0) + { + clog << "Module directory " << module_dir << " check failed: " + << strerror(errno) << endl + << "Make sure kernel devel is installed." << endl; + return rc; + } + + // Run make string make_cmd = string("make") + string (" -C \"") + module_dir + string("\""); make_cmd += string(" M=\"") + s.tmpdir + string("\" modules"); diff --git a/tapsets.cxx b/tapsets.cxx index 116464c4..afc430b2 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -722,13 +722,18 @@ dwflpp } - void dwfl_assert(string desc, int rc) // NB: "rc == 0" means OK in this case + // NB: "rc == 0" means OK in this case + void dwfl_assert(string desc, int rc, string extra_msg = "") { string msg = "libdwfl failure (" + desc + "): "; if (rc < 0) msg += dwfl_errmsg (rc); else if (rc > 0) msg += strerror (rc); if (rc != 0) - throw semantic_error (msg); + { + if (extra_msg.length() > 0) + msg += "\n" + extra_msg; + throw semantic_error (msg); + } } void dwarf_assert(string desc, int rc) // NB: "rc == 0" means OK in this case @@ -785,12 +790,11 @@ dwflpp // XXX: if we have only kernel.* probe points, we shouldn't waste time // looking for module debug-info (and vice versa). dwfl_assert ("dwfl_linux_kernel_report_kernel", - dwfl_linux_kernel_report_kernel (dwfl)); + dwfl_linux_kernel_report_kernel (dwfl), + "Ensure kernel debuginfo is installed"); dwfl_assert ("dwfl_linux_kernel_report_modules", - dwfl_linux_kernel_report_modules (dwfl)); - // NB: While RH bug #169672 prevents detection of -debuginfo absence - // here, the get_module_dwarf() function will throw an exception - // before long. + dwfl_linux_kernel_report_modules (dwfl), + "Ensure kernel debuginfo is installed"); } else { -- cgit