From bbafcb1e9cff0ca06c7b8e615def02183e8a67f1 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Mon, 4 Jan 2010 16:20:44 -0500 Subject: Purge sdt utrace support. * sdt.h (UTRACE_SDT): Remove. * tapset-utrace.cxx (utrace_derived_probe): Remove has_library and library. (utrace_derived_probe_group::emit_probe_decl): Remove mmap_callback, sdt_sem_offset, and sdt_sem_address. (utrace_derived_probe_group::emit_module_decls): Remove sdt_sem_offset and sdt_sem_address support. * tapsets.cxx (sdt_var_expanding_visitor): Remove utrace_probe. (sdt_query::handle_query_module) Remove utrace_type. (sdt_query::convert_probe): Likewise. * postgres.exp: Remove utrace testing. * sdt.exp: Likewise. * sdt_misc.exp: Likewise. --- testsuite/systemtap.apps/postgres.exp | 9 +-------- testsuite/systemtap.base/sdt.exp | 4 ++-- testsuite/systemtap.base/sdt_misc.exp | 4 ++-- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'testsuite') diff --git a/testsuite/systemtap.apps/postgres.exp b/testsuite/systemtap.apps/postgres.exp index b7f522a1..9d3c18c3 100644 --- a/testsuite/systemtap.apps/postgres.exp +++ b/testsuite/systemtap.apps/postgres.exp @@ -122,14 +122,7 @@ cd postgresql-8.3.6/ mkdir bld;cd bld ../configure --enable-dtrace --prefix=$postgresdir # sed -i -e 's/ifeq (\$(PORTNAME), solaris)/ifeq (\$(enable_dtrace), yes)/' src/backend/Makefile -sed -i -e 's/^CFLAGS = -O2.*\$/& -g -DEXPERIMENTAL_UTRACE_SDT/' src/Makefile.global -make -make install -run_tests utrace - -sed -i -e 's/UTRACE/KPROBE/' src/Makefile.global -(cd src/backend/utils/ - make clean) +sed -i -e 's/^CFLAGS = -O2.*\$/& -g -DEXPERIMENTAL_KPROBE_SDT/' src/Makefile.global make make install run_tests kprobe diff --git a/testsuite/systemtap.base/sdt.exp b/testsuite/systemtap.base/sdt.exp index ea025391..8a77cc06 100644 --- a/testsuite/systemtap.base/sdt.exp +++ b/testsuite/systemtap.base/sdt.exp @@ -12,8 +12,8 @@ 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}} +set pbtype_flags {{""} {additional_flags=-DEXPERIMENTAL_KPROBE_SDT}} +set pbtype_mssgs {{uprobe} {kprobe}} # Iterate pbtype_flags for {set p 0} {$p < [llength $pbtype_flags]} {incr p} { diff --git a/testsuite/systemtap.base/sdt_misc.exp b/testsuite/systemtap.base/sdt_misc.exp index 062181a5..8a0cdea2 100644 --- a/testsuite/systemtap.base/sdt_misc.exp +++ b/testsuite/systemtap.base/sdt_misc.exp @@ -136,8 +136,8 @@ if {[installtest_p]} { set sdtdir $srcdir/../includes } -set pbtype_flags {{""} {additional_flags=-O additional_flags=-DEXPERIMENTAL_UTRACE_SDT} {additional_flags=-O additional_flags=-DEXPERIMENTAL_KPROBE_SDT}} -set pbtype_mssgs {{uprobe} {utrace} {kprobe}} +set pbtype_flags {{""} {additional_flags=-O additional_flags=-DEXPERIMENTAL_KPROBE_SDT}} +set pbtype_mssgs {{uprobe} {kprobe}} # Iterate pbtype_flags for {set i 0} {$i < [llength $pbtype_flags]} {incr i} { -- cgit From 23312a05753e948f7053beccc3dedfbe407a660a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 5 Jan 2010 11:45:52 +0100 Subject: PR10732 declaration.exp empty-struct fails, resolve-fail passes erroneously. * testsuite/systemtap.base/declaration.exp: Remove test. --- testsuite/systemtap.base/declaration.exp | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 testsuite/systemtap.base/declaration.exp (limited to 'testsuite') diff --git a/testsuite/systemtap.base/declaration.exp b/testsuite/systemtap.base/declaration.exp deleted file mode 100644 index f7452a14..00000000 --- a/testsuite/systemtap.base/declaration.exp +++ /dev/null @@ -1,20 +0,0 @@ -# Declaration tests. Specifically looking for resolution of -# DW_AT_declaration from another module - -set TEST_NAME "empty-struct resolve-fail" - -# this test just makes sure $device is still stubbed with DW_AT_declaration -set failscript { - probe\ module(\"libata\").function(\"ata_qc_issue\")\ \{\ print(\$qc->\$scsicmd->\$device->\$host->\$host_no)\ \}; -} - -stap_compile $TEST_NAME 0 $failscript - -set TEST_NAME "empty-struct resolve-pass" - -set passscript { - probe\ module(\"scsi_mod\").function(\"scsi_request_fn\")\ \{print(\$q)\} -} - -setup_xfail 10732 "*-*-*" -stap_compile $TEST_NAME 1 [concat $passscript $failscript ] -- cgit From 21e8e579ef10942bf2db3e1514026a6d132b1502 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 5 Jan 2010 15:18:57 +0100 Subject: bz6436 backtraces from uprobes This implements proper unwinding from uprobes in the presence of uretprobe trampolines. * runtime/stack.c (_stp_stack_print): Rework for uprobe context case and refactor a bit. * runtime/uprobes2/uprobes.h (GET_PC_URETPROBE_NONE): new constant * runtime/uprobes2/uprobes.c (uprobe_get_pc): Support translating the trampoline function from uprobe context in addition to uretprobe context. * runtime/uprobes/uprobes.h (GET_PC_URETPROBE_NONE): ditto * runtime/uprobes/uprobes.c (uprobe_get_pc): ditto * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Initialize ri in context to GET_PC_URETPROBE_NONE in generated enter_uprobe_probe. * testsuite/systemtap.context/fib.stp: Add an option to do a backtrace on function entry. * testsuite/systemtap.context/fib.exp: Test backtrace in function entry (uprobe) probes. --- testsuite/systemtap.context/fib.exp | 14 ++++++++++++++ testsuite/systemtap.context/fib.stp | 3 +++ 2 files changed, 17 insertions(+) (limited to 'testsuite') diff --git a/testsuite/systemtap.context/fib.exp b/testsuite/systemtap.context/fib.exp index cc4d75a1..5026e5d0 100644 --- a/testsuite/systemtap.context/fib.exp +++ b/testsuite/systemtap.context/fib.exp @@ -35,3 +35,17 @@ expect { } wait if {$fibcalls == 18 && $maincalls == 2} { pass "$test ($fibcalls $maincalls)" } { fail "$test ($fibcalls $maincalls)" } + +spawn stap -c "$testexe 10" -- $teststp --entry +set fibcalls 0 +set maincalls 0 +expect { + -timeout 120 + -re {^fib[^\r\n]*[\r\n]} { incr fibcalls; exp_continue } + -re {^main[^\r\n]*[\r\n]} { incr maincalls; exp_continue } + -re {^[^\r\n]*[\r\n]} {exp_continue} + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$fibcalls == 55 && $maincalls == 10} { pass "$test ($fibcalls $maincalls)" } { fail "$test ($fibcalls $maincalls)" } diff --git a/testsuite/systemtap.context/fib.stp b/testsuite/systemtap.context/fib.stp index 85c2fc1d..fe2415f5 100644 --- a/testsuite/systemtap.context/fib.stp +++ b/testsuite/systemtap.context/fib.stp @@ -5,13 +5,16 @@ probe process("fib").function("fib").call { depth++ if (depth > max_depth) { max_depth = depth + %( $# > 0 %? print_ubacktrace_brief(); printf("\n") %) } } probe process("fib").function("fib").return { + %( $# == 0 %? if (depth == max_depth) { print_ubacktrace_brief() printf("\n") } + %) depth-- } -- cgit From 6ac9e2adb81122c92aa180d628a1d6c226ada6aa Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 6 Jan 2010 17:27:25 +0100 Subject: grapher example with backtraces in events * testsuite/systemtap.examples/profiling/graphcall.stp : new file --- testsuite/systemtap.examples/profiling/graphcall.stp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 testsuite/systemtap.examples/profiling/graphcall.stp (limited to 'testsuite') diff --git a/testsuite/systemtap.examples/profiling/graphcall.stp b/testsuite/systemtap.examples/profiling/graphcall.stp new file mode 100644 index 00000000..db96b728 --- /dev/null +++ b/testsuite/systemtap.examples/profiling/graphcall.stp @@ -0,0 +1,19 @@ +#! /usr/bin/env stap + +# When the output of this script is fed to stapgraph, it produces a +# mousable event line with events at each call of interest. When the +# event is hovered over, the backtrace is displayed in stapgraph. + +probe begin +{ + printf("%%DataSet:call 75 ff0000 discreet\n") + printf("call %%Title:Calls to %s\n", @2) + printf ("call %%XAxisTitle:Time\n") + printf ("%%LineEnd:0\n") +} + +probe process(@1).function(@2).call { + printf("call %d ", gettimeofday_ms()) + print_ubacktrace_brief(); + printf("%c", 0) +} -- cgit From e0c56962dbc24692c699f7f9ba3bf267c3807921 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Thu, 7 Jan 2010 10:20:55 -0500 Subject: Make all buildok tests executable. --- testsuite/buildok/irq.stp | 0 testsuite/buildok/logging.stp | 0 testsuite/buildok/pr10678.stp | 0 testsuite/buildok/scheduler-test-tracepoints.stp | 0 testsuite/buildok/semicolon.stp | 0 testsuite/buildok/vm.tracepoints.kmalloc.stp | 0 testsuite/buildok/vm.tracepoints.stp | 0 7 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/buildok/irq.stp mode change 100644 => 100755 testsuite/buildok/logging.stp mode change 100644 => 100755 testsuite/buildok/pr10678.stp mode change 100644 => 100755 testsuite/buildok/scheduler-test-tracepoints.stp mode change 100644 => 100755 testsuite/buildok/semicolon.stp mode change 100644 => 100755 testsuite/buildok/vm.tracepoints.kmalloc.stp mode change 100644 => 100755 testsuite/buildok/vm.tracepoints.stp (limited to 'testsuite') diff --git a/testsuite/buildok/irq.stp b/testsuite/buildok/irq.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/logging.stp b/testsuite/buildok/logging.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/pr10678.stp b/testsuite/buildok/pr10678.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/scheduler-test-tracepoints.stp b/testsuite/buildok/scheduler-test-tracepoints.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/semicolon.stp b/testsuite/buildok/semicolon.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/vm.tracepoints.kmalloc.stp b/testsuite/buildok/vm.tracepoints.kmalloc.stp old mode 100644 new mode 100755 diff --git a/testsuite/buildok/vm.tracepoints.stp b/testsuite/buildok/vm.tracepoints.stp old mode 100644 new mode 100755 -- cgit From 4bd4d40e19f7ba203d5e380965210181648f560a Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 7 Jan 2010 12:14:44 -0600 Subject: Partial PR 10848 fix. Added testcase for STP_MAXMEMORY. * runtime/alloc.c (_stp_kmalloc): Renamed 'MAXMEMORY' to 'STP_MAXMEMORY'. (_stp_kzalloc): Ditto. (_stp_vmalloc): Ditto. (_stp_alloc_percpu): Ditto. (_stp_kmalloc_node): Ditto. * testsuite/systemtap.base/maxmemory.exp: New test for STP_MAXMEMORY. --- testsuite/systemtap.base/maxmemory.exp | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 testsuite/systemtap.base/maxmemory.exp (limited to 'testsuite') diff --git a/testsuite/systemtap.base/maxmemory.exp b/testsuite/systemtap.base/maxmemory.exp new file mode 100644 index 00000000..20827edf --- /dev/null +++ b/testsuite/systemtap.base/maxmemory.exp @@ -0,0 +1,86 @@ +if {![installtest_p]} {untested "MAXMEMORY"; return} + +set script { + global k + + probe begin { + print("systemtap starting probe\n") + k["foo"] = 0 + } + + probe kernel.function("vfs_read"), kernel.function("vfs_write") { + k["foo"]++ + } + probe end { + print("systemtap ending probe\n") + } +} + +# stap_run_maxmemory TEST_NAME EXPECT_ERROR +# TEST_NAME is the name of the current test +# EXPECT_ERROR lets us know to expect an error or not +# +# Additional arguments are passed to stap as-is. +proc stap_run_maxmemory { TEST_NAME EXPECT_ERROR args } { + + set cmd [concat {stap -v} $args] + eval spawn $cmd + expect { + -timeout 150 + -re {^Pass\ [1234]: [^\r]+real\ ms\.\r\n} {exp_continue} + -re {^Pass\ ([34]): using cached [^\r]+\r\n} {exp_continue} + -re {^Pass 5: starting run.\r\n} {exp_continue} + -re {^Error inserting module[^\r]+\r\n} { + if {$EXPECT_ERROR} { + pass "$TEST_NAME received expected insert module error" + } else { + fail "$TEST_NAME unexpected insert module error" + } + } + -re {ERROR: [^\r]+ allocation failed\r\n} { + if {$EXPECT_ERROR} { + pass "$TEST_NAME received expected allocation error" + } else { + fail "$TEST_NAME unexpected allocation error" + } + } + -re "^systemtap starting probe\r\n" { + exec kill -INT -[exp_pid] + + expect { + -timeout 10 + -re {^systemtap ending probe\r\n} { + if {$EXPECT_ERROR} { + fail "$TEST_NAME didn't receive expected allocation error" + } else { + pass "$TEST_NAME didn't receive allocation error" + } + } + -re {ERROR: .+ allocation failed\r\n} { + if {$EXPECT_ERROR} { + pass "$TEST_NAME received expected allocation error" + } else { + fail "$TEST_NAME received an unexpected allocation error" + } + } + } + } + -re "semantic error:" { fail "$TEST_NAME compilation" } + timeout { fail "$TEST_NAME startup (timeout)"; + exec kill -INT -[exp_pid] } + eof { fail "$TEST_NAME startup (eof)" } + } + catch close + wait +} + +# MAXMEMORY1 tests to make sure normal operation doesn't receive a +# max memory error +set test "MAXMEMORY1" +stap_run_maxmemory $test 0 -u -e $script + +# MAXMEMORY2 is the same script, but we're adjusting STP_MAXMEMORY to +# a low value so that we *will* get an allocation error or an insert +# module error. +set test "MAXMEMORY2" +stap_run_maxmemory $test 1 -u -DSTP_MAXMEMORY=200 -e $script -- cgit