diff options
author | fche <fche> | 2005-07-28 18:07:02 +0000 |
---|---|---|
committer | fche <fche> | 2005-07-28 18:07:02 +0000 |
commit | 24cb178fd82936f55d254ebd0cd79802da21134a (patch) | |
tree | d9fbde4a94c16abf37a994c7d3ae147d04b77919 /main.cxx | |
parent | b290c791d701b5841ed824fddfce3f949b0a7b61 (diff) | |
download | systemtap-steved-24cb178fd82936f55d254ebd0cd79802da21134a.tar.gz systemtap-steved-24cb178fd82936f55d254ebd0cd79802da21134a.tar.xz systemtap-steved-24cb178fd82936f55d254ebd0cd79802da21134a.zip |
2005-07-28 Frank Ch. Eigler <fche@redhat.com>
translator/1120
* main.cxx (main): Preset -R and -I options from environment
variables (if set). Pass guru mode flags to parser.
* parse.cxx (privileged): New parser operation flag. Update callers.
(parse_embeddedcode): Throw an error if !privileged.
(parse_functiondecl): Change signature. Prevent duplicates.
(parse_globals): Ditto.
* parse.h: Corresponding changes.
* tapset/*.stp: Beginnings of real tapset library, to replace
previous builtins.
* tapsets.cxx: Greatly reduce verbose mode output.
* Makefile.am: Install & dist it.
* runtest.sh: Refer to it.
* Makefile.in, aclocal.m4: Regenerated.
* testsuite/*/*.stp: Set guru mode via /bin/sh if needed.
* testusite/*/*ko.stp: Homogenize shell scripts.
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 48 |
1 files changed, 26 insertions, 22 deletions
@@ -17,6 +17,7 @@ #include <fstream> #include <sstream> #include <cerrno> +#include <cstdlib> extern "C" { #include <glob.h> @@ -57,19 +58,16 @@ usage (systemtap_session& s) if (s.include_path.size() == 0) clog << endl; else - clog << ", instead of" << endl; + clog << ", in addition to" << endl; for (unsigned i=0; i<s.include_path.size(); i++) clog << " " << s.include_path[i] << endl; clog - << " -R DIR look in DIR for runtime, instead of " - << s.runtime_path - << endl - << " -r RELEASE use kernel RELEASE, instead of " - << s.kernel_release - << endl - << " -m MODULE set probe module name, insetad of " - << s.module_name - << endl + << " -R DIR look in DIR for runtime, instead of" << endl + << " " << s.runtime_path << endl + << " -r RELEASE use kernel RELEASE, instead of" << endl + << " " << s.kernel_release << endl + << " -m MODULE set probe module name, insetad of" << endl + << " " << s.module_name << endl << " -o FILE send output to file instead of stdout" << endl << " -k keep temporary directory" << endl; // XXX: other options: @@ -109,10 +107,20 @@ main (int argc, char * const argv []) s.test_mode = false; s.guru_mode = false; s.last_pass = 5; - s.runtime_path = string(PKGDATADIR) + "/runtime"; s.module_name = "stap_" + stringify(getuid()) + "_" + stringify(time(0)); s.keep_tmpdir = false; - s.include_path.push_back (string(PKGDATADIR) + "/tapsets"); + + const char* s_p = getenv ("SYSTEMTAP_TAPSET"); + if (s_p != NULL) + s.include_path.push_back (s_p); + else + s.include_path.push_back (string(PKGDATADIR) + "/tapset"); + + const char* s_r = getenv ("SYSTEMTAP_RUNTIME"); + if (s_r != NULL) + s.runtime_path = s_r; + else + s.runtime_path = string(PKGDATADIR) + "/runtime"; while (true) { @@ -223,19 +231,17 @@ main (int argc, char * const argv []) // XXX: pass args vector, so parser (or lexer?) can substitute // $1..$NN with actual arguments if (script_file == "-") - s.user_file = parser::parse (cin); + s.user_file = parser::parse (cin, s.guru_mode); else if (script_file != "") - s.user_file = parser::parse (script_file); + s.user_file = parser::parse (script_file, s.guru_mode); else { istringstream ii (cmdline_script); - s.user_file = parser::parse (ii); + s.user_file = parser::parse (ii, s.guru_mode); } if (s.user_file == 0) // syntax errors already printed rc ++; - else - s.user_file->privileged = s.guru_mode; // Construct kernel-versioning search path vector<string> version_suffixes; @@ -273,14 +279,12 @@ main (int argc, char * const argv []) for (unsigned j=0; j<globbuf.gl_pathc; j++) { - stapfile* f = parser::parse (globbuf.gl_pathv[j]); + // privilege only for /usr/share/systemtap? + stapfile* f = parser::parse (globbuf.gl_pathv[j], true); if (f == 0) rc ++; else - { - f->privileged = true; // XXX only for /usr/share/systemtap? - s.library_files.push_back (f); - } + s.library_files.push_back (f); } globfree (& globbuf); |