]>
Commit | Line | Data |
---|---|---|
8acc9f48 | 1 | # Copyright 2011-2013 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 | ||
497a5eb0 | 17 | standard_testfile |
4511b1ba | 18 | set executable $testfile |
4511b1ba YQ |
19 | set expfile $testfile.exp |
20 | ||
21 | ||
22 | if [prepare_for_testing $expfile $executable $srcfile \ | |
23 | {debug nowarnings}] { | |
24 | untested "failed to prepare for trace tests" | |
25 | return -1 | |
26 | } | |
27 | ||
ff7d1690 YQ |
28 | if ![runto_main] { |
29 | fail "Can't run to main to check for trace support" | |
30 | return -1 | |
31 | } | |
32 | ||
33 | if ![gdb_target_supports_trace] { | |
34 | unsupported "target does not support trace" | |
35 | return -1; | |
36 | } | |
37 | ||
4511b1ba YQ |
38 | # Verify that the sequence of commands "tstart tstop tstart" works well. |
39 | ||
0f4d39d5 | 40 | proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart" { |
4511b1ba | 41 | global executable |
4511b1ba YQ |
42 | global hex |
43 | ||
4511b1ba YQ |
44 | # Start with a fresh gdb. |
45 | clean_restart ${executable} | |
46 | if ![runto_main] { | |
47 | fail "Can't run to main" | |
4511b1ba YQ |
48 | return -1 |
49 | } | |
50 | ||
51 | gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | |
52 | gdb_test_no_output "tstart" | |
53 | ||
54 | gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | |
55 | gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | |
56 | ||
57 | gdb_test_no_output "tstop" | |
58 | ||
59 | gdb_test_no_output "tstart" | |
6a5870ce | 60 | }} |
4511b1ba YQ |
61 | |
62 | # Verify the sequence of commands "tstart tstart" works well. | |
63 | ||
0f4d39d5 | 64 | proc test_tstart_tstart { } { with_test_prefix "tstart_tstart" { |
4511b1ba | 65 | global executable |
4511b1ba YQ |
66 | global hex |
67 | ||
4511b1ba YQ |
68 | # Start with a fresh gdb. |
69 | clean_restart ${executable} | |
70 | if ![runto_main] { | |
71 | fail "Can't run to main" | |
4511b1ba YQ |
72 | return -1 |
73 | } | |
74 | ||
75 | gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*" | |
76 | gdb_test_no_output "tstart" | |
77 | ||
78 | gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y" | |
6a5870ce | 79 | }} |
4511b1ba YQ |
80 | |
81 | # Verify that trace stops clearly when trace buffer is full. | |
82 | ||
0f4d39d5 | 83 | proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart" { |
4511b1ba | 84 | global executable |
4511b1ba YQ |
85 | global hex |
86 | ||
4511b1ba YQ |
87 | # Start with a fresh gdb. |
88 | clean_restart ${executable} | |
89 | if ![runto_main] { | |
90 | fail "Can't run to main" | |
4511b1ba YQ |
91 | return -1 |
92 | } | |
93 | ||
94 | gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*" | |
95 | gdb_trace_setactions "collect buf: define actions" \ | |
96 | "" \ | |
97 | "collect buf" "^$" | |
98 | ||
99 | gdb_test_no_output "tstart" | |
100 | gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*" | |
101 | gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | |
102 | ||
103 | gdb_test "tstatus" ".*buffer was full.*" | |
104 | gdb_test_no_output "tstart" | |
6a5870ce | 105 | }} |
4511b1ba YQ |
106 | |
107 | test_tstart_tstop_tstart | |
108 | ||
109 | test_tstart_tstart | |
110 | ||
6a5870ce | 111 | test_buffer_full_tstart |