[Bug dyninst/21223] Function return probe is not executed in dyninst mode

jackdev at mailbox dot org sourceware-bugzilla@sourceware.org
Tue Mar 7 10:46:00 GMT 2017


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.


More information about the Systemtap mailing list