summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.exelib/uprobes_lib.c
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-06-15 11:57:03 -0400
committerDave Brolley <brolley@redhat.com>2009-06-15 11:57:03 -0400
commit148b5d924e05124eae22a27ef670c480de76553a (patch)
tree894d71a8cc22f2c37cc1313154db9a8d1abb8b15 /testsuite/systemtap.exelib/uprobes_lib.c
parentc3a47b9b2c204849646eda60e6fff9ea7625f122 (diff)
parentd438dd9bc070216016e02f4958fe9dea571712c9 (diff)
downloadsystemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.tar.gz
systemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.tar.xz
systemtap-steved-148b5d924e05124eae22a27ef670c480de76553a.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.exelib/uprobes_lib.c')
-rw-r--r--testsuite/systemtap.exelib/uprobes_lib.c33
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);
+}