This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC PATCH 2/3] Test dwarfless probes on multiple static functions
- From: Hemant Kumar <hemant at linux dot vnet dot ibm dot com>
- To: systemtap at sourceware dot org
- Cc: mjw at redhat dot com, naveen dot n dot rao at linux dot vnet dot ibm dot com, ulrich dot weigand at de dot ibm dot com, uweigand at gcc dot gnu dot org, anton at samba dot org, fche at redhat dot com, Hemant Kumar <hemant at linux dot vnet dot ibm dot com>
- Date: Mon, 20 Apr 2015 15:59:23 +0530
- Subject: [RFC PATCH 2/3] Test dwarfless probes on multiple static functions
- Authentication-results: sourceware.org; auth=none
- References: <1429525764-23471-1-git-send-email-hemant at linux dot vnet dot ibm dot com>
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 | 46 ++++++++++++++++++++++++++++++++
testsuite/systemtap.base/multisym.stp | 1 +
testsuite/systemtap.base/multisym_baz.c | 11 ++++++++
testsuite/systemtap.base/multisym_main.c | 10 +++++++
4 files changed, 68 insertions(+)
create mode 100755 testsuite/systemtap.base/multisym.exp
create mode 100644 testsuite/systemtap.base/multisym.stp
create mode 100644 testsuite/systemtap.base/multisym_baz.c
create mode 100644 testsuite/systemtap.base/multisym_main.c
diff --git a/testsuite/systemtap.base/multisym.exp b/testsuite/systemtap.base/multisym.exp
new file mode 100755
index 0000000..b8c96ce
--- /dev/null
+++ b/testsuite/systemtap.base/multisym.exp
@@ -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
index 0000000..be30a15
--- /dev/null
+++ b/testsuite/systemtap.base/multisym.stp
@@ -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
index 0000000..297514a
--- /dev/null
+++ b/testsuite/systemtap.base/multisym_baz.c
@@ -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
index 0000000..e857385
--- /dev/null
+++ b/testsuite/systemtap.base/multisym_main.c
@@ -0,0 +1,10 @@
+int foo (int v)
+{
+ return bar (v - 1);
+}
+
+int
+main (int argc, char **argv)
+{
+ return foo (argc);
+}
--
1.9.3