summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.exelib/uprobes_exe.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-06-15 13:37:39 +0200
committerMark Wielaard <mjw@redhat.com>2009-06-15 13:37:39 +0200
commit5e3d7f3a3aa8d11b67e74de0c3d9187c323cbff2 (patch)
treea481a29f183527a00f32f752818abc912699eb39 /testsuite/systemtap.exelib/uprobes_exe.c
parentf07c3b680a722e27ed55bb5c9719fa5827ebfc75 (diff)
downloadsystemtap-steved-5e3d7f3a3aa8d11b67e74de0c3d9187c323cbff2.tar.gz
systemtap-steved-5e3d7f3a3aa8d11b67e74de0c3d9187c323cbff2.tar.xz
systemtap-steved-5e3d7f3a3aa8d11b67e74de0c3d9187c323cbff2.zip
PR10274 Fix exelib -O3 testcase.
The testcase now uses noinline, an empty asm statement and a volatile variable to prevent the function getting inlined, being totally unrolled or the recursive call being replaced with an inner-iteration. This does defeat part of the testcase though, which was testing unwinding through an optimized recursive function. But it seems the best we can do. * testsuite/systemtap.exelib/exelib.exp: Add -O3 to the mix. * testsuite/systemtap.exelib/uprobes_exe.c: Use volatile bar and mark main_func noinline. * testsuite/systemtap.exelib/uprobes_lib.c: Use volatile foo and mark lib_func noinline.
Diffstat (limited to 'testsuite/systemtap.exelib/uprobes_exe.c')
-rw-r--r--testsuite/systemtap.exelib/uprobes_exe.c17
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;
}