| OLD | NEW |
| 1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2012 Free Software Foundation, Inc. |
| 2 # This program is free software; you can redistribute it and/or modify | 2 # This program is free software; you can redistribute it and/or modify |
| 3 # it under the terms of the GNU General Public License as published by | 3 # it under the terms of the GNU General Public License as published by |
| 4 # the Free Software Foundation; either version 3 of the License, or | 4 # the Free Software Foundation; either version 3 of the License, or |
| 5 # (at your option) any later version. | 5 # (at your option) any later version. |
| 6 # | 6 # |
| 7 # This program is distributed in the hope that it will be useful, | 7 # This program is distributed in the hope that it will be useful, |
| 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 # GNU General Public License for more details. | 10 # GNU General Public License for more details. |
| 11 # | 11 # |
| 12 # You should have received a copy of the GNU General Public License | 12 # You should have received a copy of the GNU General Public License |
| 13 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 13 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 14 | 14 |
| 15 load_lib "trace-support.exp"; | 15 load_lib "trace-support.exp"; |
| 16 | 16 |
| 17 set testfile "status-stop" | 17 standard_testfile |
| 18 set executable $testfile | 18 set executable $testfile |
| 19 set srcfile ${testfile}.c | |
| 20 set binfile $objdir/$subdir/$testfile | |
| 21 set expfile $testfile.exp | 19 set expfile $testfile.exp |
| 22 | 20 |
| 23 | 21 |
| 24 if [prepare_for_testing $expfile $executable $srcfile \ | 22 if [prepare_for_testing $expfile $executable $srcfile \ |
| 25 {debug nowarnings}] { | 23 {debug nowarnings}] { |
| 26 untested "failed to prepare for trace tests" | 24 untested "failed to prepare for trace tests" |
| 27 return -1 | 25 return -1 |
| 28 } | 26 } |
| 29 | 27 |
| 30 if ![runto_main] { | 28 if ![runto_main] { |
| 31 fail "Can't run to main to check for trace support" | 29 fail "Can't run to main to check for trace support" |
| 32 return -1 | 30 return -1 |
| 33 } | 31 } |
| 34 | 32 |
| 35 if ![gdb_target_supports_trace] { | 33 if ![gdb_target_supports_trace] { |
| 36 unsupported "target does not support trace" | 34 unsupported "target does not support trace" |
| 37 return -1; | 35 return -1; |
| 38 } | 36 } |
| 39 | 37 |
| 40 # Verify that the sequence of commands "tstart tstop tstart" works well. | 38 # Verify that the sequence of commands "tstart tstop tstart" works well. |
| 41 | 39 |
| 42 proc test_tstart_tstop_tstart { } { | 40 proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart" { |
| 43 global executable | 41 global executable |
| 44 global pf_prefix | |
| 45 global hex | 42 global hex |
| 46 | 43 |
| 47 set old_pf_prefix $pf_prefix | |
| 48 set pf_prefix "$pf_prefix tstart_tstop_tstart:" | |
| 49 | |
| 50 # Start with a fresh gdb. | 44 # Start with a fresh gdb. |
| 51 clean_restart ${executable} | 45 clean_restart ${executable} |
| 52 if ![runto_main] { | 46 if ![runto_main] { |
| 53 fail "Can't run to main" | 47 fail "Can't run to main" |
| 54 set pf_prefix $old_pf_prefix | |
| 55 return -1 | 48 return -1 |
| 56 } | 49 } |
| 57 | 50 |
| 58 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | 51 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" |
| 59 gdb_test_no_output "tstart" | 52 gdb_test_no_output "tstart" |
| 60 | 53 |
| 61 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | 54 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" |
| 62 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | 55 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" |
| 63 | 56 |
| 64 gdb_test_no_output "tstop" | 57 gdb_test_no_output "tstop" |
| 65 | 58 |
| 66 gdb_test_no_output "tstart" | 59 gdb_test_no_output "tstart" |
| 67 | 60 }} |
| 68 set pf_prefix $old_pf_prefix | |
| 69 } | |
| 70 | 61 |
| 71 # Verify the sequence of commands "tstart tstart" works well. | 62 # Verify the sequence of commands "tstart tstart" works well. |
| 72 | 63 |
| 73 proc test_tstart_tstart { } { | 64 proc test_tstart_tstart { } { with_test_prefix "tstart_tstart" { |
| 74 global executable | 65 global executable |
| 75 global pf_prefix | |
| 76 global hex | 66 global hex |
| 77 | 67 |
| 78 set old_pf_prefix $pf_prefix | |
| 79 set pf_prefix "$pf_prefix tstart_tstart:" | |
| 80 | |
| 81 # Start with a fresh gdb. | 68 # Start with a fresh gdb. |
| 82 clean_restart ${executable} | 69 clean_restart ${executable} |
| 83 if ![runto_main] { | 70 if ![runto_main] { |
| 84 fail "Can't run to main" | 71 fail "Can't run to main" |
| 85 set pf_prefix $old_pf_prefix | |
| 86 return -1 | 72 return -1 |
| 87 } | 73 } |
| 88 | 74 |
| 89 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | 75 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" |
| 90 gdb_test_no_output "tstart" | 76 gdb_test_no_output "tstart" |
| 91 | 77 |
| 92 gdb_test "tstart" "" "tstart again" "A trace is running already. Start a ne
w run\\? \\(y or n\\) " "y" | 78 gdb_test "tstart" "" "tstart again" "A trace is running already. Start a ne
w run\\? \\(y or n\\) " "y" |
| 93 | 79 }} |
| 94 set pf_prefix $old_pf_prefix | |
| 95 } | |
| 96 | 80 |
| 97 # Verify that trace stops clearly when trace buffer is full. | 81 # Verify that trace stops clearly when trace buffer is full. |
| 98 | 82 |
| 99 proc test_buffer_full_tstart { } { | 83 proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart" { |
| 100 global executable | 84 global executable |
| 101 global pf_prefix | |
| 102 global hex | 85 global hex |
| 103 | 86 |
| 104 set old_pf_prefix $pf_prefix | |
| 105 set pf_prefix "$pf_prefix buffer_full_tstart:" | |
| 106 | |
| 107 # Start with a fresh gdb. | 87 # Start with a fresh gdb. |
| 108 clean_restart ${executable} | 88 clean_restart ${executable} |
| 109 if ![runto_main] { | 89 if ![runto_main] { |
| 110 fail "Can't run to main" | 90 fail "Can't run to main" |
| 111 set pf_prefix $old_pf_prefix | |
| 112 return -1 | 91 return -1 |
| 113 } | 92 } |
| 114 | 93 |
| 115 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*" | 94 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*" |
| 116 gdb_trace_setactions "collect buf: define actions" \ | 95 gdb_trace_setactions "collect buf: define actions" \ |
| 117 "" \ | 96 "" \ |
| 118 "collect buf" "^$" | 97 "collect buf" "^$" |
| 119 | 98 |
| 120 gdb_test_no_output "tstart" | 99 gdb_test_no_output "tstart" |
| 121 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | 100 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" |
| 122 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | 101 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" |
| 123 | 102 |
| 124 gdb_test "tstatus" ".*buffer was full.*" | 103 gdb_test "tstatus" ".*buffer was full.*" |
| 125 gdb_test_no_output "tstart" | 104 gdb_test_no_output "tstart" |
| 126 | 105 }} |
| 127 set old_pf_prefix $pf_prefix | |
| 128 } | |
| 129 | 106 |
| 130 test_tstart_tstop_tstart | 107 test_tstart_tstop_tstart |
| 131 | 108 |
| 132 test_tstart_tstart | 109 test_tstart_tstart |
| 133 | 110 |
| 134 test_buffer_full_tstart | 111 test_buffer_full_tstart |
| OLD | NEW |