From 4c5ff1bb5bb35cb35e30c45e385043c5f8383cd0 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 6 Sep 2005 17:40:12 +0000 Subject: 2005-09-06 Martin Hunt * tapset/context.stp: Add function target(). * stapfuncs.5.in (target): Document it. * elaborate.h (struct systemtap_session): Add cmd and target_pid to the struct. * main.cxx (usage): Add secriptions of "-c" and "-x" options. (main): Set s.cmd and s.target_pid. * buildrun.cxx (stringify): Copy this utility func here too. (run_pass): Add new options to set cmd and pid to the stpd command line. --- buildrun.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index 867d0d0e..130f4a1b 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -92,6 +92,15 @@ compile_pass (systemtap_session& s) } +template +static string +stringify(T t) +{ + ostringstream s; + s << t; + return s.str (); +} + int run_pass (systemtap_session& s) @@ -114,8 +123,15 @@ run_pass (systemtap_session& s) string stpd_cmd = string("/usr/bin/sudo ") + string(PKGLIBDIR) + "/stpd " + "-r " // disable relayfs - + (s.verbose ? "" : "-q ") - + s.tmpdir + "/" + s.module_name + ".ko"; + + (s.verbose ? "" : "-q "); + + if (s.cmd != "") + stpd_cmd += "-c \"" + s.cmd + "\" "; + + if (s.target_pid) + stpd_cmd += "-t " + stringify(s.target_pid) + " "; + + stpd_cmd += s.tmpdir + "/" + s.module_name + ".ko"; if (s.verbose) clog << "Running " << stpd_cmd << endl; rc = system (stpd_cmd.c_str ()); -- cgit