]> sourceware.org Git - systemtap.git/commitdiff
2007-09-12 Masami Hiramatsu <mhiramat@redhat.com>
authorhiramatu <hiramatu>
Wed, 12 Sep 2007 16:48:00 +0000 (16:48 +0000)
committerhiramatu <hiramatu>
Wed, 12 Sep 2007 16:48:00 +0000 (16:48 +0000)
       PR 4633
       * systemtap.context/backtrace.stp: Add testcases for the return
       probe and the profile probe.
       * systemtap.context/backtrace.tcl: Ditto.
       * /systemtap.context/systemtap_test_module2.c: Ditto.

testsuite/ChangeLog
testsuite/systemtap.context/backtrace.stp
testsuite/systemtap.context/backtrace.tcl
testsuite/systemtap.context/systemtap_test_module2.c

index a5c84ed096ea673c53b3b9454a414f8be19486ff..8d44386e48949f7ecddb4ace93a809676e677bef 100644 (file)
@@ -1,3 +1,11 @@
+2007-09-12  Masami Hiramatsu <mhiramat@redhat.com>
+
+       PR 4633
+       * systemtap.context/backtrace.stp: Add testcases for the return
+       probe and the profile probe.
+       * systemtap.context/backtrace.tcl: Ditto.
+       * /systemtap.context/systemtap_test_module2.c: Ditto.
+
 2007-09-12  Frank Ch. Eigler  <fche@elastic.org>
 
        PR 5023.
index 8f02c174ae665b93c3d9f77e068b47072011e13b..7378137126235a4358a3f76b2080b171e42dd4c9 100644 (file)
@@ -1,9 +1,9 @@
-function print_all_trace_info() {
+function print_all_trace_info(point:string) {
        printf("backtrace from %s:\n", pp())
         print_backtrace()
         print("--------\n")
        bt = backtrace()
-       printf("the stack is %s\n", bt)
+       printf("the %s stack is %s\n", point, bt)
         print("--------\n")
        print_stack(bt);
         print("--------\n")
@@ -17,8 +17,19 @@ probe end {
        print_backtrace()
 }
 
-probe module("systemtap_test_module2").function("yyy_func3") {
-       print_all_trace_info()
+global flag = 0
+probe module("systemtap_test_module2").function("yyy_func3").call {
+       print_all_trace_info("call")
+       flag ++
+}
+probe module("systemtap_test_module2").function("yyy_func4").return {
+       print_all_trace_info("return")
+       flag ++
+}
+probe timer.profile {
+       if (cpu() == 0 && flag == 2 && probemod() != "systemtap_test_module2") {
+               print_all_trace_info("profile")
+               flag ++
+       }
 }
-
 
index 98a765a24f9a1206b7632aa8df325830fea7c9b4..8d63604def0676b8f9dfca4887b3eed06c09f207 100644 (file)
@@ -1,5 +1,9 @@
 set m1 0
 set m2 0
+set m3 0
+set m4 0
+set m5 0
+set m6 0
 
 spawn stap backtrace.stp
 #exp_internal 1
@@ -28,11 +32,11 @@ expect {
        }
        exp_continue
     }
-    -re {.*---\r\nthe stack is 0x[a-f0-9]+ [^\r\n]+\r\n} {
+    -re {.*---\r\nthe call stack is 0x[a-f0-9]+ [^\r\n]+\r\n} {
        incr m2
        expect {
            -timeout 5
-           -re {.*0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+           -re {.*---\r\n 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
                if {$m2 == 1} {incr m2}
                exp_continue
            }
@@ -44,20 +48,100 @@ expect {
                if {$m2 == 3} {incr m2}
            }
        }
+       exp_continue
+    }
+    -re {.*backtrace from module\(\"systemtap_test_module2\"\)\.function\(\"yyy_func4@[^\r\n]+\r\n} {
+       incr m3
+       expect {
+           -timeout 5
+            -re {^Returning from: 0x[a-f0-9]+ : yyy_func4[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m3 == 1} {incr m3}
+               exp_continue
+            }
+            -re {^Returning to  : 0x[a-f0-9]+ : yyy_func3[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m3 == 2} {incr m3}
+               exp_continue
+            }
+           -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m3 == 3} {incr m3}
+               exp_continue
+           }
+           -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m3 == 4} {incr m3}
+           }
+       }
+       exp_continue
+    }
+    -re {.*---\r\nthe return stack is 0x[a-f0-9]+ [^\r\n]+\r\n} {
+       incr m4
+       expect {
+           -timeout 5
+           -re {.*0x[a-f0-9]+ : kretprobe_trampoline_holder[^\[]+\[\]\r\n} {
+               if {$m4 == 1} {incr m4}
+               exp_continue
+           }
+           -re {^ 0x[a-f0-9]+ : yyy_func2[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m4 == 2} {incr m4}
+               exp_continue
+           }
+           -re {^ 0x[a-f0-9]+ : yyy_func1[^\[]+\[systemtap_test_module2\]\r\n} {
+               if {$m4 == 3} {incr m4}
+           }
+       }
+       exp_continue
+    }
+    -re {.*backtrace from timer.profile:\r\n} {
+       incr m5
+       expect {
+           -timeout 5
+           -re {^ 0x[a-f0-9]+ : [^\r\n]+\r\n 0x[a-f0-9]+ : [^\r\n]+\r\n} {
+               if {$m5 == 1} {incr m5}
+           }
+       }
+       exp_continue
+    }
+    -re {.*---\r\nthe profile stack is 0x[a-f0-9]+ [^\r\n]+\r\n} {
+       incr m6
+       expect {
+           -timeout 5
+           -re {.*---\r\n 0x[a-f0-9]+ : [^\r\n]+\r\n 0x[a-f0-9]+ : [^\r\n]+\r\n} {
+               if {$m6 == 1} {incr m6}
+           }
+       }
     }
-    eof {fail "backtrace of yyy_func3. unexpected EOF" }
+   eof {fail "backtrace of yyy_func3, yyy_func4.return and timer.profile. unexpected EOF" }
 }
 send "\003"
 if {$m1 == 4} {
     pass "backtrace of yyy_func3"
 } else {
-    fail "backtrace of yyy_func3"
+    fail "backtrace of yyy_func3 ($m1)"
 }
 if {$m2 == 4} {
     pass "print_stack of yyy_func3"
 } else {
     fail "print_stack of yyy_func3 ($m2)"
 }
+if {$m3 == 5} {
+    pass "backtrace of yyy_func4.return"
+} else {
+    fail "backtrace of yyy_func4.return ($m3)"
+}
+if {$m4 == 4} {
+    pass "print_stack of yyy_func4.return"
+} else {
+    fail "print_stack of yyy_func4.return ($m4)"
+}
+if {$m5 == 2} {
+    pass "backtrace of timer.profile"
+} else {
+    fail "backtrace of timer.profile ($m5)"
+}
+if {$m6 == 2} {
+    pass "print_stack of timer.profile"
+} else {
+    fail "print_stack of timer.profile ($m6)"
+}
 
 close
 wait
index 35a28efb52508f79d48a22f492f38b960d48ccf2..51cb58bb9a97635684643f4ea737c16a76ade44a 100644 (file)
 /** Here are all the functions we will probe **/
 
 /* some nested functions to test backtraces */
+int noinline yyy_func4 (int foo) {
+        return foo + 1;
+}
 int noinline yyy_func3 (int foo) {
+       foo = yyy_func4(foo);
         return foo + 1;
 }
 int noinline yyy_func2 (int foo) {
This page took 0.03431 seconds and 5 git commands to generate.