Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright 2011-2012 Free Software Foundation, Inc. |
4511b1ba YQ |
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 | |
4 | # the Free Software Foundation; either version 3 of the License, or | |
5 | # (at your option) any later version. | |
6 | # | |
7 | # This program is distributed in the hope that it will be useful, | |
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | # GNU General Public License for more details. | |
11 | # | |
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/>. | |
14 | ||
15 | load_lib "trace-support.exp"; | |
16 | ||
17 | set testfile "status-stop" | |
18 | set executable $testfile | |
19 | set srcfile ${testfile}.c | |
20 | set binfile $objdir/$subdir/$testfile | |
21 | set expfile $testfile.exp | |
22 | ||
23 | ||
24 | if [prepare_for_testing $expfile $executable $srcfile \ | |
25 | {debug nowarnings}] { | |
26 | untested "failed to prepare for trace tests" | |
27 | return -1 | |
28 | } | |
29 | ||
ff7d1690 YQ |
30 | if ![runto_main] { |
31 | fail "Can't run to main to check for trace support" | |
32 | return -1 | |
33 | } | |
34 | ||
35 | if ![gdb_target_supports_trace] { | |
36 | unsupported "target does not support trace" | |
37 | return -1; | |
38 | } | |
39 | ||
4511b1ba YQ |
40 | # Verify that the sequence of commands "tstart tstop tstart" works well. |
41 | ||
0f4d39d5 | 42 | proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart" { |
4511b1ba | 43 | global executable |
4511b1ba YQ |
44 | global hex |
45 | ||
4511b1ba YQ |
46 | # Start with a fresh gdb. |
47 | clean_restart ${executable} | |
48 | if ![runto_main] { | |
49 | fail "Can't run to main" | |
4511b1ba YQ |
50 | return -1 |
51 | } | |
52 | ||
53 | gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | |
54 | gdb_test_no_output "tstart" | |
55 | ||
56 | gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | |
57 | gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | |
58 | ||
59 | gdb_test_no_output "tstop" | |
60 | ||
61 | gdb_test_no_output "tstart" | |
6a5870ce | 62 | }} |
4511b1ba YQ |
63 | |
64 | # Verify the sequence of commands "tstart tstart" works well. | |
65 | ||
0f4d39d5 | 66 | proc test_tstart_tstart { } { with_test_prefix "tstart_tstart" { |
4511b1ba | 67 | global executable |
4511b1ba YQ |
68 | global hex |
69 | ||
4511b1ba YQ |
70 | # Start with a fresh gdb. |
71 | clean_restart ${executable} | |
72 | if ![runto_main] { | |
73 | fail "Can't run to main" | |
4511b1ba YQ |
74 | return -1 |
75 | } | |
76 | ||
77 | gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | |
78 | gdb_test_no_output "tstart" | |
79 | ||
80 | gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y" | |
6a5870ce | 81 | }} |
4511b1ba YQ |
82 | |
83 | # Verify that trace stops clearly when trace buffer is full. | |
84 | ||
0f4d39d5 | 85 | proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart" { |
4511b1ba | 86 | global executable |
4511b1ba YQ |
87 | global hex |
88 | ||
4511b1ba YQ |
89 | # Start with a fresh gdb. |
90 | clean_restart ${executable} | |
91 | if ![runto_main] { | |
92 | fail "Can't run to main" | |
4511b1ba YQ |
93 | return -1 |
94 | } | |
95 | ||
96 | gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*" | |
97 | gdb_trace_setactions "collect buf: define actions" \ | |
98 | "" \ | |
99 | "collect buf" "^$" | |
100 | ||
101 | gdb_test_no_output "tstart" | |
102 | gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | |
103 | gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | |
104 | ||
105 | gdb_test "tstatus" ".*buffer was full.*" | |
106 | gdb_test_no_output "tstart" | |
6a5870ce | 107 | }} |
4511b1ba YQ |
108 | |
109 | test_tstart_tstop_tstart | |
110 | ||
111 | test_tstart_tstart | |
112 | ||
6a5870ce | 113 | test_buffer_full_tstart |