summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/systemtap.exelib/exelib.exp3
-rw-r--r--testsuite/systemtap.exelib/uprobes_exe.c17
-rw-r--r--testsuite/systemtap.exelib/uprobes_lib.c17
3 files changed, 27 insertions, 10 deletions
diff --git a/testsuite/systemtap.exelib/exelib.exp b/testsuite/systemtap.exelib/exelib.exp
index 01ff1241..3d8710a3 100644
--- a/testsuite/systemtap.exelib/exelib.exp
+++ b/testsuite/systemtap.exelib/exelib.exp
@@ -44,8 +44,7 @@ foreach arch $arches {
# Just try -O0 and -O3.
# Adding -O, -O2, -Os and mixing lib/exe is a bit overdone
- # BUG! -O2, -O3, -Os all break uname tests...
- foreach opt {-O0} {
+ foreach opt {-O0 -O3} {
foreach libprelink {no} { # BUG! "yes" breaks uname tests
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;
}
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);
}