This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/17749] stap doesn't recognize "++" as a use


https://sourceware.org/bugzilla/show_bug.cgi?id=17749

Jonathan Lebon <jlebon at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jlebon at redhat dot com

--- Comment #2 from Jonathan Lebon <jlebon at redhat dot com> ---
Created attachment 8066
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8066&action=edit
Possible patch

It seems like the issue is that the varuse_collecting_visitor treats the
following two as equivalent:

  a++ ...
  if (a++) ...

I.e. when 'a++' is visited, it doesn't matter whether it's part of an if
statement or not. In both cases, the 'a' referent is simply added to the 'read'
and 'write' sets but NOT to the 'used' set, causing it to get printed. (The
'used' set contains the vars that are read while not in a rmw context -- this
distinction is necessary because a rmw operation is both a read and a write, so
the rule for global var printing can't just be "all vars written to but never
read" otherwise expr_statements like 'a++' would not trigger auto printing).

Note BTW that this is also an issue with for/while loop conditionals.

The following patch provides a potential fix for this issue. It overrides the
if/for visit methods so that their conditionals are visited as if they were
lvalues (and thus cause the symbols to be added to the 'used' set). This
technique is already used for visit_print_format() and visit_delete_statement()
(see also commit d20a83f8).

I have yet to do a full test run with the patch above, but at the very least
global_end.exp passes. Also thinking about how to clean up this part of the
code to be more explicit.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]