From 5c89f39e497a98f90f939c9fe3673082e7c22718 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Tue, 5 Jan 2016 04:42:58 -0600 Subject: [PATCH 2/3] Test dwarfless probes on multiple static functions 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 --- 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.1