summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r--testsuite/systemtap.base/sdt_types.c168
-rw-r--r--testsuite/systemtap.base/sdt_types.stp371
-rw-r--r--testsuite/systemtap.base/static_uprobes.exp77
-rw-r--r--testsuite/systemtap.base/tracepoints.exp23
-rw-r--r--testsuite/systemtap.base/uprobes_exe.c27
-rw-r--r--testsuite/systemtap.base/uprobes_lib.c20
-rw-r--r--testsuite/systemtap.base/uprobes_lib.exp38
-rw-r--r--testsuite/systemtap.base/uprobes_lib.stp9
-rw-r--r--testsuite/systemtap.base/x86_gs.exp12
-rw-r--r--testsuite/systemtap.base/x86_gs.stp10
10 files changed, 728 insertions, 27 deletions
diff --git a/testsuite/systemtap.base/sdt_types.c b/testsuite/systemtap.base/sdt_types.c
new file mode 100644
index 00000000..2e04ec7e
--- /dev/null
+++ b/testsuite/systemtap.base/sdt_types.c
@@ -0,0 +1,168 @@
+#include "sdt.h" /* Really <sys/sdt.h>, but pick current source version. */
+#include <stdint.h>
+#include <values.h>
+
+int
+main (int argc, char **argv)
+{
+ char char_var = '~';
+ STAP_PROBE1(provider,char_var,char_var);
+ const char const_char_var = '!';
+ STAP_PROBE1(provider,const_char_var,const_char_var);
+ volatile char volatile_char_var = '!';
+ STAP_PROBE1(provider,volatile_char_var,volatile_char_var);
+ char *ptr_char_var = &char_var;
+ STAP_PROBE2(provider,ptr_char_var,ptr_char_var,&char_var);
+ const char *ptr_const_char_var = &char_var;
+ STAP_PROBE2(provider,ptr_const_char_var,ptr_const_char_var,&char_var);
+ char * const char_ptr_const_var = &char_var;
+ STAP_PROBE2(provider,char_ptr_const_var,char_ptr_const_var,&char_var);
+ volatile char *ptr_volatile_char_var = &char_var;
+ STAP_PROBE2(provider,ptr_volatile_char_var,ptr_volatile_char_var,&char_var);
+ char * volatile char_ptr_volatile_var = &char_var;
+ STAP_PROBE2(provider,char_ptr_volatile_var,char_ptr_volatile_var,&char_var);
+ short int short_int_var = 32767;
+ STAP_PROBE1(provider,short_int_var,short_int_var);
+ const short int const_short_int_var = -32767;
+ STAP_PROBE1(provider,const_short_int_var,const_short_int_var);
+ volatile short int volatile_short_int_var = -32767;
+ STAP_PROBE1(provider,volatile_short_int_var,volatile_short_int_var);
+ short int *ptr_short_int_var = &short_int_var;
+ STAP_PROBE2(provider,ptr_short_int_var,ptr_short_int_var,&short_int_var);
+ const short int *ptr_const_short_int_var = &short_int_var;
+ STAP_PROBE2(provider,ptr_const_short_int_var,ptr_const_short_int_var,&short_int_var);
+ short int * const short_int_ptr_const_var = &short_int_var;
+ STAP_PROBE2(provider,short_int_ptr_const_var,short_int_ptr_const_var,&short_int_var);
+ volatile short int *ptr_volatile_short_int_var = &short_int_var;
+ STAP_PROBE2(provider,ptr_volatile_short_int_var,ptr_volatile_short_int_var,&short_int_var);
+ short int * volatile short_int_ptr_volatile_var = &short_int_var;
+ STAP_PROBE2(provider,short_int_ptr_volatile_var,short_int_ptr_volatile_var,&short_int_var);
+ int int_var = 65536;
+ STAP_PROBE1(provider,int_var,int_var);
+ const int const_int_var = -65536;
+ STAP_PROBE1(provider,const_int_var,const_int_var);
+ volatile int volatile_int_var = -65536;
+ STAP_PROBE1(provider,volatile_int_var,volatile_int_var);
+ int *ptr_int_var = &int_var;
+ STAP_PROBE2(provider,ptr_int_var,ptr_int_var,&int_var);
+ const int *ptr_const_int_var = &int_var;
+ STAP_PROBE2(provider,ptr_const_int_var,ptr_const_int_var,&int_var);
+ int * const int_ptr_const_var = &int_var;
+ STAP_PROBE2(provider,int_ptr_const_var,int_ptr_const_var,&int_var);
+ volatile int *ptr_volatile_int_var = &int_var;
+ STAP_PROBE2(provider,ptr_volatile_int_var,ptr_volatile_int_var,&int_var);
+ int * volatile int_ptr_volatile_var = &int_var;
+ STAP_PROBE2(provider,int_ptr_volatile_var,int_ptr_volatile_var,&int_var);
+ long int long_int_var = 65536;
+ STAP_PROBE1(provider,long_int_var,long_int_var);
+ const long int const_long_int_var = -65536;
+ STAP_PROBE1(provider,const_long_int_var,const_long_int_var);
+ volatile long int volatile_long_int_var = -65536;
+ STAP_PROBE1(provider,volatile_long_int_var,volatile_long_int_var);
+ long int *ptr_long_int_var = &long_int_var;
+ STAP_PROBE2(provider,ptr_long_int_var,ptr_long_int_var,&long_int_var);
+ const long int *ptr_const_long_int_var = &long_int_var;
+ STAP_PROBE2(provider,ptr_const_long_int_var,ptr_const_long_int_var,&long_int_var);
+ long int * const long_int_ptr_const_var = &long_int_var;
+ STAP_PROBE2(provider,long_int_ptr_const_var,long_int_ptr_const_var,&long_int_var);
+ volatile long int *ptr_volatile_long_int_var = &long_int_var;
+ STAP_PROBE2(provider,ptr_volatile_long_int_var,ptr_volatile_long_int_var,&long_int_var);
+ long int * volatile long_int_ptr_volatile_var = &long_int_var;
+ STAP_PROBE2(provider,long_int_ptr_volatile_var,long_int_ptr_volatile_var,&long_int_var);
+ long long int long_long_int_var = 65536;
+ STAP_PROBE1(provider,long_long_int_var,long_long_int_var);
+ const long long int const_long_long_int_var = -65536;
+ STAP_PROBE1(provider,const_long_long_int_var,const_long_long_int_var);
+ volatile long long int volatile_long_long_int_var = -65536;
+ STAP_PROBE1(provider,volatile_long_long_int_var,volatile_long_long_int_var);
+ long long int *ptr_long_long_int_var = &long_long_int_var;
+ STAP_PROBE2(provider,ptr_long_long_int_var,ptr_long_long_int_var,&long_long_int_var);
+ const long long int *ptr_const_long_long_int_var = &long_long_int_var;
+ STAP_PROBE2(provider,ptr_const_long_long_int_var,ptr_const_long_long_int_var,&long_long_int_var);
+ long long int * const long_long_int_ptr_const_var = &long_long_int_var;
+ STAP_PROBE2(provider,long_long_int_ptr_const_var,long_long_int_ptr_const_var,&long_long_int_var);
+ volatile long long int *ptr_volatile_long_long_int_var = &long_long_int_var;
+ STAP_PROBE2(provider,ptr_volatile_long_long_int_var,ptr_volatile_long_long_int_var,&long_long_int_var);
+ long long int * volatile long_long_int_ptr_volatile_var = &long_long_int_var;
+ STAP_PROBE2(provider,long_long_int_ptr_volatile_var,long_long_int_ptr_volatile_var,&long_long_int_var);
+
+ char arr_char [2] = "!~";
+ STAP_PROBE1(provider,arr_char,&arr_char);
+ struct {
+ int int_var;
+ } arr_struct [2] = {{
+ .int_var=1,
+ },{
+ .int_var=2,
+ }};
+ STAP_PROBE1(provider,arr_struct,&arr_struct);
+ struct {
+ unsigned int bit1_0:1;
+ unsigned int bit1_1:1;
+ char char_2;
+ unsigned int bit1_6:1;
+ unsigned int bit1_7:1;
+ char char_8;
+ unsigned int bit1_9:1;
+ unsigned int bit1_10:1;
+ } bitfields_small_var = {
+ .bit1_0=1,
+ .bit1_1=0,
+ .char_2='a',
+ .bit1_6=1,
+ .bit1_7=0,
+ .char_8='z',
+ .bit1_9=1,
+ .bit1_10=0,
+ };
+ STAP_PROBE8(provider,bitfields_small_var,
+ (int)bitfields_small_var.bit1_0,
+ (int)bitfields_small_var.bit1_1,
+ bitfields_small_var.char_2,
+ (int)bitfields_small_var.bit1_6,
+ (int)bitfields_small_var.bit1_7,
+ bitfields_small_var.char_8,
+ (int)bitfields_small_var.bit1_9,
+ (int)bitfields_small_var.bit1_10);
+ struct {
+ unsigned char char_0;
+ int bit1_4:1;
+ unsigned int bit1_5:1;
+ int bit2_6:2;
+ unsigned int bit2_8:2;
+ int bit3_10:3;
+ unsigned int bit3_13:3;
+ int bit9_16:9;
+ unsigned int bit9_25:9;
+ char char_34;
+ } bitfields_bit_var = {
+ .char_0='A',
+ .bit1_4=-1,
+ .bit1_5=1,
+ .bit2_6=1,
+ .bit2_8=3,
+ .bit3_10=3,
+ .bit3_13=7,
+ .bit9_16=255,
+ .bit9_25=511,
+ .char_34='Z',
+ };
+ STAP_PROBE10(provider,bitfields_bit_var,bitfields_bit_var.char_0,
+ (int)bitfields_bit_var.bit1_4,
+ (int)bitfields_bit_var.bit1_5,
+ (int)bitfields_bit_var.bit2_6,
+ (int)bitfields_bit_var.bit2_8,
+ (int)bitfields_bit_var.bit3_10,
+ (int)bitfields_bit_var.bit3_13,
+ (int)bitfields_bit_var.bit9_16,
+ (int)bitfields_bit_var.bit9_25,
+ bitfields_bit_var.char_34);
+ enum {
+ red = 0,
+ green = 1,
+ blue = 2
+ } primary_colors_var = green;
+ STAP_PROBE1(provider,primary_colors_var,primary_colors_var);
+ return 0;
+}
+
diff --git a/testsuite/systemtap.base/sdt_types.stp b/testsuite/systemtap.base/sdt_types.stp
new file mode 100644
index 00000000..654b0d18
--- /dev/null
+++ b/testsuite/systemtap.base/sdt_types.stp
@@ -0,0 +1,371 @@
+probe process(@1).mark("char_var") {
+ if ($arg1 != 126)
+ printf("FAIL: char_var\n")
+ else
+ printf("PASS: char_var\n")
+}
+
+probe process(@1).mark("const_char_var") {
+ if ($arg1 != 33)
+ printf("FAIL: const_char_var\n")
+ else
+ printf("PASS: const_char_var\n")
+}
+
+probe process(@1).mark("volatile_char_var") {
+ if ($arg1 != 33)
+ printf("FAIL: volatile_char_var\n")
+ else
+ printf("PASS: volatile_char_var\n")
+}
+
+probe process(@1).mark("ptr_char_var") {
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_char_var\n")
+ else
+ printf("PASS: ptr_char_var\n")
+}
+
+probe process(@1).mark("ptr_const_char_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_char_var\n")
+ else
+ printf("PASS: ptr_const_char_var\n")
+}
+
+probe process(@1).mark("char_ptr_const_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: char_ptr_const_var\n")
+ else
+ printf("PASS: char_ptr_const_var\n")
+}
+
+probe process(@1).mark("ptr_volatile_char_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_volatile_char_var\n")
+ else
+ printf("PASS: ptr_volatile_char_var\n")
+}
+
+probe process(@1).mark("char_ptr_volatile_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: char_ptr_volatile_var\n")
+ else
+ printf("PASS: char_ptr_volatile_var\n")
+}
+
+probe process(@1).mark("short_int_var")
+{
+ if ($arg1 != 32767)
+ printf("FAIL: short_int_var\n")
+ else
+ printf("PASS: short_int_var\n")
+}
+
+probe process(@1).mark("const_short_int_var")
+{
+ if ($arg1 != -32767)
+ printf("FAIL: const_short_int_var\n")
+ else
+ printf("PASS: const_short_int_var\n")
+}
+
+probe process(@1).mark("volatile_short_int_var")
+{
+ if ($arg1 != -32767)
+ printf("FAIL: volatile_short_int_var\n")
+ else
+ printf("PASS: volatile_short_int_var\n")
+}
+
+probe process(@1).mark("ptr_short_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_short_int_var\n")
+ else
+ printf("PASS: ptr_short_int_var\n")
+}
+
+probe process(@1).mark("ptr_const_short_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_short_int_var\n")
+ else
+ printf("PASS: ptr_const_short_int_var\n")
+}
+
+probe process(@1).mark("short_int_ptr_const_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: short_int_ptr_const_var\n")
+ else
+ printf("PASS: short_int_ptr_const_var\n")
+}
+
+probe process(@1).mark("ptr_volatile_short_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_volatile_short_int_var\n")
+ else
+ printf("PASS: ptr_volatile_short_int_var\n")
+}
+
+probe process(@1).mark("short_int_ptr_volatile_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: short_int_ptr_volatile_var\n")
+ else
+ printf("PASS: short_int_ptr_volatile_var\n")
+}
+
+probe process(@1).mark("int_var")
+{
+ if ($arg1 != 65536)
+ printf("FAIL: int_var")
+ else
+ printf("PASS: int_var")
+}
+
+probe process(@1).mark("const_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: const_int_var\n")
+ else
+ printf("PASS: const_int_var\n")
+}
+
+probe process(@1).mark("volatile_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: volatile_int_var\n")
+ else
+ printf("PASS: volatile_int_var\n")
+}
+
+probe process(@1).mark("ptr_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_int_var\n")
+ else
+ printf("PASS: ptr_const_int_var\n")
+}
+
+probe process(@1).mark("ptr_const_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_int_var\n")
+ else
+ printf("PASS: ptr_const_int_var\n")
+}
+
+probe process(@1).mark("int_ptr_const_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: int_ptr_const_var\n")
+ else
+ printf("PASS: int_ptr_const_var\n")
+}
+
+probe process(@1).mark("ptr_volatile_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_volatile_int_var\n")
+ else
+ printf("PASS: ptr_volatile_int_var\n")
+}
+
+probe process(@1).mark("int_ptr_volatile_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: int_ptr_volatile_var\n")
+ else
+ printf("PASS: int_ptr_volatile_var\n")
+}
+
+probe process(@1).mark("long_int_var")
+{
+ if ($arg1 != 65536)
+ printf("FAIL: long_int_var\n")
+ else
+ printf("PASS: long_int_var\n")
+}
+
+probe process(@1).mark("const_long_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: const_long_int_var\n")
+ else
+ printf("PASS: const_long_int_var\n")
+}
+
+probe process(@1).mark("volatile_long_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: volatile_long_int_var\n")
+ else
+ printf("PASS: volatile_long_int_var\n")
+}
+
+probe process(@1).mark("ptr_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_long_int_var\n")
+ else
+ printf("PASS: ptr_long_int_var\n")
+}
+
+probe process(@1).mark("ptr_const_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_long_int_var\n")
+ else
+ printf("PASS: ptr_const_long_int_var\n")
+}
+
+probe process(@1).mark("long_int_ptr_const_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: long_int_ptr_const_var\n")
+ else
+ printf("PASS: long_int_ptr_const_var\n")
+}
+
+probe process(@1).mark("ptr_volatile_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_volatile_long_int_var\n")
+ else
+ printf("PASS: ptr_volatile_long_int_var\n")
+}
+
+probe process(@1).mark("long_int_ptr_volatile_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: long_int_ptr_volatile_var\n")
+ else
+ printf("PASS: long_int_ptr_volatile_var\n")
+}
+
+probe process(@1).mark("long_long_int_var")
+{
+ if ($arg1 != 65536)
+ printf("FAIL: long_long_int_var\n")
+ else
+ printf("PASS: long_long_int_var\n")
+}
+
+probe process(@1).mark("const_long_long_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: const_long_long_int_var\n")
+ else
+ printf("PASS: const_long_long_int_var\n")
+}
+
+probe process(@1).mark("volatile_long_long_int_var")
+{
+ if ($arg1 != -65536)
+ printf("FAIL: volatile_long_long_int_var\n")
+ else
+ printf("PASS: volatile_long_long_int_var\n")
+}
+
+probe process(@1).mark("ptr_long_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_long_long_int_var\n")
+ else
+ printf("PASS: ptr_long_long_int_var\n")
+}
+
+probe process(@1).mark("ptr_const_long_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_const_long_long_int_var\n")
+ else
+ printf("PASS: ptr_const_long_long_int_var\n")
+}
+
+probe process(@1).mark("long_long_int_ptr_const_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: long_long_int_ptr_const_var\n")
+ else
+ printf("PASS: long_long_int_ptr_const_var\n")
+}
+
+probe process(@1).mark("ptr_volatile_long_long_int_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: ptr_volatile_long_long_int_var\n")
+ else
+ printf("PASS: ptr_volatile_long_long_int_var\n")
+}
+
+probe process(@1).mark("long_long_int_ptr_volatile_var")
+{
+ if ($arg1 != $arg2)
+ printf("FAIL: long_long_int_ptr_volatile_var\n")
+ else
+ printf("PASS: long_long_int_ptr_volatile_var\n")
+}
+
+probe process(@1).mark("arr_char")
+{
+ arr_char = user_string ($arg1);
+ if (arr_char != "!~")
+ printf("FAIL: arr_char_var\n")
+ else
+ printf("PASS: arr_char_var\n")
+}
+
+probe process(@1).mark("arr_struct")
+{
+ arr_struct_int_var = user_int ($arg1)
+ if (arr_struct_int_var != 1)
+ printf("FAIL: arr_struct_var\n")
+ else
+ printf("PASS: arr_struct_var\n")
+}
+
+probe process(@1).mark("bitfields_small_var")
+{
+ if ($arg1 != 1 || $arg2 != 0 || $arg3 != 97 || $arg4 != 1
+ || $arg5 != 0 || $arg6 != 122 || $arg7 != 1 || $arg8 != 0)
+ printf("FAIL: bitfields_small_var\n")
+
+}
+
+probe process(@1).mark("bitfields_bit_var")
+{
+ if ($arg1 != 65 || $arg2 != -1 || $arg3 != 1 || $arg4 != 1
+ || $arg5 != 3 || $arg6 != 3 || $arg7 != 7 || $arg8 != 255
+ || $arg9 != 511 || $arg10 != 90)
+ printf("FAIL: bitfields_bit_var\n")
+ else
+ printf("PASS: bitfields_bit_var\n")
+}
+
+
+probe process(@1).mark("primary_colors_var")
+{
+ if ($arg1 != 1)
+ printf("FAIL: primary_colors_var\n")
+ else
+ printf("PASS: primary_colors_var\n")
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp
index e407440e..d6b6e1e3 100644
--- a/testsuite/systemtap.base/static_uprobes.exp
+++ b/testsuite/systemtap.base/static_uprobes.exp
@@ -1,5 +1,7 @@
set test "static_uprobes"
+# 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"
@@ -80,6 +82,9 @@ provider static_uprobes {
};
"
close $fp
+
+# Test dtrace
+
if {[installtest_p]} {
set dtrace $env(SYSTEMTAP_PATH)/dtrace
} else {
@@ -90,9 +95,9 @@ if {[catch {exec $dtrace -h -s $sup_dpath} res]} {
}
catch {exec rm -f $sup_dpath}
if {[file exists $sup_hpath]} then {
- pass "$test generating header"
+ pass "$test dtrace"
} else {
- fail "$test generating header"
+ fail "$test dtrace"
catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath}
return
}
@@ -118,17 +123,6 @@ if { $res != "" } {
pass "$test compiling C -g"
}
-set sup_flags "$sup_flags additional_flags=-x additional_flags=c++"
-set res [target_compile $sup_srcpath $supcplus_exepath executable $sup_flags]
-if { $res != "" } {
- verbose "target_compile failed: $res" 2
- fail "$test compiling C++ -g"
- catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath}
- return
-} else {
- pass "$test compiling C++ -g"
-}
-
if {![installtest_p]} {untested $test; return}
# Try to find utrace_attach symbol in /proc/kallsyms
@@ -144,6 +138,8 @@ if {$utrace_support_found == 0} {
return
}
+# Run stap on executable built with dtrace generated header file
+
set ok 0
verbose -log "spawn stap -c $sup_exepath $sup_stppath"
@@ -162,29 +158,56 @@ wait
if {$ok == 5} { pass "$test C" } { fail "$test C ($ok)" }
-set ok 0
+# Test passing various C types to .mark probes
-# Test setting a probe without .probes using only dwarf label info
-verbose -log "objcopy -R .probes $supcplus_exepath $sup_exepath"
-spawn objcopy -R .probes $supcplus_exepath $sup_exepath
-verbose -log "spawn stap -c $sup_exepath $sup_stppath"
-spawn stap -c $sup_exepath $sup_stppath
+set sup_flags "$sup_flags additional_flags=-O0"
+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"
+ return
+} else {
+ pass "$test compiling types -g"
+}
+
+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 {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} { incr ok; exp_continue }
- timeout { fail "$test C++ (timeout)" }
+ -re {FAIL: [a-z_]+var} { regexp " .*$" $expect_out(0,string) s;
+ incr ok; set fail "$fail $s"; exp_continue }
+ timeout { fail "$test C (timeout)" }
eof { }
}
wait
-# we now generate the probes via asm so there is no label debug info
-if {$ok == 5} { pass "$test C++" } { xfail "$test C++ ($ok)" }
+if { $ok != 0 } {
+ fail "$test $fail"
+} else {
+ pass "$test types"
+}
+
+# Test .mark probe wildcard matching
+
+set ok 0
+spawn stap -l "process(\"./sdt_types.x\").mark(\"*\")"
+expect {
+ -timeout 180
+ -re {mark\(\"[a-z_]+\"\)} { incr ok; exp_continue }
+ timeout { fail "$test C (timeout)" }
+ eof { }
+}
+
+if { $ok == 45 } {
+ pass "$test wildcard"
+} else {
+ fail "$test wildcard ($ok)"
+}
if { $verbose == 0 } {
-catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_dpath $sup_hpath $sup_stppath}
+catch {exec rm -f $sup_srcpath $sup_exepath $supcplus_exepath $sup_dpath $sup_hpath $sup_stppath sdt_types.x}
}
diff --git a/testsuite/systemtap.base/tracepoints.exp b/testsuite/systemtap.base/tracepoints.exp
index bea461c4..cd033908 100644
--- a/testsuite/systemtap.base/tracepoints.exp
+++ b/testsuite/systemtap.base/tracepoints.exp
@@ -1,3 +1,26 @@
+
+set tracepoints {}
+spawn stap -l {kernel.trace("*")}
+expect {
+ -re {^kernel.trace[^\r\n]*\r\n} {
+ append tracepoints $expect_out(0,string)
+ exp_continue
+ }
+ timeout {}
+ eof {}
+}
+catch {close}; catch { wait }
+
+foreach tp $tracepoints {
+ set test "tracepoint $tp -p4"
+ if {[catch {exec stap -w -p4 -e "probe $tp {}"} res]} {
+ fail "$test $res"
+ } else {
+ pass "$test"
+ }
+}
+
set test "tracepoints"
+if {![installtest_p]} { untested $test; return }
set ::result_string {tracepoints OK}
stap_run2 $srcdir/$subdir/$test.stp
diff --git a/testsuite/systemtap.base/uprobes_exe.c b/testsuite/systemtap.base/uprobes_exe.c
new file mode 100644
index 00000000..447434c6
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_exe.c
@@ -0,0 +1,27 @@
+/* uprobes_lib test case
+ * Copyright (C) 2009, Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+#include <unistd.h>
+
+// function from our library
+int lib_main (void);
+
+void
+main_func (int foo)
+{
+ ; // nothing here...
+}
+
+int
+main (int argc, char *argv[], char *envp[])
+{
+ main_func(1);
+ lib_main();
+ return 0;
+}
diff --git a/testsuite/systemtap.base/uprobes_lib.c b/testsuite/systemtap.base/uprobes_lib.c
new file mode 100644
index 00000000..c9d70625
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.c
@@ -0,0 +1,20 @@
+/* uprobes_lib test case - library helper
+ * Copyright (C) 2009, Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ */
+
+void
+lib_func (int bar)
+{
+ ; // nothing here...
+}
+
+void
+lib_main ()
+{
+ lib_func (3);
+}
diff --git a/testsuite/systemtap.base/uprobes_lib.exp b/testsuite/systemtap.base/uprobes_lib.exp
new file mode 100644
index 00000000..ae1b72e8
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.exp
@@ -0,0 +1,38 @@
+set test "uprobes_lib"
+set testpath "$srcdir/$subdir"
+set testsrc "$testpath/uprobes_exe.c"
+set testsrclib "$testpath/uprobes_lib.c"
+set testexe "./uprobes_exe"
+set testlibname "uprobes_lib"
+set testlibdir "."
+set testso "$testlibdir/lib${testlibname}.so"
+set testflags "additional_flags=-g additional_flags=-O"
+set testlibflags "$testflags additional_flags=-fPIC additional_flags=-shared"
+set maintestflags "$testflags additional_flags=-L$testlibdir additional_flags=-l$testlibname additional_flags=-Wl,-rpath,$testlibdir"
+
+# Only run on make installcheck
+if {! [installtest_p]} { untested "$test"; return }
+
+# Compile our test program and library.
+set res [target_compile $testsrclib $testso executable $testlibflags]
+if { $res != "" } {
+ verbose "target_compile for $testso failed: $res" 2
+ fail "unable to compile $testsrclib"
+ return
+}
+set res [target_compile $testsrc $testexe executable $maintestflags]
+if { $res != "" } {
+ verbose "target_compile failed: $res" 2
+ fail "unable to compile $testsrc"
+ return
+}
+
+# XXX main_func needs another/extra test. Disabled for now.
+# Enable (and in uprobes_lib.stp) after PR9940 is fixed.
+# set ::result_string {main_func
+# lib_func}
+set ::result_string {lib_func}
+
+stap_run2 $srcdir/$subdir/$test.stp -c $testexe
+
+#exec rm -f $testexe $testso
diff --git a/testsuite/systemtap.base/uprobes_lib.stp b/testsuite/systemtap.base/uprobes_lib.stp
new file mode 100644
index 00000000..bc6cc249
--- /dev/null
+++ b/testsuite/systemtap.base/uprobes_lib.stp
@@ -0,0 +1,9 @@
+/* - Not activated probe... Seems always skipped?
+probe process("uprobes_exe").function("main_func") {
+ printf("main_func\n");
+}
+*/
+
+probe process("libuprobes_lib.so").function("lib_func") {
+ printf("lib_func\n");
+}
diff --git a/testsuite/systemtap.base/x86_gs.exp b/testsuite/systemtap.base/x86_gs.exp
new file mode 100644
index 00000000..98ab3051
--- /dev/null
+++ b/testsuite/systemtap.base/x86_gs.exp
@@ -0,0 +1,12 @@
+set test "x86_gs"
+if {![installtest_p]} { untested $test; return }
+set arch [exec uname -m]
+if {$arch!="i686"} { untested $test; return }
+spawn stap $srcdir/$subdir/x86_gs.stp
+expect {
+ -timeout 60
+ -re "0\r\n" { pass $test }
+ -re "140\r\n" { pass $test }
+ eof { fail $test }
+ timeout { fail "$test unexpected timeout" }
+}
diff --git a/testsuite/systemtap.base/x86_gs.stp b/testsuite/systemtap.base/x86_gs.stp
new file mode 100644
index 00000000..68b58512
--- /dev/null
+++ b/testsuite/systemtap.base/x86_gs.stp
@@ -0,0 +1,10 @@
+#! stap
+
+# test x86 gs register
+
+probe begin {
+ if (!_stp_regs_registered)
+ _stp_register_regs()
+ printf("%d\n",test_x86_gs() * 100 + _reg_offsets["gs"]) /* 0 or 140 */
+ exit()
+}