]> sourceware.org Git - systemtap.git/commitdiff
2005-07-07 Frank Ch. Eigler <fche@redhat.com>
authorfche <fche>
Thu, 7 Jul 2005 18:43:36 +0000 (18:43 +0000)
committerfche <fche>
Thu, 7 Jul 2005 18:43:36 +0000 (18:43 +0000)
* 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.

ChangeLog
Makefile.am
Makefile.in
README
buildrun.cxx
main.cxx
translate.cxx

index 88cb0ca13a187e21c5a05e5b4d272142f1ea67c4..79df02539ff5e184140d750e83258e29a3c592cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-07-07  Frank Ch. Eigler  <fche@redhat.com>
+
+       * 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.
+
 2005-07-05  Graydon Hoare  <graydon@redhat.com>
 
        * elaborate.{h,cxx}: Revert previous changes.
index f56f71a01263c01df46653de1e3eaee5d94491b0..cc61811ba7d2a7199d30baec91433bbe1c7b81bd 100644 (file)
@@ -21,6 +21,10 @@ stapdatadir = @datadir@/systemtap
 DEFPATH="\".$(PATH_SEPARATOR)$(stapdatadir)\""
 DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H
 
+EXTRA_DIST=testsuite runtime
+dist-hook:
+       find $(distdir)/testsuite -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf
+
 p=$(srcdir)/testsuite/parse
 s=$(srcdir)/testsuite/sem
 t=$(srcdir)/testsuite/trans
index 26edb195d941529fedbf23fce12a921a550d5524..b00e4297859f221c81606dbe555199760a0e220a 100644 (file)
@@ -187,6 +187,7 @@ stapdatadir = @datadir@/systemtap
 
 # stuff for compiling gawk/pgawk
 DEFPATH = "\".$(PATH_SEPARATOR)$(stapdatadir)\""
+EXTRA_DIST = testsuite runtime
 p = $(srcdir)/testsuite/parse
 s = $(srcdir)/testsuite/sem
 t = $(srcdir)/testsuite/trans
@@ -463,6 +464,9 @@ distdir: $(DISTFILES)
            || exit 1; \
          fi; \
        done
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
        -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
          ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
@@ -648,7 +652,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
 .PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
        clean clean-binPROGRAMS clean-generic clean-local \
        clean-noinstPROGRAMS ctags dist dist-all dist-bzip2 dist-gzip \
-       dist-shar dist-tarZ dist-zip distcheck distclean \
+       dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \
        distclean-compile distclean-generic distclean-hdr \
        distclean-tags distcleancheck distdir distuninstallcheck dvi \
        dvi-am html html-am info info-am install install-am \
@@ -660,6 +664,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
        tags uninstall uninstall-am uninstall-binPROGRAMS \
        uninstall-info-am
 
+dist-hook:
+       find $(distdir)/testsuite -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf
 
 gcov:
        @$(MAKE) clean CXXFLAGS="-g -fprofile-arcs -ftest-coverage" all check
