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
----------------------------------------------------------------------------
   Attachment #8066|0                           |1
        is obsolete|                            |

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

Hey Josh,

Thanks for all the extra cases to check. Just also noticed now that there is an
issue with current_lvalue_read and functioncalls.

global a

function foo() {
   a++
   return "foo"
}

probe oneshot {
   println(foo())
}

The script above interprets the a++ in foo() as used because visit_print_format
sets current_lvalue_read to true.

The following patch fixes the above as well as all the cases mentioned so far.

Here is my testing script:

global a // if condition
global b // function arg

global arr // used in foreach
global c // foreach array slice
global d // foreach limit

global e // return value
global f // ternary cond
global g // while condition

function foo(b) {
   if (b)
      println("b")
}

function bar() {
   return ++e;
}

probe oneshot {

   if (++a)
      println("a")

   foo(++b)

   arr[1,1] = 1
   foreach ([i,j] in arr[*,++c] limit ++d) {
      println("c")
      println("d")
   }

   if (bar()) {
      println("e")
   }

   if (++f ? 1 : 0) // can only be tested without the patch for if_statement
applied
      println("f")

   while (!g++)
      println("g")
}

Without patch applied:

a
b
c
d
e
f
g
a=0x1
b=0x1
c=0x1
d=0x1
e=0x1
f=0x1
g=0x2

With patch applied:

a
b
c
d
e
f
g

(Not being printed automatically indicates that it was added to the used set).
I will doublecheck that all spots have been covered and run it through the
tester.

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

Let me try that again as a diff for bugzilla.

-- 
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]