summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.exelib/uprobes_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.exelib/uprobes_lib.c')
-rw-r--r--testsuite/systemtap.exelib/uprobes_lib.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/testsuite/systemtap.exelib/uprobes_lib.c b/testsuite/systemtap.exelib/uprobes_lib.c
index 25297b6b..072a1d61 100644
--- a/testsuite/systemtap.exelib/uprobes_lib.c
+++ b/testsuite/systemtap.exelib/uprobes_lib.c
@@ -7,15 +7,24 @@
* later version.
*/
-void
+// volatile static variable to prevent folding of lib_func
+static volatile int foo;
+
+// Marked noinline and has an empty asm statement to prevent inlining
+// or optimizing away totally.
+int
+__attribute__((noinline))
lib_func (int bar)
{
- if (bar > 1)
- lib_func (bar - 1);
+ asm ("");
+ if (bar - foo > 0)
+ foo = lib_func (bar - foo);
+ return foo;
}
void
lib_main ()
{
- lib_func (3);
+ foo = 1;
+ foo = lib_func (3);
}