From 1123a74ab28d4ae9f2db0d704ce3981064ed9591 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 27 Jul 2009 15:52:28 -0400 Subject: PR6905: tweak WILDCARD and RANGE line type for process.statement * dwflpp.cxx (iterate_over_srcfile_lines): Check the line range and tolerate invalid line number for WILDCARD line type. * testsuite/systemtap.base/bz6905.c: Test case. * testsuite/systemtap.base/bz6905.exp: Ditto. * testsuite/systemtap.base/bz6905.stp: Ditto. --- testsuite/systemtap.base/bz6905.c | 7 +++++++ testsuite/systemtap.base/bz6905.exp | 25 +++++++++++++++++++++++++ testsuite/systemtap.base/bz6905.stp | 4 ++++ 3 files changed, 36 insertions(+) create mode 100644 testsuite/systemtap.base/bz6905.c create mode 100644 testsuite/systemtap.base/bz6905.exp create mode 100644 testsuite/systemtap.base/bz6905.stp (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/bz6905.c b/testsuite/systemtap.base/bz6905.c new file mode 100644 index 00000000..bb3f524e --- /dev/null +++ b/testsuite/systemtap.base/bz6905.c @@ -0,0 +1,7 @@ +int main() +{ + int a; + + a = a + 1; + return 0; +} diff --git a/testsuite/systemtap.base/bz6905.exp b/testsuite/systemtap.base/bz6905.exp new file mode 100644 index 00000000..8119159e --- /dev/null +++ b/testsuite/systemtap.base/bz6905.exp @@ -0,0 +1,25 @@ +set test bz6905 + +catch {exec gcc -g -o $test $srcdir/$subdir/$test.c} err +if {$err == "" && [file exists $test]} then { pass "$test compile" } else { fail "$test compile" } + +if {![utrace_p]} { + catch {exec rm -f $test} + untested "$test -p2" + return +} + +set stapexe [exec /usr/bin/which stap] +spawn sudo $stapexe -p2 $srcdir/$subdir/$test.stp +set hint 0 +set probes 0 +expect { + -timeout 60 + -re "# probes" { incr hint; exp_continue } + -re {process.*statement.*} { incr probes; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if { $hint == 1 && $probes > 0 } then { pass "$test -p2" } else { fail "$test -p2 ($probes)" } +exec rm -f $test diff --git a/testsuite/systemtap.base/bz6905.stp b/testsuite/systemtap.base/bz6905.stp new file mode 100644 index 00000000..73c7d50c --- /dev/null +++ b/testsuite/systemtap.base/bz6905.stp @@ -0,0 +1,4 @@ +#! stap -p2 +probe process("./bz6905").statement("main@bz6905.c:*") { + printf("ok") +} -- cgit From fc7e606e053159fad715883ccee2d99324c32f1a Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Tue, 28 Jul 2009 17:26:55 -0400 Subject: PR10453: Fix crash.exp not to refer removed file * systemtap.base/crash.exp: Use command-line script instead of removed script file. --- testsuite/systemtap.base/crash.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/crash.exp b/testsuite/systemtap.base/crash.exp index 9c3e5e05..59c8dadd 100644 --- a/testsuite/systemtap.base/crash.exp +++ b/testsuite/systemtap.base/crash.exp @@ -5,7 +5,7 @@ if {![installtest_p]} { untested $test; return } if {![file exists $env(CRASH_LIBDIR)/staplog.so]} { untested "$test - no staplog.so"; return } # Load a test script -spawn stap $srcdir/$subdir/testlog.stp -m testlog +spawn stap -e {probe begin {print("HelloWorld\n")}} -m testlog expect { -timeout 120 "HelloWorld\r\n" { -- cgit From a0c0ed1c030d8e812eed19b096c626b7ce233358 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Tue, 28 Jul 2009 19:50:24 -0400 Subject: PR6978: support $$parms for process.syscall * tapset-utrace.cxx (visit_target_symbol_arg): Handle $$parms. * testsuite/systemtap.base/utrace_p4.exp: Add test case. * testsuite/systemtap.base/utrace_p5.exp: Ditto. --- testsuite/systemtap.base/utrace_p4.exp | 19 +++++++++++++++++++ testsuite/systemtap.base/utrace_p5.exp | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/utrace_p4.exp b/testsuite/systemtap.base/utrace_p4.exp index 8d323a8a..c76503cb 100644 --- a/testsuite/systemtap.base/utrace_p4.exp +++ b/testsuite/systemtap.base/utrace_p4.exp @@ -10,6 +10,7 @@ set begin_script {"probe process(\"/bin/ls\").begin { print(\"ls begin\") }"} set end_script {"probe process(\"/bin/ls\").end { print(\"ls end\") }"} set syscall_script {"probe process(\"/bin/ls\").syscall { printf(\"|%d\", \$syscall) }"} +set syscall_parms_script {"probe process(\"/bin/ls\").syscall { printf(\"|%s\", \$\$parms) }"} set syscall_return_script {"probe process(\"/bin/ls\").syscall.return { printf(\"|%d\", \$syscall) }"} set thread_begin_script {"probe process(\"/bin/ls\").thread.begin { print(\"ls thread.begin\") }"} set thread_end_script {"probe process(\"/bin/ls\").thread.end { print(\"ls thread.end\") }"} @@ -18,6 +19,7 @@ set all_begin_script {"probe process.begin { print(\"begin\") }"} set pid_begin_script {"probe process(123).begin { print(\"123 begin\") }"} set pid_end_script {"probe process(123).end { print(\"123 end\") }"} set pid_syscall_script {"probe process(123).syscall { printf(\"|%d\", \$syscall) }"} +set pid_parms_script {"probe process(123).syscall { printf(\"|%s\", \$\$parms) }"} set pid_syscall_return_script {"probe process(123).syscall.return { printf(\"|%d\", \$syscall) }"} set pid_thread_begin_script {"probe process(123).thread.begin { print(\"123 thread.begin\") }"} set pid_thread_end_script {"probe process(123).thread.end { print(\"123 thread.end\") }"} @@ -129,3 +131,20 @@ if {![utrace_p]} { # Try compiling an system-wide begin script stap_compile $TEST_NAME 1 $all_begin_script } + +set TEST_NAME "UTRACE_P4_08" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} else { + # Try compiling a syscall parms script using a path + stap_compile $TEST_NAME 1 $syscall_parms_script +} + +set TEST_NAME "UTRACE_P4_09" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} else { + # Try compiling a syscall parms script using a pid + stap_compile $TEST_NAME 1 $pid_parms_script +} + diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index 3d432dc3..7062bc0d 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -89,6 +89,18 @@ set bz6841_script { } set bz6841_script_output ".+ issues syscall \\d+ times\r\n" +set syscall_parms_script { + global syscall_parms_string + probe begin { printf("systemtap starting probe\n") } + probe process.syscall { syscall_parms_string = $$parms exit() } + probe end { printf("systemtap ending probe\n") + printf("%s\n",syscall_parms_string) + delete syscall_parms_string + } +} +set syscall_parms_script_output "(.+arg\[1-6\]=0x\[0-9a-f\]+)+\r\n" + + # Set up our own copy of /bin/cat, to make testing for a particular # executable easy. We can't use 'ln' here, since we might be creating # a cross-device link. We can't use 'ln -s' here, since the kernel @@ -202,5 +214,15 @@ if {![utrace_p]} { -e $bz6841_script } +set TEST_NAME "UTRACE_P5_08" +if {![utrace_p]} { + untested "$TEST_NAME : no kernel utrace support found" +} elseif {![installtest_p]} { + untested "$TEST_NAME" +} else { + set script [format $syscall_parms_script "%s"] + stap_run $TEST_NAME no_load $syscall_parms_script_output -e $script +} + # Cleanup exec rm -f $exepath $multi_exepath -- cgit From f1312b2c2bc1ec7b0475a251f27a2f75779f4ccb Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 30 Jul 2009 19:24:17 -0700 Subject: Relax the type-matching in the cmd_parse13 test Dwarf probes are now printing their $target variables in -L, so we need to handle more than just stap types in the regular expression. --- testsuite/systemtap.base/cmd_parse.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/cmd_parse.exp b/testsuite/systemtap.base/cmd_parse.exp index c6b098a4..b97d9448 100644 --- a/testsuite/systemtap.base/cmd_parse.exp +++ b/testsuite/systemtap.base/cmd_parse.exp @@ -116,7 +116,7 @@ wait;close spawn stap -L syscall.a* expect { -timeout 60 - -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:(string|long|unknown|stats))*\r\n)+} { pass "cmd_parse13" } + -re {(syscall\.a[_a-zA-Z0-9]*(\ [_a-zA-Z0-9\$]+:[^:]+?)+\r\n)+} { pass "cmd_parse13" } timeout {fail "cmd_parse13: unexpected timeout"} eof {fail "cmd_parse13: unexpected EOF"} } -- cgit From 6fda2dff51c667a8c73545dd397b844108715310 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 3 Aug 2009 14:45:21 -0700 Subject: PR2049: support arbitrary $target-array indexing Rather than just numeric literals, we can now support arbitrary expressions for the index value. Note that loc2c won't allow this for noncontiguous arrays, as the access methods need to be statically computed, but for contiguous arrays and pointers-as-arrays it works just fine. * staptree.h (target_symbol::component): Add expression_array_index. * staptree.cxx (target_symbol::visit_components): New helper. (target_symbol::assert_no_components): Recognize new array type. (target_symbol::component::print): Print subexpressions. (traversing_visitor::visit_target_symbol, visit_cast_op): Visit the indexing components too. (varuse_collecting_visitor::visit_target_symbol): Ditto. (update_visitor::visit_target_symbol, visit_cast_op): Ditto. * elaborate.cxx (void_statement_reducer::visit_target_symbol): New. (void_statement_reducer::visit_cast_op): Save indexes too. * parse.cxx (parser::parse_target_symbol_components): Parse expressions. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Pass expression-indexes as parameters (indexN) to the dwarf function. (dwarf_cast_expanding_visitor::visit_cast_op): Ditto. (tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto. (sdt_var_expanding_visitor::visit_target_symbol): Visit the new @cast. * dwflpp.cxx (dwflpp::translate_components): Use THIS->indexN. * translate.cxx (c_unparser::visit_target_symbol): Correct error msg. * testsuite/systemtap.base/pointer_array.stp: Use a simple index. --- testsuite/systemtap.base/pointer_array.stp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'testsuite/systemtap.base') diff --git a/testsuite/systemtap.base/pointer_array.stp b/testsuite/systemtap.base/pointer_array.stp index 1d15ebf4..cd420604 100644 --- a/testsuite/systemtap.base/pointer_array.stp +++ b/testsuite/systemtap.base/pointer_array.stp @@ -2,15 +2,8 @@ probe syscall.execve { if (pid() == target()) { println(user_string($argv[0])) - printf("%c\n", $argv[0][0]) - printf("%c\n", $argv[0][1]) - printf("%c\n", $argv[0][2]) - printf("%c\n", $argv[0][3]) - printf("%c\n", $argv[0][4]) - printf("%c\n", $argv[0][5]) - printf("%c\n", $argv[0][6]) - printf("%c\n", $argv[0][7]) - printf("%c\n", $argv[0][8]) + for (i=0; i<9; ++i) + printf("%c\n", $argv[0][i]) println($argv[0][9]) } } -- cgit