From c3a3c0c99c32c0969e6450d60aae1a2b1798ca17 Mon Sep 17 00:00:00 2001 From: wcohen Date: Tue, 26 Jun 2007 19:36:25 +0000 Subject: 2007-06-26 William Cohen PR 4529 * coveragedb.cxx: New. * coveragedb.h: New. * Makefile.am: Add coveragedb.cxx and sqlite3 to build. * Makefile.in: Regenerated. * configure.ac: Add test for sqlite3 * configure: Regenerated. * systemtap.spec.in: Add dependencies for sqlite3/sqlite3-devel. * elaborate.h, elaborate.cxx (derived_probe::collect_derivation_chain): New. (alias_expansion_builder::build): Correct token location. (semantic_pass_opt[12): Track used and unused variables/functions. * session.h (tapset_compile_coverage, unused_globals, unused_probes, unused_functions): New fields. * staptree.h (unused_locals, probe_point::str): New member. * staptree.cxx: Ditto. * main.cxx: Add "-q" tapset coverage option and SYSTEMTAP_COVERAGE env. --- main.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index f5740aa9..53f47513 100644 --- a/main.cxx +++ b/main.cxx @@ -18,6 +18,7 @@ #include "hash.h" #include "cache.h" #include "util.h" +#include "coveragedb.h" #include #include @@ -99,6 +100,8 @@ usage (systemtap_session& s, int exitcode) << endl << " -x PID sets target() to PID" << endl << " -t collect probe timing information" << endl + << " -q generate information on tapset coverage" + << endl ; // -d: dump safety-related external references @@ -216,6 +219,7 @@ main (int argc, char * const argv []) s.perfmon=0; s.symtab = false; s.use_cache = true; + s.tapset_compile_coverage = false; const char* s_p = getenv ("SYSTEMTAP_TAPSET"); if (s_p != NULL) @@ -262,10 +266,14 @@ main (int argc, char * const argv []) } } + const char* s_tc = getenv ("SYSTEMTAP_COVERAGE"); + if (s_tc != NULL) + s.tapset_compile_coverage = true; + while (true) { // NB: also see find_hash(), help(), switch stmt below, stap.1 man page - int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:u"); + int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uq"); if (grc < 0) break; switch (grc) @@ -402,6 +410,10 @@ main (int argc, char * const argv []) s.macros.push_back (string (optarg)); break; + case 'q': + s.tapset_compile_coverage = true; + break; + case 'h': usage (s, 0); break; @@ -787,6 +799,12 @@ pass_5: // if (rc) goto cleanup; cleanup: + + // update the database information + if (!rc && s.tapset_compile_coverage) { + update_coverage_db(s); + } + // Clean up temporary directory. Obviously, be careful with this. if (s.tmpdir == "") ; // do nothing -- cgit