summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-06-15 17:16:14 +0200
committerMark Wielaard <mjw@redhat.com>2009-06-15 17:20:06 +0200
commitcba30aa93a8836cd9f88b494c17bc991c997d5f2 (patch)
treec46c444c486c16fa79b968e851a1705c7b3a6162
parent5e3d7f3a3aa8d11b67e74de0c3d9187c323cbff2 (diff)
downloadsystemtap-steved-cba30aa93a8836cd9f88b494c17bc991c997d5f2.tar.gz
systemtap-steved-cba30aa93a8836cd9f88b494c17bc991c997d5f2.tar.xz
systemtap-steved-cba30aa93a8836cd9f88b494c17bc991c997d5f2.zip
Add (disabled) testcase for stap probe marks to exelib.
* testsuite/systemtap.exelib/exelib.exp: Compile against sdt.h. * testsuite/systemtap.exelib/uprobes_exe.c: Add main_count probe mark. * testsuite/systemtap.exelib/uprobes_lib.c: Add func_count probe mark. * testsuite/systemtap.exelib/mark.tcl: New test. * testsuite/systemtap.exelib/mark.stp: New test tapset.
-rw-r--r--testsuite/systemtap.exelib/exelib.exp6
-rw-r--r--testsuite/systemtap.exelib/mark.stp10
-rw-r--r--testsuite/systemtap.exelib/mark.tcl11
-rw-r--r--testsuite/systemtap.exelib/uprobes_exe.c3
-rw-r--r--testsuite/systemtap.exelib/uprobes_lib.c3
5 files changed, 30 insertions, 3 deletions
diff --git a/testsuite/systemtap.exelib/exelib.exp b/testsuite/systemtap.exelib/exelib.exp
index 3d8710a3..0a4ee8b0 100644
--- a/testsuite/systemtap.exelib/exelib.exp
+++ b/testsuite/systemtap.exelib/exelib.exp
@@ -3,7 +3,7 @@
# Then runs tests with a list of execs.
set subtestlist {lib uname ustack cleanup}
-#set subtestlist {uname}
+#set subtestlist {mark} # Currently disabled, fails sep-debug case.
proc seperate_debuginfo {elffile} {
set objcopy [list "objcopy" "--only-keep-debug"]
@@ -64,8 +64,10 @@ foreach arch $arches {
}
# General compiler flags
+ # We want the sdt.h from the source dir.
+ set testflags "additional_flags=-I$srcdir/../includes/sys"
# For now we always require debuginfo
- set testflags "additional_flags=-g"
+ set testflags "$testflags additional_flags=-g"
if {$arch != "default"} {
set testflags "$testflags additional_flags=$arch"
}
diff --git a/testsuite/systemtap.exelib/mark.stp b/testsuite/systemtap.exelib/mark.stp
new file mode 100644
index 00000000..6b354dff
--- /dev/null
+++ b/testsuite/systemtap.exelib/mark.stp
@@ -0,0 +1,10 @@
+// Markers probes in executable and shared library plus argument.
+// Arguments: @1 uprobes_exe, @2 libuprobes_lib.so
+
+probe process(@1).mark("main_count") {
+ printf("main_count: %d\n", $arg1);
+}
+
+probe process(@2).mark("func_count") {
+ printf("func_count: %d\n", $arg1);
+}
diff --git a/testsuite/systemtap.exelib/mark.tcl b/testsuite/systemtap.exelib/mark.tcl
new file mode 100644
index 00000000..1f21aabc
--- /dev/null
+++ b/testsuite/systemtap.exelib/mark.tcl
@@ -0,0 +1,11 @@
+set ::result_string {main_count: 3
+main_count: 2
+main_count: 1
+func_count: 3
+func_count: 2
+func_count: 1}
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "lib-$testname"; return }
+if {! [utrace_p]} { untested "lib-$testname"; return }
+stap_run3 mark-$testname $srcdir/$subdir/mark.stp $testexe $testlib -c $testexe
diff --git a/testsuite/systemtap.exelib/uprobes_exe.c b/testsuite/systemtap.exelib/uprobes_exe.c
index d2905637..da65efa7 100644
--- a/testsuite/systemtap.exelib/uprobes_exe.c
+++ b/testsuite/systemtap.exelib/uprobes_exe.c
@@ -7,7 +7,7 @@
* later version.
*/
-#include <unistd.h>
+#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */
// function from our library
int lib_main (void);
@@ -22,6 +22,7 @@ __attribute__((noinline))
main_func (int foo)
{
asm ("");
+ STAP_PROBE1(test, main_count, foo);
if (foo - bar > 0)
bar = main_func (foo - bar);
else
diff --git a/testsuite/systemtap.exelib/uprobes_lib.c b/testsuite/systemtap.exelib/uprobes_lib.c
index 072a1d61..e3416d17 100644
--- a/testsuite/systemtap.exelib/uprobes_lib.c
+++ b/testsuite/systemtap.exelib/uprobes_lib.c
@@ -7,6 +7,8 @@
* 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;
@@ -17,6 +19,7 @@ __attribute__((noinline))
lib_func (int bar)
{
asm ("");
+ STAP_PROBE1(test, func_count, bar);
if (bar - foo > 0)
foo = lib_func (bar - foo);
return foo;