Bug 7035 - -L mode should not suppress all errors
Summary: -L mode should not suppress all errors
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-17 14:25 UTC by Frank Ch. Eigler
Modified: 2008-11-27 15:53 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2008-11-17 14:25:14 UTC
This is wrong:

% stap -r /sdfijsdfoidf -L 'kernel.function("*")'
% echo $?
0

This is more like it, though the "pass 2..." line is probably unhelpful.

% stap -r /sdfijsdfoidf -e  'probe kernel.function("*") {}'
semantic error: libdwfl failure (missing kernel /sdfijsdfoidf x86_64 debuginfo):
No such file or directory while resolving probe point kernel.function("*")
semantic error: no probes found
Pass 2: analysis failed.  Try again with more '-v' (verbose) options.
% echo $?
1
Comment 1 Wenji Huang 2008-11-18 05:53:44 UTC
Current listing_mode (-l or -L) blocks all the errors. We can make -L out of
this restriction. 

stap -r /sdfijsdfoidf -l 'kernel.function("*")' will still return 0.
stap -r /sdfijsdfoidf -L 'kernel.function("*")' will print error and return 1.
stap -r /sdfijsdfoidf -ul 'kernel.function("*")' will print error and return 1.
stap -L 'kernel.function("abcdef")' will print error and return 1.

diff --git a/elaborate.cxx b/elaborate.cxx
index 7cbac31..def4846 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1446,8 +1446,8 @@ systemtap_session::print_error (const semantic_error& e)
   string message_str[2];
   string align_semantic_error ("        ");
 
-  // NB: we don't print error messages during listing mode.
-  if (listing_mode) return;
+  // NB: we don't print error messages during listing mode -l but during -L.
+  if (listing_mode && !unoptimized) return;
 
   // We generate two messages.  The second one ([1]) is printed
   // without token compression, for purposes of duplicate elimination.
Comment 2 Frank Ch. Eigler 2008-11-18 17:16:57 UTC
Error printing should probably work the same way with -l and -L.
Comment 3 Wenji Huang 2008-11-19 05:31:18 UTC
Seems the return value depended on number_errors affected by print_error.So, all
the error will be printed and correct value can be returned.

diff --git a/elaborate.cxx b/elaborate.cxx
index 7cbac31..def4846 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1446,8 +1446,8 @@ systemtap_session::print_error (const semantic_error& e)
   string message_str[2];
   string align_semantic_error ("        ");
 
-  // NB: we don't print error messages during listing mode.
-  if (listing_mode) return;
 
   // We generate two messages.  The second one ([1]) is printed
   // without token compression, for purposes of duplicate elimination.
Comment 4 Wenji Huang 2008-11-25 02:06:50 UTC
Update the patch to block "Pass x:" message.   Now
$ stap -rafda -l 'kernel.function("*")'
semantic error: libdwfl failure (missing kernel afda i686 debuginfo): No such
file or directory while resolving probe point kernel.function("*")

$ stap -L 'kernel.function("abcde")'
semantic error: no match while resolving probe point kernel.function("abcde")

Patch:
diff --git a/elaborate.cxx b/elaborate.cxx
index 7cbac31..0dd8062 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -1446,9 +1446,6 @@ systemtap_session::print_error (const semantic_error& e)
   string message_str[2];
   string align_semantic_error ("        ");
 
-  // NB: we don't print error messages during listing mode.
-  if (listing_mode) return;
-
   // We generate two messages.  The second one ([1]) is printed
   // without token compression, for purposes of duplicate elimination.
   // This way, the same message that may be generated once with a
diff --git a/main.cxx b/main.cxx
index 406228a..40dbeec 100644
--- a/main.cxx
+++ b/main.cxx
@@ -937,7 +937,7 @@ main (int argc, char * const argv [])
            << endl;
     }
 
-  if (rc)
+  if (rc && !s.listing_mode)
     cerr << "Pass 1: parse failed.  "
          << "Try again with more '-v' (verbose) options."
          << endl;
@@ -965,7 +965,7 @@ main (int argc, char * const argv [])
                       << TIMESPRINT
                       << endl;
 
-  if (rc)
+  if (rc && !s.listing_mode)
     cerr << "Pass 2: analysis failed.  "
          << "Try again with more '-v' (verbose) options."
          << endl;
Comment 5 Frank Ch. Eigler 2008-11-27 15:53:07 UTC
commit 708ce1f, thanks!