1 # Copyright 2012-2013 Free Software Foundation, Inc.
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.
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.
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/>.
16 load_lib trace-support.exp
17 load_lib mi-support.exp
20 standard_testfile tfile.c
21 set executable $testfile
23 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
24 executable {debug nowarnings}] != "" } {
25 untested ${testfile}.exp
29 # Make sure we are starting fresh.
30 remote_file host delete tfile-basic.tf
31 remote_file target delete tfile-basic.tf
33 remote_exec target "$binfile"
34 # Copy tracefile from target to host.
35 remote_download host [remote_upload target tfile-basic.tf] \
38 proc test_tfind_tfile { } {
39 with_test_prefix "tfile" {
46 mi_gdb_load ${binfile}
48 mi_gdb_test "-target-select tfile tfile-basic.tf" \
49 ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
52 mi_gdb_test "tfind 0" \
53 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
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" \
61 mi_gdb_test "tfind end" \
62 ".*=traceframe-changed,end.*\\^done" \
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"
76 # Change to a different test case in order to run it on target, and get
77 # several traceframes.
78 standard_testfile status-stop.c
79 set testfile ${testfile}-1
80 set binfile ${objdir}/${subdir}/${testfile}
81 set executable $testfile
83 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
84 executable {debug nowarnings}] != "" } {
85 untested ${testfile}.exp
89 # Test target supports tracepoints or not.
91 clean_restart $executable
94 fail "Can't run to main to check for trace support"
98 if ![gdb_target_supports_trace] {
99 unsupported "Current target does not support trace"
105 proc test_tfind_remote { } {
106 with_test_prefix "remote" {
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.*" \
119 mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \
120 { "" "disp=\"keep\"" } \
122 mi_gdb_test "-trace-stop" "\\^done.*" "trace stop"
124 mi_gdb_test "tfind 0" \
125 ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
128 mi_gdb_test "tfind" \
129 ".*=traceframe-changed,num=\"1\",tracepoint=\"${decimal}\".*\\^done" \
132 mi_gdb_test "tfind end" \
133 ".*=traceframe-changed,end.*\\^done" \