public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode
@ 2017-03-06 16:31 jackdev at mailbox dot org
  2017-03-06 16:32 ` [Bug dyninst/21223] " jackdev at mailbox dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-06 16:31 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 21223
           Summary: Function return probe is not executed in dyninst mode
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dyninst
          Assignee: systemtap at sourceware dot org
          Reporter: jackdev at mailbox dot org
  Target Milestone: ---

Created attachment 9873
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9873&action=edit
extensive stap log

Hi,

I am currently having a weird issue with systemtap and dyninst.
I'm using systemtap 3.1 and dyninst 9.3.0 (both built from sources) along with
gcc 4.9.4

The return probe process.function("factor").return is not getting in my
application. However, it is correctly executed in a minimal working example.
I have not been able to figure out where the difference comes from.

My stap script (runtime_dyninst.stp): https://paste.debian.net/hidden/859190a9/
> #!/usr/bin/stap
> 
> probe process.function("factor") {
>    printf("Entered function factor\n")
> }
> 
> probe process.function("factor").return {
>     printf("Left function factor")
> }

Minimal Working Example (min.c): https://paste.debian.net/hidden/beaf61d0/

My program (simple.c): https://paste.debian.net/hidden/07281df0/

Both programs were compiled with: 'gcc -g -O0 -lm'

Minimal working example (min.c):
> $ stap --dyninst -c './min 123' runtime_dyninst.stp
> Entered function factor
> Left function factor
> $

My application (simple.c):
> $ stap --dyninst -c './simple 123' runtime_dyninst.stp
> Entered function factor
> $

More extensive logs are attached. I'm happy to provide more information if
needed.

Greetings
Jack

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
@ 2017-03-06 16:32 ` jackdev at mailbox dot org
  2017-03-07  8:14 ` jackdev at mailbox dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-06 16:32 UTC (permalink / raw)
  To: systemtap

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

Jack <jackdev at mailbox dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackdev at mailbox dot org

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
  2017-03-06 16:32 ` [Bug dyninst/21223] " jackdev at mailbox dot org
@ 2017-03-07  8:14 ` jackdev at mailbox dot org
  2017-03-07  9:08 ` jackdev at mailbox dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-07  8:14 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from Jack <jackdev at mailbox dot org> ---
Just as an additional comment:
I just put "__attribute__((noinline))" in front of the functions to
_definitely_ prevent gcc from inlining the functions, but still my return probe
is not working.

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
  2017-03-06 16:32 ` [Bug dyninst/21223] " jackdev at mailbox dot org
  2017-03-07  8:14 ` jackdev at mailbox dot org
@ 2017-03-07  9:08 ` jackdev at mailbox dot org
  2017-03-07  9:11 ` jackdev at mailbox dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-07  9:08 UTC (permalink / raw)
  To: systemtap

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

--- Comment #2 from Jack <jackdev at mailbox dot org> ---
So I just noticed that my program (simple.c) is not even fully executing (or at
least it seems like it?) Could it be that SystemTap is somehow killing it?

This is the output I'm currently getting (without the text in brackets):
> $ stap --dyninst -c './simple 123' runtime_dyninst.stp
> [systemtap] Entered function factor
> [systemtap] Left function factor
> [simple] 123 = 41 * 3

Running the program on its own produces:
> ./simple 123
> 123 = 41 * 3

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
                   ` (2 preceding siblings ...)
  2017-03-07  9:08 ` jackdev at mailbox dot org
@ 2017-03-07  9:11 ` jackdev at mailbox dot org
  2017-03-07 10:46 ` jackdev at mailbox dot org
  2017-03-30 18:29 ` scox at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-07  9:11 UTC (permalink / raw)
  To: systemtap

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

--- Comment #3 from Jack <jackdev at mailbox dot org> ---
+++ Forget my previous comment, here is the corrected version. Sorry! +++

So I just noticed that my program (simple.c) is not even fully executing (or at
least it seems like it?) Could it be that SystemTap is somehow killing it?

This is the output I'm currently getting (without the text in brackets):
> $ stap --dyninst -c './simple 123' runtime_dyninst.stp
> [systemtap] Entered function factor
(final printf of simple is missing)

When it should produce something like this:
> $ stap --dyninst -c './simple 123' runtime_dyninst.stp
> [systemtap] Entered function factor
> [systemtap] Left function factor
> [simple] 123 = 41 * 3

Running the program on its own produces:
> ./simple 123
> 123 = 41 * 3

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
                   ` (3 preceding siblings ...)
  2017-03-07  9:11 ` jackdev at mailbox dot org
@ 2017-03-07 10:46 ` jackdev at mailbox dot org
  2017-03-30 18:29 ` scox at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jackdev at mailbox dot org @ 2017-03-07 10:46 UTC (permalink / raw)
  To: systemtap

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

--- Comment #4 from Jack <jackdev at mailbox dot org> ---
I think there is some kind of memory corruption going on. I was able to narrow
down the problem to a very simple c program.

Stap script:
> #!/usr/bin/stap
> probe process.function("factor") {
>     printf("[systemtap] Entered function factor\n")
> }
> probe process.function("factor").return {
>     printf("[systemtap] Left function factor\n")
> }

C program (mwe.c):
> #include <stdio.h>
> 
> long double a, b;
> 
> void factor() {
>   a = 0;
>   b = a - 1;
>   return;
> }
> 
> int main() {
>   printf("[mwe] Pre function factor\n");
>   factor();
>   printf("[mwe] Post function factor\n");
>   return 0;
> }

Compile:
> $ gcc -O0 -o mwe mwe.c
> $

Run executable:
> $ ./mwe
> [mwe] Pre function factor
> [mwe] Post function factor
> $

Run systemtap
> $ stap --dyninst -c ./mwe runtime_dyninst.stp
> [mwe] Pre function factor
> [systemtap] Entered function factor
> $
(log: https://paste.debian.net/hidden/290051a6/ )

Notice how not even the second output of the binary gets printed!
However, switching just the data type for a,b from "long double" to int, float,
double, long, ... (line 3) lets the program fully execute:
> $ stap --dyninst -c ./mwe runtime_dyninst.stp
> [mwe] Pre function factor
> [mwe] Post function factor
> [systemtap] Entered function factor
> [systemtap] Left function factor
> $
(log: https://paste.debian.net/hidden/27410939/ )

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

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

* [Bug dyninst/21223] Function return probe is not executed in dyninst mode
  2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
                   ` (4 preceding siblings ...)
  2017-03-07 10:46 ` jackdev at mailbox dot org
@ 2017-03-30 18:29 ` scox at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: scox at redhat dot com @ 2017-03-30 18:29 UTC (permalink / raw)
  To: systemtap

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

Stan Cox <scox at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scox at redhat dot com
           Assignee|systemtap at sourceware dot org    |scox at redhat dot com

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

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

end of thread, other threads:[~2017-03-30 18:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 16:31 [Bug dyninst/21223] New: Function return probe is not executed in dyninst mode jackdev at mailbox dot org
2017-03-06 16:32 ` [Bug dyninst/21223] " jackdev at mailbox dot org
2017-03-07  8:14 ` jackdev at mailbox dot org
2017-03-07  9:08 ` jackdev at mailbox dot org
2017-03-07  9:11 ` jackdev at mailbox dot org
2017-03-07 10:46 ` jackdev at mailbox dot org
2017-03-30 18:29 ` scox 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).