diff options
author | Rajan Arora <rarora@redhat.com> | 2008-12-01 02:06:51 -0500 |
---|---|---|
committer | Rajan Arora <rarora@redhat.com> | 2008-12-01 02:10:48 -0500 |
commit | 7471ea1f77971b814bc366a3e09d99aaddcfb0f7 (patch) | |
tree | c155f76087281c1f5603f40c0a44a4c3911e1c87 /buildrun.cxx | |
parent | 4ea5a9d947ac41fc9da143ce501642673d27c7bf (diff) | |
download | systemtap-steved-7471ea1f77971b814bc366a3e09d99aaddcfb0f7.tar.gz systemtap-steved-7471ea1f77971b814bc366a3e09d99aaddcfb0f7.tar.xz systemtap-steved-7471ea1f77971b814bc366a3e09d99aaddcfb0f7.zip |
BZ 5892: Add stap -B to sic systemtap at an alternate kernel build tree
Diffstat (limited to 'buildrun.cxx')
-rw-r--r-- | buildrun.cxx | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index f9588906..86da95d3 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -150,8 +150,12 @@ compile_pass (systemtap_session& s) o.close (); // Generate module directory pathname and make sure it exists. - string module_dir = string("/lib/modules/") - + s.kernel_release + "/build"; + string module_dir; + if (! s.kernel_build_tree.size ()) + module_dir = string("/lib/modules/") + + s.kernel_release + "/build"; + else + module_dir = s.kernel_build_tree; struct stat st; rc = stat(module_dir.c_str(), &st); if (rc != 0) @@ -176,14 +180,20 @@ static const string uprobes_home = string(PKGDATADIR "/runtime/uprobes"); /* * If uprobes was built as part of the kernel build (either built-in - * or as a module), the uprobes exports should show up in - * /lib/modules/`uname -r`/build/Module.symvers. Return true if so. + * or as a module), the uprobes exports should show up in either + * /lib/modules/`uname -r`/build/Module.symvers or in the oddball + * directory where the user's kernel is built. Return true if so. */ static bool kernel_built_uprobes (systemtap_session& s) { - string grep_cmd = string ("/bin/grep -q unregister_uprobe /lib/modules/") - + s.kernel_release + string ("/build/Module.symvers"); + string grep_cmd; + if (! s.kernel_build_tree.size ()) + grep_cmd = string ("/bin/grep -q unregister_uprobe /lib/modules/") + + s.kernel_release + string ("/build/Module.symvers"); + else + grep_cmd = string ("/bin/grep -q unregister_uprobe ") + + s.kernel_build_tree + string ("/Module.symvers"); int rc = system (grep_cmd.c_str()); return (rc == 0); } |