]> sourceware.org Git - systemtap.git/commitdiff
Test dwarfless probes on multiple static functions
authorHemant Kumar <hemant@linux.vnet.ibm.com>
Mon, 20 Apr 2015 10:29:23 +0000 (15:59 +0530)
committerMark Wielaard <mjw@redhat.com>
Wed, 22 Apr 2015 13:38:14 +0000 (15:38 +0200)
This patch checks how many symbols were resolved instead of probing on
them which won't require us to go till pass 5. It runs the .stp script
till pass 2. This test can be run with:
make check RUNTESTFLAGS=multisym.exp

Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
testsuite/systemtap.base/multisym.exp [new file with mode: 0755]
testsuite/systemtap.base/multisym.stp [new file with mode: 0644]
testsuite/systemtap.base/multisym_baz.c [new file with mode: 0644]
testsuite/systemtap.base/multisym_main.c [new file with mode: 0644]

diff --git a/testsuite/systemtap.base/multisym.exp b/testsuite/systemtap.base/multisym.exp
new file mode 100755 (executable)
index 0000000..b8c96ce
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/expect
+
+set test "multisym"
+set testpath "$srcdir/$subdir"
+set script "$testpath/multisym.stp"
+
+# Test that two functions with the same name in the symbol table are
+# both found even when no DWARF information is available
+# As the resolution of the probes occur during pass 2, we don't need to go
+# all the way to pass 5
+# We need the number of resolutions during pass 2.
+
+set cmd [concat stap {-p 2 } $script]
+
+set res [target_compile ${testpath}/${test}_baz.c ${test}_baz.o object ""]
+if { $res != "" } {
+    verbose "target_compile failed: $res" 2
+    fail "unable to compile ${test}_baz.c"
+}
+
+set res [target_compile ${testpath}/${test}_main.c ${test}_main.o object ""]
+if { $res != "" } {
+    verbose "target_compile failed: $res" 2
+    fail "unable to compile ${test}_main.c"
+}
+
+set res [target_compile "${test}_baz.o ${test}_main.o" ${test} executable ""]
+if { $res != "" } {
+    verbose "target_compile failed: $res" 2
+    fail "unable to compile ${test}"
+}
+
+eval spawn $cmd
+set results 0
+expect {
+    -re {process\([a-z\/\"]+\)*} { incr results 1; exp_continue}
+}
+set res [wait -i $spawn_id]
+catch close
+set res [lindex $res 3]
+
+if {$res == 0 && $results == 4} {
+       pass "$test succeeded"
+    } else {
+       fail "$test failed"
+    }
diff --git a/testsuite/systemtap.base/multisym.stp b/testsuite/systemtap.base/multisym.stp
new file mode 100644 (file)
index 0000000..be30a15
--- /dev/null
@@ -0,0 +1 @@
+probe process("./multisym").function("foo") { printf ("hit") }
\ No newline at end of file
diff --git a/testsuite/systemtap.base/multisym_baz.c b/testsuite/systemtap.base/multisym_baz.c
new file mode 100644 (file)
index 0000000..297514a
--- /dev/null
@@ -0,0 +1,11 @@
+static int
+foo (int v)
+{
+       return v + 1;
+}
+
+int
+bar (int i)
+{
+       return foo (i - 1);
+}
diff --git a/testsuite/systemtap.base/multisym_main.c b/testsuite/systemtap.base/multisym_main.c
new file mode 100644 (file)
index 0000000..e857385
--- /dev/null
@@ -0,0 +1,10 @@
+int foo (int v)
+{
+       return bar (v - 1);
+}
+
+int
+main (int argc, char **argv)
+{
+       return foo (argc);
+}
This page took 0.031369 seconds and 5 git commands to generate.