diff --git a/README b/README
index bf4b67fa99ffef82587c4e0a6350a592e458ffc4..93d3acb3fbfc1305e8b2caa57ad641dbb6cee36b 100644 (file)
--- a/README
+++ b/README
@@ -1,15 +1,17 @@
-systemtap prototype #3.3
-
-- demonstrates parsing of hypothetical systemtap script
-  language using hand-written simpe LL(1) recursive-descent parser
-  and similar little lexer: parse.cxx, parse.h
-- semantic analysis in elaborate.cxx; translation in translate.cxx;
-  driven from main.cxx
-- examples under testsuite/*
-- "probe", "global", "function" top-level constructs parsed
-- some tapset library auto-inclusion supported
-- use autotools-style configure; make; make check
-- to see parse tree: stap -p1 -e 'SCRIPT FRAGMENT'
-- to see semantic/type analysis results: stap -p2 -e 'SCRIPT FRAGMENT'
-- to see translation of constructs: stap -e 'SCRIPT FRAGMENT';
-  try compiling result with "gcc -c"!
+systemtap: a linux trace/probe tool
+
+Visit the project web site at <http://sources.redhat.com/systemtap>,
+for documentation and mailing lists for developers and users.
+
+This is free software.
+See the COPYING file for redistribution/modification terms.
+See the INSTALL file for generic build instructions.
+
+Prerequisites:
+
+- linux kernel 2.6.11+ with IBM kprobes
+- kernel module build environment
+- C compiler
+- elfutils with libdwfl
+- root privileges
+
index af22f1c8a8f08052cd6325fb37750556bab44f26..151c5ecdf676b5203d45426e048623b53098b052 100644 (file)
@@ -24,6 +24,8 @@ compile_pass (systemtap_session& s)
       string makefile_nm = s.tmpdir + "/Makefile";
       ofstream o (makefile_nm.c_str());
       o << "CFLAGS += -Werror" << endl;
+      if (s.test_mode)
+        o << "CFLAGS += -I \"" << s.runtime_path << "/user\"" << endl;
       o << "CFLAGS += -I \"" << s.runtime_path << "\"" << endl;
       o << "CFLAGS += -I \"" << s.runtime_path << "/relayfs\"" << endl;
       o << "obj-m := " << s.module_name << ".o" << endl;
@@ -36,9 +38,14 @@ compile_pass (systemtap_session& s)
   if (! s.verbose) make_cmd += " -s";
   make_cmd += string(" M=\"") + s.tmpdir + string("\" modules");
 
-  if (s.verbose) cerr << "Running " << make_cmd << endl;
+  if (s.verbose) clog << "Running " << make_cmd << endl;
   int rc = system (make_cmd.c_str());
-  if (s.verbose) cerr << "rc=" << rc << endl;
+
+
+  if (s.verbose) clog << "Pass 4: compiled into \""
+                      << s.module_name << ".ko"
+                      << "\"" << endl;
+
   return rc;
 }
 
index ca2f4dd3ee057417cd74e76af315a761029b6a4f..5b6159c824cf3e8cdb88ee9fbf3004450e5bdc64 100644 (file)
--- 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<s.include_path.size(); i++)
-    cerr << "              " << s.include_path[i] << endl;
-  cerr
+    clog << "              " << s.include_path[i] << endl;
+  clog
     << "   -R DIR     look in DIR for runtime, instead of "
     << s.runtime_path
     << endl
@@ -207,6 +207,9 @@ main (int argc, char * const argv [])
       }
     else
       s.tmpdir = tmpdir;
+
+    if (s.verbose)
+      clog << "Created temporary directory \"" << s.tmpdir << "\"" << endl;
   }
 
 
@@ -260,10 +263,14 @@ main (int argc, char * const argv [])
         }
     }
 
+  if (s.verbose) clog << "Pass 1: parsed user script and "
+                      << s.library_files.size()
+                      << " library script(s)." << endl;
+
+  if (rc || s.last_pass == 1) goto cleanup;
 
   // PASS 2: ELABORATION
-  if (rc == 0 && s.last_pass > 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());
         }
     }
index cb25044ba5b5cff528882eef92297fdebf48f2a1..125c5b2bed0cfdeb827e866a4febbc6da51dcf5d 100644 (file)
@@ -177,12 +177,8 @@ struct c_tmpcounter: public traversing_visitor
 void
 c_unparser::emit_common_header ()
 {
-  o->newline() << "#if TEST_MODE";
-  o->newline() << "#include <string.h>";
-  o->newline() << "#else";
   o->newline() << "#include <linux/string.h>";
   // XXX: tapsets.cxx should be able to add additional definitions
-  o->newline() << "#endif";
 
   o->newline() << "#define NR_CPU 1"; 
   o->newline() << "#define MAXNESTING 30";
@@ -1445,14 +1441,8 @@ translate_pass (systemtap_session& s)
 
   try
     {
-      s.op->line() << "#define TEST_MODE " << (s.test_mode ? 1 : 0)
-                   << endl;
-      
-      // XXX: until the runtime can handle user-level tests properly
-      s.op->newline() << "#if ! TEST_MODE";
-      s.op->newline() << "#define STP_NETLINK_ONLY"; // XXX
+      s.op->line() << "#define TEST_MODE " << (s.test_mode ? 1 : 0) << endl;
       s.op->newline() << "#include \"runtime.h\"";
-      s.op->newline() << "#endif" << endl;
 
       s.up->emit_common_header ();
 
This page took 0.05105 seconds and 5 git commands to generate.