public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/24327] New: @defined unable to handle $$parms and $$vars meta variables
@ 2019-03-12 20:16 wcohen at redhat dot com
  2019-03-13 18:16 ` [Bug translator/24327] " wcohen at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: wcohen at redhat dot com @ 2019-03-12 20:16 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 24327
           Summary: @defined unable to handle $$parms and $$vars meta
                    variables
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

When trying to get varwatch.stp example functioning again found that systemtap
failed to do the translation due to a problem with @defined.  Reduced the issue
down to the following reproducers using the meta variable $$parms and $$vars:

[wcohen@apm-mustang-b0-03 general]$ sudo stap -v -e 'probe
kernel.statement("do_sys_open@fs/open.c:*") {if (@defined($$vars))
{printf("have %s at %s \n", $$vars, pp()); exit()}}' 
Pass 1: parsed user script and 464 library scripts using
136888virt/117528res/8076shr/109268data kb, in 850usr/50sys/916real ms.
parse error: expected identifier or statistical operation
        saw: operator '-' at <input>:2:30
     source: foreach (__val = [__idx0] in -)
                                          ^
        in synthesized code from: identifier '$$vars' at <input>:1:65
     source: probe kernel.statement("do_sys_open@fs/open.c:*") {if
(@defined($$vars)) {printf("have %s at %s \n", $$vars, pp()); exit()}}
                                                                             ^

Segmentation fault
[wcohen@apm-mustang-b0-03 general]$ sudo stap -v -e 'probe
kernel.statement("do_sys_open@fs/open.c:*") {if (@defined($$parms))
{printf("have %s at %s \n", $$parms, pp()); exit()}}' 
Pass 1: parsed user script and 464 library scripts using
136888virt/117608res/8152shr/109268data kb, in 840usr/80sys/920real ms.
parse error: expected identifier or statistical operation
        saw: operator '-' at <input>:2:30
     source: foreach (__val = [__idx0] in -)
                                          ^
        in synthesized code from: identifier '$$parms' at <input>:1:65
     source: probe kernel.statement("do_sys_open@fs/open.c:*") {if
(@defined($$parms)) {printf("have %s at %s \n", $$parms, pp()); exit()}}
                                                                             ^

Segmentation fault


However, the $$return works fine:

[wcohen@apm-mustang-b0-03 general]$  sudo stap -v -e 'probe
kernel.function("do_sys_open").* {if (@defined($$return)) {printf("have %s at
%s \n", $$return, pp()); exit()}}' 
Pass 1: parsed user script and 464 library scripts using
136888virt/117508res/8056shr/109268data kb, in 800usr/130sys/928real ms.
WARNING: side-effect-free probe: keyword at <input>:1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
WARNING: side-effect-free probe: keyword at :1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
WARNING: side-effect-free probe: keyword at :1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
WARNING: side-effect-free probe: keyword at :1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
WARNING: side-effect-free probe: keyword at :1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
WARNING: side-effect-free probe: keyword at :1:1
 source: probe kernel.function("do_sys_open").* {if (@defined($$return))
{printf("have %s at %s \n", $$return, pp()); exit()}}
         ^
Pass 2: analyzed script: 13 probes, 4 functions, 1 embed, 0 globals using
219196virt/201100res/9452shr/191576data kb, in 2910usr/320sys/3238real ms.
Pass 3: translated to C into
"/tmp/stapmIShMf/stap_23a1216541622de325b5f556a74b2da3_5187_src.c" using
219196virt/201228res/9580shr/191576data kb, in 60usr/220sys/279real ms.
Pass 4: compiled C into "stap_23a1216541622de325b5f556a74b2da3_5187.ko" in
10070usr/730sys/10724real ms.
Pass 5: starting run.
have return=0x3 at kernel.function("do_sys_open@fs/open.c:1048").return 
Pass 5: run completed in 30usr/50sys/4931real ms.

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

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

* [Bug translator/24327] @defined unable to handle $$parms and $$vars meta variables
  2019-03-12 20:16 [Bug translator/24327] New: @defined unable to handle $$parms and $$vars meta variables wcohen at redhat dot com
@ 2019-03-13 18:16 ` wcohen at redhat dot com
  2019-03-13 18:26 ` wcohen at redhat dot com
  2019-03-13 21:06 ` wcohen at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wcohen at redhat dot com @ 2019-03-13 18:16 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
