This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] session.cxx (systemtap_session copy ctor): copy kernel_build_tree value


Hi,

Here's a patch for a problem I've seen when using systemtap to do a
'cross' invocation of a stap script on a remote target system.  I'm not
sure this is the correct fix, or if it's even proper C++, as it's been
awhile since I've done much C++, but it did fix the problem here...

When using the stap -r option with a full path to a kernel build tree
(i.e. one starting with /) along with --remote to execute the script
on a remote system, the build tree that I passed in was ignored and it
used some default locally-constructed location instead:

Checking "/lib/modules/3.4.24-yocto-standard/build/.config" failed
  with error: No such file or directory

I traced it down to the s->clone() call in the path
ssh_remote->connect()->set_child_fds(), which unconditionally invokes
the following in the systemtap_session copy constructor:

  kernel_build_tree = "/lib/modules/" + kernel_release + "/build";

That doesn't seem correct - it seems to me it should be preserving the
value from the passed-in session object, which is what this does.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 session.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/session.cxx b/session.cxx
index cccade0..1410b3f 100644
--- a/session.cxx
+++ b/session.cxx
@@ -263,7 +263,7 @@ systemtap_session::systemtap_session (const systemtap_session& other,
   last_token (0)
 {
   release = kernel_release = kern;
-  kernel_build_tree = "/lib/modules/" + kernel_release + "/build";
+  kernel_build_tree = other.kernel_build_tree;
   architecture = machine = normalize_machine(arch);
   setup_kernel_release(kern.c_str());
   native_build = false; // assumed; XXX: could be computed as in check_options()
-- 
1.7.11.4




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]