]> sourceware.org Git - systemtap.git/commitdiff
stap: unite all dumping modes into s.dump_mode
authorJonathan Lebon <jlebon@redhat.com>
Mon, 31 Mar 2014 20:11:27 +0000 (16:11 -0400)
committerJonathan Lebon <jlebon@redhat.com>
Tue, 1 Apr 2014 19:37:15 +0000 (15:37 -0400)
Clean up the way dumping modes are implement. We create a new enum
member which tracks the type of dumping wanted. This enum handles all
stap invocations which do not directly handle a user-script:
-l/-L/--dump-probe-types/--dump-probe-aliases/--dump-functions. It also
allows us to clean up the cmdline_script/have_script hacks previously
used in switch handling.

The trickiest part about this patch is to now allow for the possibility
of s.user_file to be NULL throughout passes 1 and 2, which previously
always assumed a script was present.

csclient.cxx
elaborate.cxx
main.cxx
man/stap.1
session.cxx
session.h
tapsets.cxx

index 2fcdab5711f92e133b178428a304881b87ee58e8..b0a986ca0e08712a978a2b80673d98504949af0d 100644 (file)
@@ -852,7 +852,7 @@ compile_server_client::passes_0_4 ()
            << TIMESPRINT
            << endl;
     }
-  if (rc && !s.listing_mode && !s.dump_functions)
+  if (rc && !s.dump_mode)
     {
       clog << _("Passes: via server failed.  Try again with another '-v' option.") << endl;
     }
