[PATCH] sysroot: fix short release -r option handling follow up

Victor Kamensky kamensky@cisco.com
Thu Mar 22 08:05:00 GMT 2018


In case of sysroot set and short release -r option it does
not make sense to pass short release name into
dwfl_linux_kernel_report_offline function. This function
is not aware about sysroot and it won't look for kernel
modules under sysroot directory.

In non empty sysroot case we construct absolute path
name to kernel modules directory under sysroot using
short release -r option value.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>
---
 setupdwfl.cxx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/setupdwfl.cxx b/setupdwfl.cxx
index f6c3157c1..9c8890052 100644
--- a/setupdwfl.cxx
+++ b/setupdwfl.cxx
@@ -367,7 +367,15 @@ setup_dwfl_kernel (unsigned *modules_found, systemtap_session &s)
   // hard-code this magic here.
   string lib_path = s.sysroot + "/lib/modules/" + s.kernel_release + "/build";
   if (s.kernel_build_tree == lib_path)
-    elfutils_kernel_path = s.kernel_release;
+    {
+      if (s.sysroot != "")
+        // If we have sysroot set does not make sense to pass
+        // short release to dwfl, it won't take a sysroot into
+        // account. Let's construct full path in such case.
+	elfutils_kernel_path = string(s.sysroot + "/lib/modules/" + s.kernel_release);
+      else
+	elfutils_kernel_path = s.kernel_release;
+    }
   else
     elfutils_kernel_path = s.kernel_build_tree;
   offline_modules_found = 0;
-- 
2.14.3



More information about the Systemtap mailing list