summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorhunt <hunt>2005-09-06 17:40:12 +0000
committerhunt <hunt>2005-09-06 17:40:12 +0000
commit4c5ff1bb5bb35cb35e30c45e385043c5f8383cd0 (patch)
treea6696d16ece8e98844a6bac3ac550f0bd99f77c9 /main.cxx
parentc0b3ea3235ced04f5f372c98c5ea321e2da22c59 (diff)
downloadsystemtap-steved-4c5ff1bb5bb35cb35e30c45e385043c5f8383cd0.tar.gz
systemtap-steved-4c5ff1bb5bb35cb35e30c45e385043c5f8383cd0.tar.xz
systemtap-steved-4c5ff1bb5bb35cb35e30c45e385043c5f8383cd0.zip
2005-09-06 Martin Hunt <hunt@redhat.com>
* 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.
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx14
1 files changed, 13 insertions, 1 deletions
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);