index 592da23d0ce5ae09d2e0c1a7acb8187bd25f68b6..054f6da38e51402306fc338671d9481e89b721ab 100644 (file)
@@ -1066,8 +1066,8 @@ derive_probes (systemtap_session& s,
             {
               throw semantic_error(e);
             }
-         // Only output in listing if -vv is supplied:
-          else if ((!s.listing_mode && !s.dump_functions) || (s.verbose > 1))
+         // Only output in dump mode if -vv is supplied:
+          else if (!s.dump_mode || (s.verbose > 1))
             {
               // print this one manually first because it's more important than
               // the optional errs
@@ -1597,20 +1597,23 @@ semantic_pass_symbols (systemtap_session& s)
 {
   symresolution_info sym (s);
 
-  // NB: s.files can grow during this iteration, so size() can
-  // return gradually increasing numbers.
-  s.files.push_back (s.user_file);
-
   // If we're listing functions, then we need to include all the files. Probe
   // aliases won't be visited/derived so all we gain are the functions, global
   // variables, and any real probes (e.g. begin probes). NB: type resolution for
   // a specific function arg may fail if it could only be determined from a
   // function call in one of the skipped aliases.
-  if (s.dump_functions)
+  if (s.dump_mode == systemtap_session::dump_functions)
     {
       s.files.insert(s.files.end(), s.library_files.begin(),
                                     s.library_files.end());
     }
+  else if (s.user_file)
+    {
+      // Normal run: seed s.files with user_file and let it grow through the
+      // find_* functions. NB: s.files can grow during this iteration, so
+      // size() can return gradually increasing numbers.
+      s.files.push_back (s.user_file);
+    }
 
   for (unsigned i = 0; i < s.files.size(); i++)
     {
@@ -1754,10 +1757,10 @@ semantic_pass_symbols (systemtap_session& s)
 // Keep unread global variables for probe end value display.
 void add_global_var_display (systemtap_session& s)
 {
-  // Don't generate synthetic end probes when in listings mode;
-  // it would clutter up the list of probe points with "end ...".
-  // Also don't bother in function dump mode, since it'll never be used.
-  if (s.listing_mode || s.dump_functions) return;
+  // Don't generate synthetic end probes when in listing mode; it would clutter
+  // up the list of probe points with "end ...". In fact, don't bother in any
+  // dump mode at all, since it'll never be used.
+  if (s.dump_mode) return;
 
   varuse_collecting_visitor vut(s);
 
@@ -1920,7 +1923,7 @@ semantic_pass (systemtap_session& s)
       if (rc == 0) rc = semantic_pass_stats (s);
       if (rc == 0) embeddedcode_info_pass (s);
 
-      if (s.num_errors() == 0 && s.probes.size() == 0 && !s.listing_mode)
+      if (s.num_errors() == 0 && s.probes.size() == 0 && !s.dump_mode)
         throw SEMANTIC_ERROR (_("no probes found"));
     }
   catch (const semantic_error& e)
@@ -1932,11 +1935,12 @@ semantic_pass (systemtap_session& s)
   // PR11443
   // NB: listing mode only cares whether we have any probes,
   // so all previous error conditions are disregarded.
-  if (s.listing_mode)
+  if (s.dump_mode == systemtap_session::dump_matched_probes ||
+      s.dump_mode == systemtap_session::dump_matched_probes_vars)
     rc = s.probes.empty();
 
   // If we're dumping functions, only error out if no functions were found
-  if (s.dump_functions)
+  if (s.dump_mode == systemtap_session::dump_functions)
     rc = s.functions.empty();
 
   return rc;
@@ -2305,7 +2309,8 @@ void semantic_pass_opt1 (systemtap_session& s, bool& relaxed_p)
       functiondecl* fd = it->second;
       if (ftv.traversed.find(fd) == ftv.traversed.end())
         {
-          if (fd->tok->location.file->name == s.user_file->name && ! fd->synthetic)// !tapset
+          if (! fd->synthetic && s.user_file &&
+              fd->tok->location.file->name == s.user_file->name) // !tapset
             s.print_warning (_F("Eliding unused function '%s'", fd->name.c_str()), fd->tok);
           // s.functions.erase (it); // NB: can't, since we're already iterating upon it
           new_unused_functions.push_back (fd);
@@ -2360,7 +2365,8 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
         if (vut.read.find (l) == vut.read.end() &&
             vut.written.find (l) == vut.written.end())
           {
-            if (l->tok->location.file->name == s.user_file->name) // !tapset
+            if (s.user_file &&
+                l->tok->location.file->name == s.user_file->name) // !tapset
               s.print_warning (_F("Eliding unused variable '%s'", l->name.c_str()), l->tok);
            if (s.tapset_compile_coverage) {
              s.probes[i]->unused_locals.push_back
@@ -2401,7 +2407,8 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
           if (vut.read.find (l) == vut.read.end() &&
               vut.written.find (l) == vut.written.end())
             {
-              if (l->tok->location.file->name == s.user_file->name) // !tapset
+              if (s.user_file &&
+                  l->tok->location.file->name == s.user_file->name) // !tapset
                 s.print_warning (_F("Eliding unused variable '%s'", l->name.c_str()), l->tok);
               if (s.tapset_compile_coverage) {
                 fd->unused_locals.push_back (fd->locals[j]);
@@ -2442,7 +2449,8 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati
       if (vut.read.find (l) == vut.read.end() &&
           vut.written.find (l) == vut.written.end())
         {
-          if (l->tok->location.file->name == s.user_file->name) // !tapset
+          if (s.user_file &&
+              l->tok->location.file->name == s.user_file->name) // !tapset
             s.print_warning (_F("Eliding unused variable '%s'", l->name.c_str()), l->tok);
          if (s.tapset_compile_coverage) {
            s.unused_globals.push_back(s.globals[i]);
@@ -2531,7 +2539,8 @@ dead_assignment_remover::visit_assignment (assignment* e)
                 session.print_warning("eliding write-only ", *e->left->tok);
               else
               */
-              if (e->left->tok->location.file->name == session.user_file->name) // !tapset
+              if (session.user_file &&
+                  e->left->tok->location.file->name == session.user_file->name) // !tapset
                 session.print_warning(_F("Eliding assignment to '%s'", leftvar->name.c_str()), e->tok);
               provide (e->right); // goodbye assignment*
               relaxed_p = false;
@@ -2806,7 +2815,8 @@ dead_stmtexpr_remover::visit_expr_statement (expr_statement *s)
         session.print_warning("eliding never-assigned ", *s->value->tok);
       else
       */
-      if (s->value->tok->location.file->name == session.user_file->name) // not tapset
+      if (session.user_file &&
+          s->value->tok->location.file->name == session.user_file->name) // not tapset
         session.print_warning("Eliding side-effect-free expression ", s->tok);
 
       // NB: this 0 pointer is invalid to leave around for any length of
index 9e741985eb831bb97b6156b6d8d6757e80bda811..ce674f6ff8a10e73179597bfcbc196cc9b554fa5 100644 (file)
--- a/main.cxx
+++ b/main.cxx
@@ -65,7 +65,8 @@ uniq_list(list<string>& l)
 static void
 printscript(systemtap_session& s, ostream& o)
 {
-  if (s.listing_mode)
+  if (s.dump_mode == systemtap_session::dump_matched_probes ||
+      s.dump_mode == systemtap_session::dump_matched_probes_vars)
     {
       // We go through some heroic measures to produce clean output.
       // Record the alias and probe pointer as <name, set<derived_probe *> >
@@ -131,7 +132,7 @@ printscript(systemtap_session& s, ostream& o)
           o << it->first; // probe name or alias
 
           // Print the locals and arguments for -L mode only
-          if (s.listing_mode_vars)
+          if (s.dump_mode == systemtap_session::dump_matched_probes_vars)
             {
               map<string,unsigned> var_count; // format <"name:type",count>
               map<string,unsigned> arg_count;
@@ -678,27 +679,45 @@ passes_0_4 (systemtap_session &s)
   // PASS 1b: PARSING USER SCRIPT
   PROBE1(stap, pass1b__start, &s);
 
-  if (s.script_file == "-")
-    {
-      s.user_file = parse (s, cin, s.guru_mode, false /* errs_as_warnings */);
-    }
-  else if (s.script_file != "")
+  // Only try to parse a user script if the user provided one, or if we have to
+  // make one (as is the case for listing mode). Otherwise, s.user_script
+  // remains NULL.
+  if (!s.script_file.empty() ||
+      !s.cmdline_script.empty() ||
+      s.dump_mode == systemtap_session::dump_matched_probes ||
+      s.dump_mode == systemtap_session::dump_matched_probes_vars)
     {
-      s.user_file = parse (s, s.script_file, s.guru_mode, false /* errs_as_warnings */);
-    }
-  else
-    {
-      istringstream ii (s.cmdline_script);
-      s.user_file = parse (s, ii, s.guru_mode, false /* errs_as_warnings */);
-    }
-  if (s.user_file == 0)
-    {
-      // Syntax errors already printed.
-      rc ++;
+      if (s.script_file == "-")
+        {
+          s.user_file = parse (s, cin, s.guru_mode,
+                               false /* errs_as_warnings */);
+        }
+      else if (s.script_file != "")
+        {
+          s.user_file = parse (s, s.script_file, s.guru_mode,
+                               false /* errs_as_warnings */);
+        }
+      else if (s.cmdline_script != "")
+        {
+          istringstream ii (s.cmdline_script);
+          s.user_file = parse (s, ii, s.guru_mode,
+                               false /* errs_as_warnings */);
+        }
+      else // listing mode
+        {
+          istringstream ii ("probe " + s.dump_matched_pattern + " {}");
+          s.user_file = parse (s, ii, s.guru_mode,
+                               false /* errs_as_warnings */);
+        }
+      if (s.user_file == 0)
+        {
+          // Syntax errors already printed.
+          rc ++;
+        }
     }
 
   // Dump a list of probe aliases picked up, if requested
-  if (s.dump_probe_aliases)
+  if (s.dump_mode == systemtap_session::dump_probe_aliases)
     {
       set<string> aliases;
       vector<stapfile*>::const_iterator file;
@@ -765,13 +784,15 @@ passes_0_4 (systemtap_session &s)
            << endl;
     }
 
-  if (rc && !s.listing_mode)
+  if (rc && !s.dump_mode)
     cerr << _("Pass 1: parse failed.  [man error::pass1]") << endl;
 
   PROBE1(stap, pass1__end, &s);
 
   assert_no_interrupts();
-  if (rc || s.last_pass == 1) return rc;
+  if (rc || s.last_pass == 1 ||
+      s.dump_mode == systemtap_session::dump_probe_aliases)
+    return rc;
 
   times (& tms_before);
   gettimeofday (&tv_before, NULL);
@@ -782,11 +803,10 @@ passes_0_4 (systemtap_session &s)
   rc = semantic_pass (s);
 
   // Dump a list of known probe point types, if requested.
-  if (s.dump_probe_types)
+  if (s.dump_mode == systemtap_session::dump_probe_types)
     s.pattern_root->dump (s);
-
   // Dump a list of functions we picked up, if requested.
-  if (s.dump_functions)
+  else if (s.dump_mode == systemtap_session::dump_functions)
     {
       map<string,functiondecl*>::const_iterator func;
       for (func  = s.functions.begin();
@@ -802,7 +822,9 @@ passes_0_4 (systemtap_session &s)
         }
     }
   // Dump the whole script if requested, or if we stop at 2
-  else if (s.listing_mode || (rc == 0 && s.last_pass == 2))
+  else if (s.dump_mode == systemtap_session::dump_matched_probes ||
+           s.dump_mode == systemtap_session::dump_matched_probes_vars ||
+           (rc == 0 && s.last_pass == 2))
     printscript(s, cout);
 
   times (& tms_after);
@@ -817,14 +839,16 @@ passes_0_4 (systemtap_session &s)
                       << TIMESPRINT
                       << endl;
 
-  if (rc && !s.listing_mode && !s.dump_functions && !s.try_server ())
+  if (rc && !s.dump_mode && !s.try_server ())
     cerr << _("Pass 2: analysis failed.  [man error::pass2]") << endl;
 
   PROBE1(stap, pass2__end, &s);
 
   assert_no_interrupts();
-  // NB: listing_mode or dump_functions mode set last_pass to 2
-  if (rc || s.last_pass == 2) return rc;
+  // NB: none of the dump modes need to go beyond pass-2. If this changes, break
+  // into individual modes here.
+  if (rc || s.last_pass == 2 || s.dump_mode)
+    return rc;
 
   rc = prepare_translate_pass (s);
   assert_no_interrupts();
@@ -1148,10 +1172,10 @@ main (int argc, char * const argv [])
         manage_server_trust (ss);
 #endif
 
-        // Run the passes only if a script has been specified. The requirement for
-        // a script has already been checked in systemtap_session::check_options.
-        // Run the passes also if a dump of supported probe types has been requested via a server.
-        if (ss.have_script || (ss.dump_probe_types && ! s.specified_servers.empty ()))
+        // Run the passes only if a script has been specified or if we're
+        // dumping something. The requirement for a script has already been
+        // checked in systemtap_session::check_options.
+        if (ss.have_script || ss.dump_mode)
           {
             // Run passes 0-4 for each unique session,
             // either locally or using a compile-server.
@@ -1166,12 +1190,6 @@ main (int argc, char * const argv [])
            if (rc || s.perpass_verbose[0] >= 1)
              s.explain_auto_options ();
           }
-        else if (ss.dump_probe_types)
-          {
-            // Dump a list of known probe point types, if requested.
-            register_standard_tapsets(ss);
-            ss.pattern_root->dump (ss);
-          }
       }
 
     // Run pass 5, if requested
index 109f93c1c6eb9121e08601d278f718ef409e634c..e1d8c76b7729ff67cba307c19b4dab4938bc30e1 100644 (file)
@@ -68,6 +68,24 @@ stap \- systemtap script translator/driver
 [
 .I ARGUMENTS
 ]
+.br
+.B stap
+[
+.I OPTIONS
+]
+.B \-\-dump-probe-types
+.br
+.B stap
+[
+.I OPTIONS
+]
+.B \-\-dump-probe-aliases
+.br
+.B stap
+[
+.I OPTIONS
+]
+.B \-\-dump-functions
 
 .SH DESCRIPTION
 
@@ -525,7 +543,7 @@ the operation is performed.
 
 .TP
 .BI \-\-dump-probe-types
-Dumps a list of supported probe types. If
+Dumps a list of supported probe types and exits. If
 .IR \-\-privilege=stapusr
 is also specified, the list will be limited to probe types available to unprivileged users.
 
index 57e93c97cf97774d944945925d691aa79b69d801..15eb5a30a87755b6dcbaea410c1dfe758743bf3f 100644 (file)
@@ -118,11 +118,8 @@ systemtap_session::systemtap_session ():
   unoptimized = false;
   suppress_warnings = false;
   panic_warnings = false;
-  listing_mode = false;
-  listing_mode_vars = false;
-  dump_probe_types = false;
-  dump_probe_aliases = false;
-  dump_functions = false;
+  dump_mode = systemtap_session::dump_none;
+  dump_matched_pattern = "";
 
 #ifdef ENABLE_PROLOGUES
   prologue_searching = true;
@@ -305,11 +302,8 @@ systemtap_session::systemtap_session (const systemtap_session& other,
   unoptimized = other.unoptimized;
   suppress_warnings = other.suppress_warnings;
   panic_warnings = other.panic_warnings;
-  listing_mode = other.listing_mode;
-  listing_mode_vars = other.listing_mode_vars;
-  dump_probe_types = other.dump_probe_types;
-  dump_probe_aliases = other.dump_probe_aliases;
-  dump_functions = other.dump_functions;
+  dump_mode = other.dump_mode;
+  dump_matched_pattern = other.dump_matched_pattern;
 
   prologue_searching = other.prologue_searching;
 
@@ -490,11 +484,15 @@ systemtap_session::usage (int exitcode)
   version ();
   clog
     << endl
-    << _F("Usage: stap [options] FILE         Run script in file.\n"
-     "   or: stap [options] -            Run script on stdin.\n"
-     "   or: stap [options] -e SCRIPT    Run given script.\n"
-     "   or: stap [options] -l PROBE     List matching probes.\n"
-     "   or: stap [options] -L PROBE     List matching probes and local variables.\n\n"
+    << _F(
+     "Usage: stap [options] FILE                    Run script in file.\n"
+     "   or: stap [options] -                       Run script on stdin.\n"
+     "   or: stap [options] -e SCRIPT               Run given script.\n"
+     "   or: stap [options] -l PROBE                List matching probes.\n"
+     "   or: stap [options] -L PROBE                List matching probes and local variables.\n"
+     "   or: stap [options] --dump-probe-types      List available probe types.\n"
+     "   or: stap [options] --dump-probe-aliases    List available probe aliases.\n"
+     "   or: stap [options] --dump-functions        List available functions.\n\n"
      "Options (in %s/rc and on command line):\n"
      "   --         end of translator options, script options follow\n"
      "   -h --help  show help\n"
@@ -687,11 +685,6 @@ systemtap_session::parse_cmdline (int argc, char * const argv [])
               cerr << _("Invalid pass number (should be 1-5).") << endl;
               return 1;
             }
-          if (listing_mode && last_pass != 2)
-            {
-              cerr << _("Listing (-l) mode implies pass 2.") << endl;
-              return 1;
-            }
          server_args.push_back (string ("-") + (char)grc + optarg);
           break;
 
@@ -878,22 +871,30 @@ systemtap_session::parse_cmdline (int argc, char * const argv [])
           break;
 
         case 'L':
-          listing_mode_vars = true;
-          unoptimized = true; // This causes retention of variables for listing_mode
-          // fallthrough
+          if (dump_mode)
+            {
+              cerr << _("ERROR: only one of the -l/-L/--dump-* "
+                        "switches may be specified") << endl;
+              return 1;
+            }
+          server_args.push_back (string ("-") + (char)grc + optarg);
+          dump_mode = systemtap_session::dump_matched_probes_vars;
+          dump_matched_pattern = optarg;
+          unoptimized = true; // This causes retention of vars for listing
+          suppress_warnings = true;
+          break;
+
         case 'l':
-         suppress_warnings = true;
-          listing_mode = true;
-          last_pass = 2;
-          if (have_script)
+          if (dump_mode)
             {
-             cerr << _("Only one script can be given on the command line.")
-                  << endl;
-             return 1;
+              cerr << _("ERROR: only one of the -l/-L/--dump-* "
+                        "switches may be specified") << endl;
+              return 1;
             }
-         server_args.push_back (string ("-") + (char)grc + optarg);
-          cmdline_script = string("probe ") + string(optarg) + " {}";
-          have_script = true;
+          server_args.push_back (string ("-") + (char)grc + optarg);
+          dump_mode = systemtap_session::dump_matched_probes;
+          dump_matched_pattern = optarg;
+          suppress_warnings = true;
           break;
 
         case 'F':
@@ -1158,41 +1159,41 @@ systemtap_session::parse_cmdline (int argc, char * const argv [])
          systemtap_v_check = true;
          break;
 
-       case LONG_OPT_DUMP_PROBE_TYPES:
-         server_args.push_back ("--dump-probe-types");
-         dump_probe_types = true;
-         break;
+        case LONG_OPT_DUMP_PROBE_TYPES:
+          if (dump_mode)
+            {
+              cerr << _("ERROR: only one of the -l/-L/--dump-* "
+                        "switches may be specified") << endl;
+              return 1;
+            }
+          server_args.push_back ("--dump-probe-types");
+          dump_mode = systemtap_session::dump_probe_types;
+          break;
 
-       case LONG_OPT_DUMP_PROBE_ALIASES:
-         server_args.push_back ("--dump-probe-aliases");
-         suppress_warnings = true;
-         dump_probe_aliases = true;
-         last_pass = 1;
-         if (have_script)
-           {
-             cerr << _("Only one script can be given on the command line.")
-                  << endl;
-             return 1;
-           }
-         cmdline_script = string("probe begin {}");
-         have_script = true;
-         break;
+        case LONG_OPT_DUMP_PROBE_ALIASES:
+          if (dump_mode)
+            {
+              cerr << _("ERROR: only one of the -l/-L/--dump-* "
+                        "switches may be specified") << endl;
+              return 1;
+            }
+          server_args.push_back ("--dump-probe-aliases");
+          suppress_warnings = true;
+          dump_mode = systemtap_session::dump_probe_aliases;
+          break;
 
-       case LONG_OPT_DUMP_FUNCTIONS:
-         dump_functions = true;
-         suppress_warnings = true;
-         unoptimized = true; // so we keep never-called functions
-         last_pass = 2;
-         server_args.push_back ("--dump-functions");
-         if (have_script)
-           {
-             cerr << _("Only one script can be given on the command line.")
-                  << endl;
-             return 1;
-           }
-         cmdline_script = string("probe begin {}");
-         have_script = true;
-         break;
+        case LONG_OPT_DUMP_FUNCTIONS:
+          if (dump_mode)
+            {
+              cerr << _("ERROR: only one of the -l/-L/--dump-* "
+                        "switches may be specified") << endl;
+              return 1;
+            }
+          server_args.push_back ("--dump-functions");
+          suppress_warnings = true;
+          dump_mode = systemtap_session::dump_functions;
+          unoptimized = true; // Keep unused functions (which is all of them)
+          break;
 
        case LONG_OPT_SUPPRESS_HANDLER_ERRORS:
          suppress_handler_errors = true;
@@ -1423,8 +1424,10 @@ systemtap_session::check_options (int argc, char * const argv [])
         args.push_back (string (argv[i]));
     }
 
-  // We don't need a script with --list-servers, --trust-servers, or --dump-probe-types.
-  bool need_script = server_status_strings.empty () && server_trust_spec.empty () && ! dump_probe_types;
+  // We don't need a script with --list-servers, --trust-servers, or any dump mode
+  bool need_script = server_status_strings.empty () &&
+                     server_trust_spec.empty () &&
+                     !dump_mode;
 
   if (benchmark_sdt_loops > 0 || benchmark_sdt_threads > 0)
     {
@@ -1451,6 +1454,16 @@ systemtap_session::check_options (int argc, char * const argv [])
       cerr << _("A script must be specified.") << endl;
       usage(1);
     }
+  if (dump_mode && have_script)
+    {
+      cerr << _("Cannot specify a script with -l/-L/--dump-* switches.") << endl;
+      usage(1);
+    }
+  if (dump_mode && last_pass != 5)
+    {
+      cerr << _("Cannot specify -p with -l/-L/--dump-* switches.") << endl;
+      usage(1);
+    }
 
 #if ! HAVE_NSS
   if (client_options)
@@ -1849,7 +1862,8 @@ void
 systemtap_session::register_library_aliases()
 {
   vector<stapfile*> files(library_files);
-  files.push_back(user_file);
+  if (user_file) // May be NULL, e.g. in dump modes
+    files.push_back(user_file);
 
   for (unsigned f = 0; f < files.size(); ++f)
     {
@@ -1925,7 +1939,7 @@ void
 systemtap_session::print_error (const semantic_error& se)
 {
   // skip error message printing for listing mode with low verbosity
-  if ((this->listing_mode || this->dump_functions) && this->verbose <= 1)
+  if (this->dump_mode && this->verbose <= 1)
     {
       seen_errors[se.errsrc_chain()]++; // increment num_errors()
       return;
index a6aaa0125fa8575468856c90462be7ccecd094b3..cc8bee2f12452f6ab060bcf281a05e251fca5415 100644 (file)
--- a/session.h
+++ b/session.h
@@ -197,8 +197,6 @@ public:
   bool modname_given;
   bool keep_tmpdir;
   bool guru_mode;
-  bool listing_mode;
-  bool listing_mode_vars;
   bool bulk_mode;
   bool unoptimized;
   bool suppress_warnings;
@@ -217,9 +215,19 @@ public:
   bool privilege_set;
   bool systemtap_v_check;
   bool tmpdir_opt_set;
-  bool dump_probe_types;
-  bool dump_probe_aliases;
-  bool dump_functions;
+
+  enum
+   { dump_none,               // no dumping requested
+     dump_probe_types,        // dump standard tapset probes
+     dump_probe_aliases,      // dump tapset probe aliases
+     dump_functions,          // dump tapset functions
+     dump_matched_probes,     // dump matching probes (-l)
+     dump_matched_probes_vars // dump matching probes and their variables (-L)
+   } dump_mode;
+
+  // Pattern to match against in listing mode (-l/-L)
+  std::string dump_matched_pattern;
+
   int download_dbinfo;
   bool suppress_handler_errors;
   bool suppress_time_limits;
index fa7153718195a39f0ac8991812a8c623fd755b11..67cd1c3b9638004f4894a8c22f1ac14733856d44 100644 (file)
@@ -4729,8 +4729,9 @@ dwarf_derived_probe::dwarf_derived_probe(const string& funcname,
         }
       // Save the local variables for listing mode. If the scope_die is null,
       // local vars aren't accessible, so no need to invoke saveargs (PR10820).
-      if (!null_die(scope_die) && q.sess.listing_mode_vars)
-         saveargs(q, scope_die, dwfl_addr);
+      if (!null_die(scope_die) &&
+          q.sess.dump_mode == systemtap_session::dump_matched_probes_vars)
+        saveargs(q, scope_die, dwfl_addr);
     }
 
   // Reset the sole element of the "locations" vector as a
This page took 0.055785 seconds and 5 git commands to generate.