summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorStan Cox <scox@redhat.com>2009-12-08 11:57:00 -0500
committerStan Cox <scox@redhat.com>2009-12-08 11:57:00 -0500
commit63b4fd1474ec5859fac4c9b710c8f466bcd3b0f7 (patch)
tree2c696530833b8fbe560e29daacd0fb9b2f71fe54 /testsuite
parent851418deb65964ef73f55e2aab0f3733c0e0e2e8 (diff)
downloadsystemtap-steved-63b4fd1474ec5859fac4c9b710c8f466bcd3b0f7.tar.gz
systemtap-steved-63b4fd1474ec5859fac4c9b710c8f466bcd3b0f7.tar.xz
systemtap-steved-63b4fd1474ec5859fac4c9b710c8f466bcd3b0f7.zip
Add .library("lib").mark("mark") and use it for .mark semaphores.
tapset-utrace.cxx (TOK_LIBRARY): New. (utrace_derived_probe::utrace_derived_probe): Add library and has_library. (utrace_builder::build): Handle library. (utrace_derived_probe_group::emit_probe_decl): Add sdt_sem_offset to emitted stap_utrace_probes. Add stap_task_finder_target mmap_callback for handling shared library. Handle sdt_sem_offset in emitted_stp_utrace_probe_cb. Add stap_utrace_mmap_found. (register_tapset_utrace): Handle .library tapset-utrace.cxx (TOK_LIBRARY): New. (base_query::base_query): Add path and has_library. (dwarf_derived_probe::dwarf_derived_probe) Likewise. (dwarf_derived_probe::register_patterns): Handle .library (sdt_query::convert_location): Likewise. (dwarf_builder::build): Likewise. (uprobe_derived_probe_group::emit_module_decls): Emit sdt_sem_address. Add sdt_sem_offset to emitted stap_uprobe_spec. Add offset and vm_flags to signature of stap_uprobe_change_plus, and handle sdt_sem_offset. Allow writeable segments in emitted stap_uprobe_mmap_found. sdt_misc.exp: Test .library util.cxx (find_executable): Add env_path to sig and use it in getenv. util.h (find_executable): Likewise. Make "PATH" the default. dtrace.in (provider): Turn on semaphores. sdt.h: Likewise.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/systemtap.base/sdt_misc.exp101
1 files changed, 63 insertions, 38 deletions
diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp
index 4e6f953f..062181a5 100644
--- a/testsuite/systemtap.base/sdt_misc.exp
+++ b/testsuite/systemtap.base/sdt_misc.exp
@@ -3,20 +3,17 @@ set test "sdt_misc"
# Test miscellaneous features of .mark probes
# Compile a C program to use as the user-space probing target
-set sup_srcpath "[pwd]/static_user_markers.c"
-set sup_exepath "[pwd]/static_user_markers.x"
-set sup_sopath "[pwd]/libsdt.so"
-set supcplus_exepath "[pwd]/static_user_markers_cplus.x"
+set sup_srcpath "[pwd]/sdt_misc.c"
+set supcplus_exepath "[pwd]/sdt_misc_cplus.x"
set fp [open $sup_srcpath "w"]
puts $fp "
#include <stdlib.h>
-#define USE_STAP_PROBE 1
-#include \"static_user_markers_.h\"
+#include \"sdt_misc_.h\"
void
bar (int i)
{
- STATIC_USER_MARKERS_TEST_PROBE_2(i);
+ SDT_MISC_TEST_PROBE_2(i);
if (i == 0)
i = 1000;
STAP_PROBE1(static_uprobes,test_probe_2,i);
@@ -28,7 +25,7 @@ baz (int i, char* s)
STAP_PROBE1(static_uprobes,test_probe_0,i);
if (i == 0)
i = 1000;
- STATIC_USER_MARKERS_TEST_PROBE_3(i,s);
+ SDT_MISC_TEST_PROBE_3(i,s);
}
void
@@ -42,7 +39,7 @@ buz (int parm)
struct astruct bstruct = {parm, parm + 1};
if (parm == 0)
parm = 1000;
- DTRACE_PROBE1(static_user_markers,test_probe_4,&bstruct);
+ DTRACE_PROBE1(sdt_misc,test_probe_4,&bstruct);
}
#ifndef NO_MAIN
@@ -57,34 +54,50 @@ main ()
"
close $fp
-set sup_stppath "[pwd]/static_user_markers.stp"
+set sup_stppath "[pwd]/sdt_misc.stp"
set fp [open $sup_stppath "w"]
puts $fp "
-probe process(\"static_user_markers.x\").mark(\"test_probe_0\")
+%( \$# > 1 %?
+probe process(@1).library(@2).mark(\"test_probe_0\")
+%:
+probe process(@1).mark(\"test_probe_0\")
+%)
{
printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)
}
-probe process(\"static_user_markers.x\").mark(\"test_probe_2\")
+%( \$# > 1 %?
+probe process(@1).library(@2).mark(\"test_probe_2\")
+%:
+probe process(@1).mark(\"test_probe_2\")
+%)
{
printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)
}
-probe process(\"static_user_markers.x\").mark(\"test_probe_3\")
+%( \$# > 1 %?
+probe process(@1).library(@2).mark(\"test_probe_3\")
+%:
+probe process(@1).mark(\"test_probe_3\")
+%)
{
printf(\"In %s probe %#x %#x\\n\", \$\$name, \$arg1, \$arg2)
}
-probe process(\"static_user_markers.x\").mark(\"test_probe_4\")
+%( \$# > 1 %?
+probe process(@1).library(@2).mark(\"test_probe_4\")
+%:
+probe process(@1).mark(\"test_probe_4\")
+%)
{
printf(\"In %s dtrace probe %#x %#x\\n\", \$\$name, \$arg1->a, \$arg1->b)
}
"
close $fp
-set sup_dpath "[pwd]/static_user_markers_.d"
-set sup_hpath "[pwd]/static_user_markers_.h"
-set sup_opath "[pwd]/static_user_markers_.o"
+set sup_dpath "[pwd]/sdt_misc_.d"
+set sup_hpath "[pwd]/sdt_misc_.h"
+set sup_opath "[pwd]/sdt_misc_.o"
set fp [open $sup_dpath "w"]
puts $fp "
-provider static_user_markers {
+provider sdt_misc {
probe test_probe_0 ();
probe test_probe_2 (int i);
probe test_probe_3 (int i, char* x);
@@ -130,7 +143,7 @@ set pbtype_mssgs {{uprobe} {utrace} {kprobe}}
for {set i 0} {$i < [llength $pbtype_flags]} {incr i} {
set pbtype_flag [lindex $pbtype_flags $i]
set pbtype_mssg [lindex $pbtype_mssgs $i]
-set testprog "sdt.c.exe.$i"
+set sup_exepath "[pwd]/sdt_misc-$pbtype_mssg.x"
set sup_flags "additional_flags=-I$srcdir/../includes/sys"
set sup_flags "$sup_flags additional_flags=-I$sdtdir"
@@ -163,7 +176,7 @@ if {![utrace_p]} {
set ok 0
verbose -log "spawn stap -c $sup_exepath $sup_stppath"
-spawn stap -c $sup_exepath $sup_stppath
+spawn stap -c $sup_exepath $sup_stppath $sup_exepath
expect {
-timeout 180
-re {In test_probe_2 probe 0x2} { incr ok; exp_continue }
@@ -198,17 +211,17 @@ set ok 0
set fail "types"
verbose -log "spawn stap -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x"
spawn stap -c ./sdt_types.x $srcdir/$subdir/sdt_types.stp ./sdt_types.x
+
expect {
-timeout 180
-re {FAIL: [a-z_]+var} { regexp " .*$" $expect_out(0,string) s;
incr ok; set fail "$fail $s"; exp_continue }
- timeout { fail "$test (timeout) }
+ timeout { fail "$test (timeout)" }
eof { }
}
wait
-set pbtype_mssgs {{uprobe} {utrace} {kprobe}}
if { $ok != 0} {
if { $pbtype_mssg == "uprobe" } {
fail "$test $fail $pbtype_mssg"
@@ -222,7 +235,7 @@ if { $ok != 0} {
# Test probe in shared object
-set sup_srcmainpath "[pwd]/static_user_markers_.c"
+set sup_srcmainpath "[pwd]/sdt_misc_.c"
set fp [open $sup_srcmainpath "w"]
puts $fp "
int
@@ -238,9 +251,11 @@ close $fp
set sup_flags "$sup_flags additional_flags=-shared"
set sup_flags "$sup_flags additional_flags=-fPIC"
set sup_flags "$sup_flags additional_flags=-DNO_MAIN"
+set sup_sopath "[pwd]/libsdt-$pbtype_mssg.so"
+set sup_exepath "[pwd]/sdt_misc-$pbtype_mssg-shared.x"
set res0 [target_compile $sup_srcpath $sup_sopath executable $sup_flags ]
set sup0_flags "additional_flags=-g additional_flags=-Wl,-rpath,[pwd]"
-set sup0_flags "$sup0_flags additional_flags=-L[pwd] additional_flags=-lsdt"
+set sup0_flags "$sup0_flags additional_flags=-L[pwd] additional_flags=-lsdt-$pbtype_mssg"
set res [target_compile $sup_srcmainpath $sup_exepath executable $sup0_flags ]
if { $res0 != "" || $res != "" } {
verbose "target_compile failed: $res0 $res" 2
@@ -254,21 +269,28 @@ if { $res0 != "" || $res != "" } {
}
set ok 0
-# verbose -log "stap -c $sup_exepath -e probe process(\"$sup_sopath\").mark(\"test_probe_2\") {printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)}"
-# spawn stap -c $sup_exepath -e "probe process(\"$sup_sopath\").mark(\"test_probe_2\") {printf(\"In %s probe %#x\\n\", \$\$name, \$arg1)}"
-# expect {
-# -timeout 180
-# -re {In test_probe_2 probe 0x2} { incr ok; exp_continue }
-# timeout { fail "$test (timeout)" }
-# eof { }
-# }
-# wait
-
-if {$ok == 2} {
+verbose -log "spawn stap -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath"
+if { $pbtype_mssg != "kprobe" } {
+ spawn stap -c $sup_exepath $sup_stppath $sup_exepath $sup_sopath
+} else {
+ spawn stap -c $sup_exepath $sup_stppath $sup_sopath
+}
+expect {
+ -timeout 180
+ -re {In test_probe_2 probe 0x2} { incr ok; exp_continue }
+ -re {In test_probe_0 probe 0x3} { incr ok; exp_continue }
+ -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue }
+ -re {In test_probe_4 dtrace probe 0x4 0x5} { incr ok; exp_continue }
+ timeout { fail "$test (timeout)" }
+ eof { }
+}
+
+wait
+
+if {$ok == 5} {
pass "$test shared $pbtype_mssg"
} else {
-# fail "$test shared ($ok) $pbtype_mssg"
- xfail "$test shared ($ok) $pbtype_mssg"
+ fail "$test ($ok) shared $pbtype_mssg"
}
# Test .mark probe wildcard matching
@@ -288,9 +310,12 @@ if { $ok == 45 } {
fail "$test wildcard ($ok) $pbtype_mssg"
}
+if { $verbose == 0 } {
+ catch {exec rm -f libsdt-$pbtype_mssg.so sdt_misc-$pbtype_mssg.x sdt_misc-$pbtype_mssg-shared.x }
+}
# for {set i 0}
}
if { $verbose == 0 } {
-catch {exec rm -f $sup_srcpath $sup_exepath $sup_sopath $supcplus_exepath $sup_dpath $sup_hpath $sup_opath $sup_stppath $sdt_types.x $sup_srcmainpath}
+ catch {exec rm -f sdt_misc_.c sdt_misc.c sdt_misc_.d sdt_misc_.h sdt_misc_.o sdt_misc.stp sdt_types.x}
}