diff options
author | Stan Cox <scox@redhat.com> | 2009-06-15 12:16:17 -0400 |
---|---|---|
committer | Stan Cox <scox@redhat.com> | 2009-06-15 12:16:17 -0400 |
commit | 5111fc3e27f24347f61db6465da934a19b553ee6 (patch) | |
tree | efae54dced35c9ebddcc5b7f34bff2cc21e37d10 /testsuite | |
parent | d438dd9bc070216016e02f4958fe9dea571712c9 (diff) | |
download | systemtap-steved-5111fc3e27f24347f61db6465da934a19b553ee6.tar.gz systemtap-steved-5111fc3e27f24347f61db6465da934a19b553ee6.tar.xz systemtap-steved-5111fc3e27f24347f61db6465da934a19b553ee6.zip |
Add experimental utrace/kprobe sdt support
* sdt.h (EXPERIMENTAL_UTRACE_SDT, EXPERIMENTAL_KPROBE_SDT): New probe
point macros.
* dtrace: Add support for creating type debug info, currently invoked
with --types.
* tapsets.cxx (probe_table::convert_probe): New.
(probe_table::convert_location): New.
(dwarf_builder::build): Use it to simplify probe point handling.
* sdt.exp (pbtype_flags, pbtype_mssgs): New to also test kprobe and utrace.
* static_uprobes.exp (pbtype_flags, pbtype_mssgs): New to also test kprobe and utrace.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/systemtap.base/sdt.exp | 37 | ||||
-rw-r--r-- | testsuite/systemtap.base/sdt_types.stp | 4 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 99 |
3 files changed, 95 insertions, 45 deletions
diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index d24093e0..ea025391 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -12,6 +12,14 @@ set ::result_string {1 set extra_flags {{""} {additional_flags=-std=gnu89} {additional_flags=-ansi} {additional_flags=-pedantic} {additional_flags=-ansi additional_flags=-pedantic} {additional_flags=-O2} {additional_flags="-O3"}} +set pbtype_flags {{""} {additional_flags=-DEXPERIMENTAL_UTRACE_SDT} {additional_flags=-DEXPERIMENTAL_KPROBE_SDT}} +set pbtype_mssgs {{uprobe} {utrace} {kprobe}} + +# Iterate pbtype_flags +for {set p 0} {$p < [llength $pbtype_flags]} {incr p} { +set pbtype_flag [lindex $pbtype_flags $p] +set pbtype_mssg [lindex $pbtype_mssgs $p] + # Iterate extra_flags, trying each with C and C++ for {set i 0} {$i < [llength $extra_flags]} {incr i} { set extra_flag [lindex $extra_flags $i] @@ -22,24 +30,24 @@ set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-I$srcdir/../includes/sys" set test_flags "$test_flags additional_flags=-Wall" set test_flags "$test_flags additional_flags=-Wextra" -set test_flags "$test_flags additional_flags=-Werror" +set test_flags "$test_flags additional_flags=-Werror $pbtype_flag" set saveidx 0 set res [target_compile $srcdir/$subdir/$test.c $testprog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c $extra_flag" - untested "$test $extra_flag" + fail "compiling $test.c $extra_flag $pbtype_mssg" + untested "$test $extra_flag $pbtype_mssg" continue } else { - pass "compiling $test.c $extra_flag" + pass "compiling $test.c $extra_flag $pbtype_mssg" } if {[installtest_p] && [utrace_p]} { - stap_run3 "$test $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog + stap_run3 "$test $extra_flag $pbtype_mssg" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { - untested "$test $extra_flag" + untested "$test $extra_flag $pbtype_mssg" } catch {exec rm -f $testprog} @@ -50,22 +58,27 @@ set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-I$srcdir/../includes/sys" set test_flags "$test_flags additional_flags=-Wall" set test_flags "$test_flags additional_flags=-Werror" -set test_flags "$test_flags additional_flags=-x additional_flags=c++" +set test_flags "$test_flags additional_flags=-x additional_flags=c++ $pbtype_flag" set res [target_compile $srcdir/$subdir/$test.c $testprog executable "$test_flags $extra_flag"] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling $test.c c++ $extra_flag" - untested "$test $extra_flag" + fail "compiling $test.c c++ $extra_flag $pbtype_mssg" + untested "$test $extra_flag $pbtype_mssg" continue } else { - pass "compiling $test.c c++ $extra_flag" + pass "compiling $test.c c++ $extra_flag $pbtype_mssg" } if {[installtest_p] && [utrace_p]} { - stap_run3 "$test c++ $extra_flag" $srcdir/$subdir/$test.stp $testprog -c ./$testprog + stap_run3 "$test c++ $extra_flag $pbtype_mssg" $srcdir/$subdir/$test.stp $testprog -c ./$testprog } else { - untested "$test c++ $extra_flag" + untested "$test c++ $extra_flag $pbtype_mssg $pbtype_mssg" } catch {exec rm -f $testprog} + +# for {set i 0} {$i < [llength $extra_flags]} +} + +# for {set i 0} {$i < [llength $pbtype_flags]} } diff --git a/testsuite/systemtap.base/sdt_types.stp b/testsuite/systemtap.base/sdt_types.stp index 654b0d18..5f9ebcab 100644 --- a/testsuite/systemtap.base/sdt_types.stp +++ b/testsuite/systemtap.base/sdt_types.stp @@ -68,9 +68,9 @@ probe process(@1).mark("short_int_var") probe process(@1).mark("const_short_int_var") { - if ($arg1 != -32767) + if ($arg1 != -32767) printf("FAIL: const_short_int_var\n") - else + else printf("PASS: const_short_int_var\n") } diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index 1e53d5d3..41dc3ec0 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,21 +1,21 @@ -set test "static_uprobes" +set test "static_user_markers" # Test miscellaneous features of .mark probes # Compile a C program to use as the user-space probing target -set sup_srcpath "[pwd]/static_uprobes.c" -set sup_exepath "[pwd]/static_uprobes.x" -set supcplus_exepath "[pwd]/static_uprobes_cplus.x" +set sup_srcpath "[pwd]/static_user_markers.c" +set sup_exepath "[pwd]/static_user_markers.x" +set supcplus_exepath "[pwd]/static_user_markers_cplus.x" set fp [open $sup_srcpath "w"] puts $fp " #include <stdlib.h> #define USE_STAP_PROBE 1 -#include \"static_uprobes.h\" +#include \"static_user_markers_.h\" void bar (int i) { - STATIC_UPROBES_TEST_PROBE_2(i); + STATIC_USER_MARKERS_TEST_PROBE_2(i); if (i == 0) i = 1000; STAP_PROBE1(static_uprobes,test_probe_2,i); @@ -27,7 +27,7 @@ baz (int i, char* s) STAP_PROBE1(static_uprobes,test_probe_0,i); if (i == 0) i = 1000; - STATIC_UPROBES_TEST_PROBE_3(i,s); + STATIC_USER_MARKERS_TEST_PROBE_3(i,s); } void @@ -35,7 +35,7 @@ buz (int parm) { if (parm == 0) parm = 1000; - DTRACE_PROBE1(static_uprobes,test_probe_4,parm); + DTRACE_PROBE1(static_user_markers,test_probe_4,parm); } int @@ -48,33 +48,33 @@ main () " close $fp -set sup_stppath "[pwd]/static_uprobes.stp" +set sup_stppath "[pwd]/static_user_markers.stp" set fp [open $sup_stppath "w"] puts $fp " -probe process(\"static_uprobes.x\").mark(\"test_probe_0\") +probe process(\"static_user_markers.x\").mark(\"test_probe_0\") { printf(\"In test_probe_0 probe %#x\\n\", \$arg1) } -probe process(\"static_uprobes.x\").mark(\"test_probe_2\") +probe process(\"static_user_markers.x\").mark(\"test_probe_2\") { printf(\"In test_probe_2 probe %#x\\n\", \$arg1) } -probe process(\"static_uprobes.x\").mark(\"test_probe_3\") +probe process(\"static_user_markers.x\").mark(\"test_probe_3\") { printf(\"In test_probe_3 probe %#x %#x\\n\", \$arg1, \$arg2) } -probe process(\"static_uprobes.x\").mark(\"test_probe_4\") +probe process(\"static_user_markers.x\").mark(\"test_probe_4\") { printf(\"In test_probe_4 dtrace probe %#x\\n\", \$arg1) } " close $fp -set sup_dpath "[pwd]/static_uprobes.d" -set sup_hpath "[pwd]/static_uprobes.h" +set sup_dpath "[pwd]/static_user_markers_.d" +set sup_hpath "[pwd]/static_user_markers_.h" set fp [open $sup_dpath "w"] puts $fp " -provider static_uprobes { +provider static_user_markers { probe test_probe_1 (); probe test_probe_2 (int i); probe test_probe_3 (int i, char* x); @@ -97,7 +97,9 @@ if {[file exists $sup_hpath]} then { pass "$test dtrace" } else { fail "$test dtrace" + if { $verbose == 0 } { catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + } return } @@ -107,25 +109,38 @@ if {[installtest_p]} { set sdtdir $srcdir/../includes } +set pbtype_flags {{""} {additional_flags=-DEXPERIMENTAL_UTRACE_SDT} {additional_flags=-DEXPERIMENTAL_KPROBE_SDT}} +set pbtype_mssgs {{uprobe} {utrace} {kprobe}} + +# Iterate pbtype_flags +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_flags "additional_flags=-I$srcdir/../includes/sys" set sup_flags "$sup_flags additional_flags=-I$sdtdir" set sup_flags "$sup_flags additional_flags=-g" set sup_flags "$sup_flags additional_flags=-O" -set sup_flags "$sup_flags additional_flags=-I." +set sup_flags "$sup_flags additional_flags=-I. $pbtype_flag" set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "$test compiling C -g" + fail "$test compiling -g $pbtype_mssg" + if { $verbose == 0 } { catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + } return } else { - pass "$test compiling C -g" + pass "$test compiling -g $pbtype_mssg" } if {![installtest_p]} {untested $test; return} if {![utrace_p]} { untested "$test" + if { $verbose == 0 } { catch {exec rm -f $sup_srcpath} + } return } @@ -141,24 +156,33 @@ expect { -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} { incr ok; exp_continue } - timeout { fail "$test C (timeout)" } + timeout { fail "$test (timeout)" } eof { } } wait -if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" } +if {$ok == 5} { + pass "$test $pbtype_mssg" +} else { + if { $pbtype_mssg == "uprobe" } { + fail "$test ($ok) $pbtype_mssg" + } else { + # probe fires multiple times + xfail "$test ($ok) $pbtype_mssg" + } +} # Test passing various C types to .mark probes -set sup_flags "$sup_flags additional_flags=-O0" +set sup_flags "$sup_flags additional_flags=-O0 $pbtype_flag" set res [target_compile $srcdir/$subdir/sdt_types.c sdt_types.x executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "$test compiling types -g" + fail "$test compiling types -g $pbtype_mssg" return } else { - pass "$test compiling types -g" + pass "$test compiling types -g $pbtype_mssg" } set ok 0 @@ -169,16 +193,22 @@ 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 C (timeout)" } + timeout { fail "$test (timeout) } eof { } } wait -if { $ok != 0 } { - fail "$test $fail" +set pbtype_mssgs {{uprobe} {utrace} {kprobe}} +if { $ok != 0} { + if { $pbtype_mssg == "uprobe" } { + fail "$test $fail $pbtype_mssg" + } else { + # (needs cast) + xfail "$test $fail $pbtype_mssg" + } } else { - pass "$test types" + pass "$test types $pbtype_mssg" } # Test .mark probe wildcard matching @@ -188,14 +218,21 @@ spawn stap -l "process(\"./sdt_types.x\").mark(\"*\")" expect { -timeout 180 -re {mark\(\"[a-z_]+\"\)} { incr ok; exp_continue } - timeout { fail "$test C (timeout)" } + timeout { fail "$test (timeout)" } eof { } } if { $ok == 45 } { - pass "$test wildcard" + pass "$test wildcard $pbtype_mssg" } else { - fail "$test wildcard ($ok)" + if { $pbtype_mssg == "uprobe" } { + fail "$test wildcard ($ok) $pbtype_mssg" + } else { + xfail "$test wildcard ($ok) $pbtype_mssg" + } +} + +# for {set i 0} } if { $verbose == 0 } { |