diff options
Diffstat (limited to 'testsuite/systemtap.exelib/uprobes_exe.c')
-rw-r--r-- | testsuite/systemtap.exelib/uprobes_exe.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/testsuite/systemtap.exelib/uprobes_exe.c b/testsuite/systemtap.exelib/uprobes_exe.c index b4811335..d2905637 100644 --- a/testsuite/systemtap.exelib/uprobes_exe.c +++ b/testsuite/systemtap.exelib/uprobes_exe.c @@ -12,18 +12,27 @@ // function from our library int lib_main (void); -void +// volatile static variable to prevent folding of main_func +static volatile int bar; + +// Marked noinline and has an empty asm statement to prevent inlining +// or optimizing away totally. +int +__attribute__((noinline)) main_func (int foo) { - if (foo > 1) - main_func (foo - 1); + asm (""); + if (foo - bar > 0) + bar = main_func (foo - bar); else lib_main(); + return bar; } int main (int argc, char *argv[], char *envp[]) { - main_func (3); + bar = 1; + bar = main_func (3); return 0; } |