diff options
author | David Smith <dsmith@redhat.com> | 2009-06-16 12:22:32 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-06-16 12:22:32 -0500 |
commit | bdbb4549b459294ed9bddb819e5602fb894313f7 (patch) | |
tree | 9d242348f8e2776c0d4841d0586d3b9b8d34ef7c /testsuite/systemtap.exelib/uprobes_lib.c | |
parent | d05b7a1c363c30c7fcd9d163f457c1ed80d28f19 (diff) | |
parent | 96b190d404d24eb7349adae6e2d57eb5c9f6c26a (diff) | |
download | systemtap-steved-bdbb4549b459294ed9bddb819e5602fb894313f7.tar.gz systemtap-steved-bdbb4549b459294ed9bddb819e5602fb894313f7.tar.xz systemtap-steved-bdbb4549b459294ed9bddb819e5602fb894313f7.zip |
Merge commit 'origin/master' into pr7043
Conflicts:
runtime/transport/transport.c
Diffstat (limited to 'testsuite/systemtap.exelib/uprobes_lib.c')
-rw-r--r-- | testsuite/systemtap.exelib/uprobes_lib.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/systemtap.exelib/uprobes_lib.c b/testsuite/systemtap.exelib/uprobes_lib.c new file mode 100644 index 00000000..e3416d17 --- /dev/null +++ b/testsuite/systemtap.exelib/uprobes_lib.c @@ -0,0 +1,33 @@ +/* uprobes_lib test case - library helper + * Copyright (C) 2009, Red Hat Inc. + * + * This file is part of systemtap, and is free software. You can + * redistribute it and/or modify it under the terms of the GNU General + * Public License (GPL); either version 2, or (at your option) any + * later version. + */ + +#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */ + +// 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) +{ + asm (""); + STAP_PROBE1(test, func_count, bar); + if (bar - foo > 0) + foo = lib_func (bar - foo); + return foo; +} + +void +lib_main () +{ + foo = 1; + foo = lib_func (3); +} |