public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: systemtap@sourceware.org
Cc: mjw@redhat.com, naveen.n.rao@linux.vnet.ibm.com,
	ulrich.weigand@de.ibm.com,        uweigand@gcc.gnu.org,
	anton@samba.org, fche@redhat.com,
	       Hemant Kumar <hemant@linux.vnet.ibm.com>
Subject: [RFC PATCH 2/3] Test dwarfless probes on multiple static functions
Date: Mon, 20 Apr 2015 10:30:00 -0000	[thread overview]
Message-ID: <1429525764-23471-2-git-send-email-hemant@linux.vnet.ibm.com> (raw)
In-Reply-To: <1429525764-23471-1-git-send-email-hemant@linux.vnet.ibm.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

  reply	other threads:[~2015-04-20 10:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 10:30 [PATCH v4 1/3] systemtap/tapsets.cxx: Fix " Hemant Kumar
2015-04-20 10:30 ` Hemant Kumar [this message]
2015-04-20 11:18   ` [RFC PATCH 2/3] Test " Hemant Kumar
2015-04-22 21:21   ` Mark Wielaard
2015-04-20 10:31 ` [PATCH v4 3/3] Fix: Priotirize symbol table lookup for ppc64le Hemant Kumar
2015-04-22 13:48   ` Mark Wielaard
2015-04-22 14:30     ` Hemant Kumar
2015-04-22 13:40 ` [PATCH v4 1/3] systemtap/tapsets.cxx: Fix dwarfless probes on multiple static functions Mark Wielaard
2015-04-22 14:36   ` Hemant Kumar
2015-04-23 14:22     ` Mark Wielaard
2015-04-24 19:33       ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429525764-23471-2-git-send-email-hemant@linux.vnet.ibm.com \
    --to=hemant@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=fche@redhat.com \
    --cc=mjw@redhat.com \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=systemtap@sourceware.org \
    --cc=ulrich.weigand@de.ibm.com \
    --cc=uweigand@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).