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. --- main.cxx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index adf1136f..c6663655 100644 --- a/main.cxx +++ b/main.cxx @@ -78,6 +78,8 @@ usage (systemtap_session& s) << " -m MODULE set probe module name, instead of" << endl << " " << s.module_name << endl << " -o FILE send output to file instead of stdout" << endl + << " -c CMD start the probes, run CMD, and exit when it finishes" << endl + << " -x PID sets target() to PID" << endl ; // -d: dump safety-related external references @@ -116,6 +118,8 @@ main (int argc, char * const argv []) s.last_pass = 5; s.module_name = "stap_" + stringify(getuid()) + "_" + stringify(time(0)); s.keep_tmpdir = false; + s.cmd = ""; + s.target_pid = 0; const char* s_p = getenv ("SYSTEMTAP_TAPSET"); if (s_p != NULL) @@ -131,7 +135,7 @@ main (int argc, char * const argv []) while (true) { - int grc = getopt (argc, argv, "hVvp:I:e:o:tR:r:m:kg"); + int grc = getopt (argc, argv, "hVvp:I:e:o:tR:r:m:kgc:x:"); if (grc < 0) break; switch (grc) @@ -192,6 +196,14 @@ main (int argc, char * const argv []) s.guru_mode = true; break; + case 'c': + s.cmd = string (optarg); + break; + + case 'x': + s.target_pid = atoi(optarg); + break; + case 'h': default: usage (s); -- cgit