Looking around the systemtap code to see where the following problem code is
generated:

     source: foreach (__val = [__idx0] in -)

It is coming from add_global_var_display in elaborate.cxx:

          // Iterate over all indexes in the array, sorted by decreasing value
          code << "foreach (";
          if (l->type != pe_stats)
            {
              foreach_value = "__val";
              code << foreach_value << " = ";
            }
          code << "[" << indexes << "] in " << l->unmangled_name << "-)" <<
endl;

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

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

* [Bug translator/24327] @defined unable to handle $$parms and $$vars meta variables
  2019-03-12 20:16 [Bug translator/24327] New: @defined unable to handle $$parms and $$vars meta variables wcohen at redhat dot com
  2019-03-13 18:16 ` [Bug translator/24327] " wcohen at redhat dot com
@ 2019-03-13 18:26 ` wcohen at redhat dot com
  2019-03-13 21:06 ` wcohen at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wcohen at redhat dot com @ 2019-03-13 18:26 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from William Cohen <wcohen at redhat dot com> ---
This code is related to the automatic printing of global variables.  It can be
turned off and allows the reproducer to compile and run:

[wcohen@cervelo systemtap]$ stap  -e 'probe
kernel.statement("do_sys_open@fs/open.c:*") {if (@defined($$parms)) printf("%s
\n", $$parms); exit()}'
parse error: expected identifier or statistical operation
        saw: operator '-' at <input>:2:30
     source: foreach (__val = [__idx0] in -)
                                          ^
        in synthesized code from: identifier '$$parms' at <input>:1:65
     source: probe kernel.statement("do_sys_open@fs/open.c:*") {if
(@defined($$parms)) printf("%s \n", $$parms); exit()}
                                                                             ^

Segmentation fault (core dumped)
[wcohen@cervelo systemtap]$ stap  --no-global-var-display -e 'probe
kernel.statement("do_sys_open@fs/open.c:*") {if (@defined($$parms)) printf("%s
\n", $$parms); exit()}'
dfd=0xffffffffffffff9c filename=0x7fe33bffe6e0 flags=0x8000 mode=0x0

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

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

* [Bug translator/24327] @defined unable to handle $$parms and $$vars meta variables
  2019-03-12 20:16 [Bug translator/24327] New: @defined unable to handle $$parms and $$vars meta variables wcohen at redhat dot com
  2019-03-13 18:16 ` [Bug translator/24327] " wcohen at redhat dot com
  2019-03-13 18:26 ` wcohen at redhat dot com
@ 2019-03-13 21:06 ` wcohen at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wcohen at redhat dot com @ 2019-03-13 21:06 UTC (permalink / raw)
  To: systemtap

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

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
The following patch checked into upstream systemtap fixes the problem.

commit 76517421a569be2d7cd90302f15b63d5cfb0bc75 (HEAD -> master, origin/master,
origin/HEAD)
Author: Jafeer Uddin <juddin@redhat.com>
Date:   Wed Mar 13 16:12:45 2019 -0400

    PR24327: Remove printing of unused synthetic globals

    The handling of DW_OP_GNU_entry_value introduces synthetic
    global variables that after optimizations may end up not
    being used. The default behaviour is to print out the values
    of unsued globals in user scripts. This printing is intended
    for user defined globals and shouldn't occur with the generated
    globals.


The reproducer works fine now:

$ ../install/bin/stap  -e 'probe kernel.statement("do_sys_open@fs/open.c:*")
{if (@defined($$parms)) printf("%s \n", $$parms); exit()}'
dfd=0xffffffffffffff9c filename=0x7ffd2e4c4590 flags=0x98800 mode=0x0

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

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

end of thread, other threads:[~2019-03-13 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 20:16 [Bug translator/24327] New: @defined unable to handle $$parms and $$vars meta variables wcohen at redhat dot com
2019-03-13 18:16 ` [Bug translator/24327] " wcohen at redhat dot com
2019-03-13 18:26 ` wcohen at redhat dot com
2019-03-13 21:06 ` wcohen 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).