diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | main.cxx | 49 | ||||
-rw-r--r-- | session.h | 1 | ||||
-rw-r--r-- | stap.1.in | 27 | ||||
-rw-r--r-- | testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | testsuite/systemtap.base/cmd_parse.exp | 8 |
7 files changed, 77 insertions, 22 deletions
@@ -1,3 +1,9 @@ +2008-11-18 Frank Ch. Eigler <fche@elastic.org> + + PR6925. + * main.cxx (usage,main): Process new --vp option. + * session.h (perpass_verbose): New field. + 2008-11-11 Stan Cox <scox@redhat.com> * Makefile.am (pkglib_LIBRARIES): New. @@ -1,5 +1,8 @@ * What's new +- Per-pass verbosity control is available with the new "--vp {N}+" option. + "stap --vp 040" adds 4 units of -v verbosity only to pass 2. + - Most probe handlers now run with interrupts enabled, for improved system responsiveness and less probing overhead. This may result in more skipped probes, for example if a reentrant probe handler @@ -74,9 +74,16 @@ usage (systemtap_session& s, int exitcode) << endl << "Options:" << endl << " -- end of translator options, script options follow" << endl - << " -v increase verbosity [" << s.verbose << "]" << endl << " -h show help" << endl << " -V show version" << endl + << " -p NUM stop after pass NUM 1-5, instead of " << s.last_pass << endl + << " (parse, elaborate, translate, compile, run)" << endl + << " -v add verbosity to all passes" << endl + << " --vp {N}+ add per-pass verbosity ["; + for (unsigned i=0; i<5; i++) + clog << (s.perpass_verbose[i] <= 9 ? s.perpass_verbose[i] : 9); + clog + << "]" << endl << " -k keep temporary directory" << endl << " -u unoptimized translation" << (s.unoptimized ? " [set]" : "") << endl << " -w suppress warnings" << (s.suppress_warnings ? " [set]" : "") << endl @@ -84,11 +91,7 @@ usage (systemtap_session& s, int exitcode) << " -P prologue-searching for function probes" << (s.prologue_searching ? " [set]" : "") << endl << " -b bulk (percpu file) mode" << (s.bulk_mode ? " [set]" : "") << endl - << " -s NUM buffer size in megabytes, instead of " - << s.buffer_size << endl - << " -p NUM stop after pass NUM 1-5, instead of " - << s.last_pass << endl - << " (parse, elaborate, translate, compile, run)" << endl + << " -s NUM buffer size in megabytes, instead of " << s.buffer_size << endl << " -I DIR look in DIR for additional .stp script files"; if (s.include_path.size() == 0) clog << endl; @@ -334,7 +337,7 @@ main (int argc, char * const argv []) (void) uname (& buf); s.kernel_release = string (buf.release); s.architecture = string (buf.machine); - s.verbose = 0; + for (unsigned i=0; i<5; i++) s.perpass_verbose[i]=0; s.timing = false; s.guru_mode = false; s.bulk_mode = false; @@ -420,12 +423,14 @@ main (int argc, char * const argv []) #define LONG_OPT_KMAP 2 #define LONG_OPT_IGNORE_VMLINUX 3 #define LONG_OPT_IGNORE_DWARF 4 +#define LONG_OPT_VERBOSE_PASS 5 // NB: also see find_hash(), usage(), switch stmt below, stap.1 man page static struct option long_options[] = { { "kelf", 0, &long_opt, LONG_OPT_KELF }, { "kmap", 2, &long_opt, LONG_OPT_KMAP }, { "ignore-vmlinux", 0, &long_opt, LONG_OPT_IGNORE_VMLINUX }, { "ignore-dwarf", 0, &long_opt, LONG_OPT_IGNORE_DWARF }, + { "vp", 1, &long_opt, LONG_OPT_VERBOSE_PASS }, { NULL, 0, NULL, 0 } }; int grc = getopt_long (argc, argv, "hVMvtp:I:e:o:R:r:m:kgPc:x:D:bs:uqwl:d:L:F", @@ -443,7 +448,8 @@ main (int argc, char * const argv []) break; case 'v': - s.verbose ++; + for (unsigned i=0; i<5; i++) + s.perpass_verbose[i] ++; break; case 't': @@ -642,6 +648,26 @@ main (int argc, char * const argv []) case LONG_OPT_IGNORE_DWARF: s.ignore_dwarf = true; break; + case LONG_OPT_VERBOSE_PASS: + { + bool ok = true; + if (strlen(optarg) < 1 || strlen(optarg) > 5) + ok = false; + if (ok) + for (unsigned i=0; i<5; i++) + if (isdigit (optarg[i])) + s.perpass_verbose[i] += optarg[i]-'0'; + else + ok = false; + + if (! ok) + { + cerr << "Invalid --vp argument: it takes 1 to 5 digits." << endl; + usage (s, 1); + } + // NB: we don't do this: s.last_pass = strlen(optarg); + break; + } default: cerr << "Internal error parsing command arguments." << endl; usage(s, 1); @@ -778,6 +804,7 @@ main (int argc, char * const argv []) // PASS 1a: PARSING USER SCRIPT + s.verbose = s.perpass_verbose[0]; struct stat user_file_stat; int user_file_stat_rc = -1; @@ -921,6 +948,7 @@ main (int argc, char * const argv []) gettimeofday (&tv_before, NULL); // PASS 2: ELABORATION + s.verbose = s.perpass_verbose[1]; rc = semantic_pass (s); if (s.listing_mode || (rc == 0 && s.last_pass == 2)) @@ -975,7 +1003,7 @@ main (int argc, char * const argv []) if (rc || s.listing_mode || s.last_pass == 2 || pending_interrupts) goto cleanup; // PASS 3: TRANSLATION - + s.verbose = s.perpass_verbose[2]; times (& tms_before); gettimeofday (&tv_before, NULL); @@ -1004,7 +1032,7 @@ main (int argc, char * const argv []) if (rc || s.last_pass == 3 || pending_interrupts) goto cleanup; // PASS 4: COMPILATION - + s.verbose = s.perpass_verbose[3]; times (& tms_before); gettimeofday (&tv_before, NULL); rc = compile_pass (s); @@ -1054,6 +1082,7 @@ main (int argc, char * const argv []) // PASS 5: RUN pass_5: + s.verbose = s.perpass_verbose[4]; times (& tms_before); gettimeofday (&tv_before, NULL); // NB: this message is a judgement call. The other passes don't emit @@ -89,6 +89,7 @@ struct systemtap_session std::string cmd; int target_pid; int last_pass; + unsigned perpass_verbose[5]; unsigned verbose; bool timing; bool keep_tmpdir; @@ -93,12 +93,6 @@ This manual corresponds to version @VERSION@. .SH OPTIONS The systemtap translator supports the following options. Any other option prints a list of supported options. -.\" undocumented for now: -.\" \-t test mode -.TP -.B \-v -Increase verbosity. Produce a larger volume of informative (?) output -each time option repeated. .TP .B \-h Show help message. @@ -106,6 +100,21 @@ Show help message. .B \-V Show version message. .TP +.BI \-p " NUM" +Stop after pass NUM. The passes are numbered 1-5: parse, elaborate, +translate, compile, run. See the +.B PROCESSING +section for details. +.TP +.B \-v +Increase verbosity for all passes. Produce a larger volume of +informative (?) output each time option repeated. +.TP +.B \-\-vp ABCDE +Increase verbosity on a per-pass basis. For example, "\-\-vp\ 002" +adds 2 units of verbosity to pass 3 only. The combination "\-v\ \-\-vp\ 00004" +adds 1 unit of verbosity for all passes, and 4 more for pass 5. +.TP .B \-k Keep the temporary directory after all processing. This may be useful in order to examine the generated C code, or to reuse the compiled @@ -136,12 +145,6 @@ and average amount of time spent in each probe. Use NUM megabyte buffers for kernel-to-user data transfer. On a multiprocessor in bulk mode, this is a per-processor amount. .TP -.BI \-p " NUM" -Stop after pass NUM. The passes are numbered 1-5: parse, elaborate, -translate, compile, run. See the -.B PROCESSING -section for details. -.TP .BI \-I " DIR" Add the given directory to the tapset search directory. See the description of pass 2 for details. diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 517df153..f0e72dbd 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-11-18 Frank Ch. Eigler <fche@elastic.org> + + PR6925. + * systemtap.base/cmd_parse.exp: Add --vp test. + 2008-11-11 Stan Cox <scox@redhat.com> * systemtap.base/static_uprobes.exp: New file. diff --git a/testsuite/systemtap.base/cmd_parse.exp b/testsuite/systemtap.base/cmd_parse.exp index 733881a1..c6b098a4 100644 --- a/testsuite/systemtap.base/cmd_parse.exp +++ b/testsuite/systemtap.base/cmd_parse.exp @@ -121,3 +121,11 @@ expect { eof {fail "cmd_parse13: unexpected EOF"} } wait;close + +spawn sh -c "stap -v -v --vp 01020 -h 2>&1" +expect { + -re {add per-pass verbosity .23242.} { pass "cmd_parse14" } + timeout { fail "cmd_parse14: timeout" } + eof { fail "cmd_parse14: eof" } +} +wait;catch {close} |