]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
Update Copyright year range in all files maintained by GDB.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / mi-traceframe-changed.exp
CommitLineData
ecd75fc8 1# Copyright 2012-2014 Free Software Foundation, Inc.
201b4506
YQ
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16load_lib trace-support.exp
17load_lib mi-support.exp
18set MIFLAGS "-i=mi"
19
20standard_testfile tfile.c
21set executable $testfile
22
32cfb09d
TT
23if {![is_remote host] && ![is_remote target]} {
24 set tfile_basic [standard_output_file tfile-basic.tf]
25 set tfile_dir [file dirname $tfile_basic]/
26 set purely_local 1
27} else {
28 set tfile_basic tfile-basic.tf
29 set tfile_dir ""
30 set purely_local 0
31}
32
201b4506 33if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
32cfb09d
TT
34 executable \
35 [list debug nowarnings \
36 "additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
37 != "" } {
201b4506
YQ
38 untested ${testfile}.exp
39 return -1
40}
41
42# Make sure we are starting fresh.
32cfb09d
TT
43remote_file host delete $tfile_basic
44remote_file target delete $tfile_basic
201b4506
YQ
45
46remote_exec target "$binfile"
32cfb09d
TT
47
48if {!$purely_local} {
49 # Copy tracefile from target to host.
50 remote_download host [remote_upload target tfile-basic.tf] \
51 tfile-basic.tf
52}
201b4506 53
0a251e08
YQ
54proc test_tfind_tfile { } {
55 with_test_prefix "tfile" {
56 global binfile
57 global decimal
32cfb09d 58 global tfile_basic
0a251e08
YQ
59
60 if [mi_gdb_start] {
61 return
62 }
63 mi_gdb_load ${binfile}
64
32cfb09d 65 mi_gdb_test "-target-select tfile ${tfile_basic}" \
0a251e08
YQ
66 ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
67 "select trace file"
68
69 mi_gdb_test "tfind 0" \
70 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
71 "tfind 0"
72
73 # No MI notification is sent because traceframe is not changed.
74 mi_gdb_test "tfind 0" \
75 "\\&\"tfind 0\\\\n\"\r\n\~\"Found.*\\^done" \
76 "tfind 0 again"
77
78 mi_gdb_test "tfind end" \
79 ".*=traceframe-changed,end.*\\^done" \
80 "tfind end"
81
82 # No MI notification is send because request is from MI command.
83 mi_gdb_test "-trace-find frame-number 0" \
84 "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
85 "-trace-find frame-number 0"
86
87 mi_gdb_exit
201b4506 88 }
0a251e08 89}
201b4506
YQ
90
91test_tfind_tfile
92
93# Change to a different test case in order to run it on target, and get
94# several traceframes.
95standard_testfile status-stop.c
20e3d738
TT
96append testfile -1
97append binfile -1
201b4506
YQ
98set executable $testfile
99
100if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
101 executable {debug nowarnings}] != "" } {
102 untested ${testfile}.exp
103 return -1
104}
105
106# Test target supports tracepoints or not.
107
108clean_restart $executable
109
110if ![runto_main] {
111 fail "Can't run to main to check for trace support"
112 return -1
113}
114
115if ![gdb_target_supports_trace] {
116 unsupported "Current target does not support trace"
ae59b1da 117 return -1
201b4506
YQ
118}
119
120gdb_exit
121
0a251e08
YQ
122proc test_tfind_remote { } {
123 with_test_prefix "remote" {
124 global decimal
201b4506 125
0a251e08
YQ
126 if [mi_gdb_start] {
127 return
128 }
129 mi_run_to_main
201b4506 130
0a251e08
YQ
131 mi_gdb_test "-break-insert end" "\\^done.*" "break end"
132 mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2"
133 mi_gdb_test "-trace-start" "=breakpoint-modified,bkpt={.*installed=\"y\".*}.*\\^done.*" \
134 "trace start"
201b4506 135
0a251e08
YQ
136 mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \
137 { "" "disp=\"keep\"" } \
138 "continue to end"
139 mi_gdb_test "-trace-stop" "\\^done.*" "trace stop"
201b4506 140
0a251e08
YQ
141 mi_gdb_test "tfind 0" \
142 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
143 "tfind 0"
201b4506 144
0a251e08
YQ
145 mi_gdb_test "tfind" \
146 ".*=traceframe-changed,num=\"1\",tracepoint=\"${decimal}\".*\\^done" \
147 "tfind"
201b4506 148
0a251e08
YQ
149 mi_gdb_test "tfind end" \
150 ".*=traceframe-changed,end.*\\^done" \
151 "tfind end"
201b4506 152
0a251e08
YQ
153 mi_gdb_exit
154 }
155}
201b4506
YQ
156
157test_tfind_remote
158
159return 0