public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/11360] New: Bad interaction between -L and @defined
@ 2010-03-09  2:17 jistone at redhat dot com
  2010-03-09  2:34 ` [Bug translator/11360] " jistone at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: jistone at redhat dot com @ 2010-03-09  2:17 UTC (permalink / raw)
  To: systemtap

$ stap -l syscall.poll
syscall.poll

$ stap -L syscall.poll
semantic error: unable to find local 'timeout' near pc 0xffffffff8112ccab in
sys_poll(fs/select.c) (alternatives: ufds nfds timeout_msecs end_time to ret):
identifier '$timeout' at /usr/local/share/systemtap/tapset/syscalls2.stp:353:57
        source: 	timeout = (@defined($timeout_msecs) ? $timeout_msecs : $timeout)
                	                                                       ^
semantic error: unable to find local 'timeout' near pc 0xffffffff8112ccab in
sys_poll(fs/select.c) (alternatives: ufds nfds timeout_msecs end_time to ret):
identifier '$timeout' at :355:48
        source: 		(@defined($timeout_msecs) ? $timeout_msecs : $timeout))
                		                                             ^
semantic error: probe_1906 with unresolved type: identifier 'timeout' at :353:2
        source: 	timeout = (@defined($timeout_msecs) ? $timeout_msecs : $timeout)
                	^
semantic error: probe_1906 with unresolved type: identifier 'argstr' at :354:2
        source: 	argstr = sprintf("%p, %d, %d", $ufds, $nfds,
                	^
syscall.poll name:string ufds_uaddr:long nfds:long timeout:unknown
argstr:unknown $ufds:struct pollfd* $nfds:unsigned int $timeout_msecs:long int
[1]

(The [1] is my shell prompt reporting the non-zero exit code)

The problem stems from the option parser:

  case 'L':
    s.listing_mode_vars = true;
    s.unoptimized = true; // This causes retention of variables for listing_mode

Without optimization, expressions like the ternary "@defined(x)?x:y" won't strip
out whichever of x or y is invalid, and the type-resolution phase takes notice.

-- 
           Summary: Bad interaction between -L and @defined
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: jistone at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11360

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug translator/11360] Bad interaction between -L and @defined
  2010-03-09  2:17 [Bug translator/11360] New: Bad interaction between -L and @defined jistone at redhat dot com
@ 2010-03-09  2:34 ` jistone at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: jistone at redhat dot com @ 2010-03-09  2:34 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jistone at redhat dot com  2010-03-09 02:34 -------
I think it may work to re-enable optimization, but skip the
dead_assignment_remover for listing_mode_vars.  Here is the short patch, but I'm
still testing to see if any vars disappear accidentally with other optimizations.

diff --git a/elaborate.cxx b/elaborate.cxx
index 59110c7..f918264 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -2293,6 +2293,9 @@ dead_assignment_remover::visit_try_block (try_block *s)
 // removed as a side-effect-free statement expression.  Wahoo!
 void semantic_pass_opt3 (systemtap_session& s, bool& relaxed_p)
 {
+  if (s.listing_mode_vars)
+    return;
+
   // Recompute the varuse data, which will probably match the opt2
   // copy of the computation, except for those totally unused
   // variables that opt2 removed.
diff --git a/main.cxx b/main.cxx
index 9cc0370..a00aeb8 100644
--- a/main.cxx
+++ b/main.cxx
@@ -868,9 +868,8 @@ main (int argc, char * const argv [])
           break;
 
         case 'L':
-          s.listing_mode_vars = true;
-          s.unoptimized = true; // This causes retention of variables for
listing_mode
-
+          s.listing_mode_vars = true; // This causes retention of variables for
display
+          // Fall through to pick up -l's behavior too...
         case 'l':
          s.suppress_warnings = true;
           s.listing_mode = true;


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|systemtap at sources dot    |jistone at redhat dot com
                   |redhat dot com              |
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=11360

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-09  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-09  2:17 [Bug translator/11360] New: Bad interaction between -L and @defined jistone at redhat dot com
2010-03-09  2:34 ` [Bug translator/11360] " jistone at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).