daily update
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / mi-traceframe-changed.exp
CommitLineData
8acc9f48 1# Copyright 2012-2013 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
23if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
24 executable {debug nowarnings}] != "" } {
25 untested ${testfile}.exp
26 return -1
27}
28
29# Make sure we are starting fresh.
3758b5ce
YQ
30remote_file host delete tfile-basic.tf
31remote_file target delete tfile-basic.tf
201b4506
YQ
32
33remote_exec target "$binfile"
34# Copy tracefile from target to host.
3758b5ce
YQ
35remote_download host [remote_upload target tfile-basic.tf] \
36 tfile-basic.tf
201b4506 37
0a251e08
YQ
38proc test_tfind_tfile { } {
39 with_test_prefix "tfile" {
40 global binfile
41 global decimal
42
43 if [mi_gdb_start] {
44 return
45 }
46 mi_gdb_load ${binfile}
47
3758b5ce 48 mi_gdb_test "-target-select tfile tfile-basic.tf" \
0a251e08
YQ
49 ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
50 "select trace file"
51
52 mi_gdb_test "tfind 0" \
53 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
54 "tfind 0"
55
56 # No MI notification is sent because traceframe is not changed.
57 mi_gdb_test "tfind 0" \
58 "\\&\"tfind 0\\\\n\"\r\n\~\"Found.*\\^done" \
59 "tfind 0 again"
60
61 mi_gdb_test "tfind end" \
62 ".*=traceframe-changed,end.*\\^done" \
63 "tfind end"
64
65 # No MI notification is send because request is from MI command.
66 mi_gdb_test "-trace-find frame-number 0" \
67 "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
68 "-trace-find frame-number 0"
69
70 mi_gdb_exit
201b4506 71 }
0a251e08 72}
201b4506
YQ
73
74test_tfind_tfile
75
76# Change to a different test case in order to run it on target, and get
77# several traceframes.
78standard_testfile status-stop.c
79set testfile ${testfile}-1
80set binfile ${objdir}/${subdir}/${testfile}
81set executable $testfile
82
83if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
84 executable {debug nowarnings}] != "" } {
85 untested ${testfile}.exp
86 return -1
87}
88
89# Test target supports tracepoints or not.
90
91clean_restart $executable
92
93if ![runto_main] {
94 fail "Can't run to main to check for trace support"
95 return -1
96}
97
98if ![gdb_target_supports_trace] {
99 unsupported "Current target does not support trace"
ae59b1da 100 return -1
201b4506
YQ
101}
102
103gdb_exit
104
0a251e08
YQ
105proc test_tfind_remote { } {
106 with_test_prefix "remote" {
107 global decimal
201b4506 108
0a251e08
YQ
109 if [mi_gdb_start] {
110 return
111 }
112 mi_run_to_main
201b4506 113
0a251e08
YQ
114 mi_gdb_test "-break-insert end" "\\^done.*" "break end"
115 mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2"
116 mi_gdb_test "-trace-start" "=breakpoint-modified,bkpt={.*installed=\"y\".*}.*\\^done.*" \
117 "trace start"
201b4506 118
0a251e08
YQ
119 mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \
120 { "" "disp=\"keep\"" } \
121 "continue to end"
122 mi_gdb_test "-trace-stop" "\\^done.*" "trace stop"
201b4506 123
0a251e08
YQ
124 mi_gdb_test "tfind 0" \
125 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
126 "tfind 0"
201b4506 127
0a251e08
YQ
128 mi_gdb_test "tfind" \
129 ".*=traceframe-changed,num=\"1\",tracepoint=\"${decimal}\".*\\^done" \
130 "tfind"
201b4506 131
0a251e08
YQ
132 mi_gdb_test "tfind end" \
133 ".*=traceframe-changed,end.*\\^done" \
134 "tfind end"
201b4506 135
0a251e08
YQ
136 mi_gdb_exit
137 }
138}
201b4506
YQ
139
140test_tfind_remote
141
142return 0
This page took 0.126601 seconds and 4 git commands to generate.