1 # Copyright 2014-2020 Free Software Foundation, Inc.
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.
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.
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/>.
15 load_lib "trace-support.exp"
17 standard_testfile read-memory.c
18 set executable $testfile
20 if [prepare_for_testing "failed to prepare for trace tests" \
21 $executable $srcfile [list debug]] {
26 fail "can't run to main to check for trace support"
30 if ![gdb_target_supports_trace] {
31 unsupported "target does not support trace"
35 gdb_test "trace start" ".*"
38 gdb_test_no_output "tstart"
40 gdb_test "continue" ".*Breakpoint \[0-9\]+, end .*"
42 set tracefile [standard_output_file ${testfile}]
44 # Save trace frames to tfile.
45 gdb_test "tsave ${tracefile}.tf" \
46 "Trace data saved to file '${tracefile}.tf'.*" \
47 "save tfile trace file"
49 # Change target to tfile.
50 set test "change to tfile target"
51 gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
52 -re "A program is being debugged already. Kill it. .y or n. " {
61 gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
63 gdb_test "interpreter-exec mi \"-trace-find frame-number 0\"" "done.*"