From 0d49d7bcea3e40b3981918817aee8699c7ba0084 Mon Sep 17 00:00:00 2001 From: fche Date: Thu, 7 Jul 2005 18:43:36 +0000 Subject: 2005-07-07 Frank Ch. Eigler * Makefile.am (dist): Package up the source tree, including testsuite and runtime. * main.cxx: Use clog instead of cerr for logging messages. * buildrun.cxx: Ditto. (compile_pass): Add -Iruntime/user for test mode. * translate.cxx (*): Commonalize test/real mode output. * Makefile.in: Regenerated. --- main.cxx | 64 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index ca2f4dd3..5b6159c8 100644 --- a/main.cxx +++ b/main.cxx @@ -31,7 +31,7 @@ using namespace std; void usage (systemtap_session& s) { - cerr + clog << "SystemTap translator " << "(version " << VERSION << " built " << DATE << ")" << endl << "Copyright (C) 2005 Red Hat, Inc." << endl @@ -55,12 +55,12 @@ usage (systemtap_session& s) << " (parse, elaborate, translate, compile, run)" << endl << " -I DIR look in DIR for additional .stp script files"; if (s.include_path.size() == 0) - cerr << endl; + clog << endl; else - cerr << ", instead of" << endl; + clog << ", instead of" << endl; for (unsigned i=0; i 1) - rc = semantic_pass (s); + rc = semantic_pass (s); if (rc == 0 && s.last_pass == 2) { @@ -313,51 +320,52 @@ main (int argc, char * const argv []) } } + if (s.verbose) clog << "Pass 2: analyzed user script. " + << s.probes.size() << " probe(s), " + << s.functions.size() << " function(s), " + << s.globals.size() << " global(s)." << endl; + + if (rc || s.last_pass == 2) goto cleanup; // PASS 3: TRANSLATION - if (rc == 0 && s.last_pass > 2) - { - s.translated_source = string(s.tmpdir) + "/" + s.module_name + ".c"; - rc = translate_pass (s); - } + s.translated_source = string(s.tmpdir) + "/" + s.module_name + ".c"; + rc = translate_pass (s); if (rc == 0 && s.last_pass == 3) { ifstream i (s.translated_source.c_str()); cout << i.rdbuf(); } + + if (s.verbose) clog << "Pass 3: translated to C into \"" + << s.translated_source + << "\"" << endl; + + if (rc || s.last_pass == 3) goto cleanup; // PASS 4: COMPILATION - if (rc == 0 && s.last_pass > 3) - { - rc = compile_pass (s); - } + rc = compile_pass (s); - // PASS 5: RUN - if (rc == 0 && s.last_pass > 4) - { - rc = run_pass (s); - } + if (rc || s.last_pass == 4) goto cleanup; - // Pull out saved output - if (output_file != "-") - s.op = new translator_output (output_file); - else - s.op = new translator_output (cout); + // PASS 5: RUN + rc = run_pass (s); + // if (rc) goto cleanup; + cleanup: // Clean up temporary directory. Obviously, be careful with this. if (s.tmpdir == "") ; // do nothing else { if (s.keep_tmpdir) - cerr << "Keeping temporary directory \"" << s.tmpdir << "\"" << endl; + clog << "Keeping temporary directory \"" << s.tmpdir << "\"" << endl; else { string cleanupcmd = "/bin/rm -rf "; cleanupcmd += s.tmpdir; - if (s.verbose) cerr << "Running " << cleanupcmd << endl; + if (s.verbose) clog << "Running " << cleanupcmd << endl; (void) system (cleanupcmd.c_str()); } } -- cgit