1# Copyright 2014-2015 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. 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 15load_lib "trace-support.exp" 16 17standard_testfile read-memory.c 18set executable $testfile 19 20if [prepare_for_testing "failed to prepare for trace tests" \ 21 $executable $srcfile [list debug]] { 22 return -1 23} 24 25if ![runto_main] { 26 fail "Can't run to main to check for trace support" 27 return -1 28} 29 30if ![gdb_target_supports_trace] { 31 unsupported "target does not support trace" 32 return -1 33} 34 35gdb_test "trace start" ".*" 36gdb_breakpoint "end" 37 38gdb_test_no_output "tstart" 39 40gdb_test "continue" ".*Breakpoint \[0-9\]+, end .*" 41 42set tracefile [standard_output_file ${testfile}] 43 44# Save trace frames to tfile. 45gdb_test "tsave ${tracefile}.tf" \ 46 "Trace data saved to file '${tracefile}.tf'.*" \ 47 "save tfile trace file" 48 49# Change target to tfile. 50set test "change to tfile target" 51gdb_test_multiple "target tfile ${tracefile}.tf" "$test" { 52 -re "A program is being debugged already. Kill it. .y or n. " { 53 send_gdb "y\n" 54 exp_continue 55 } 56 -re "$gdb_prompt $" { 57 pass "$test" 58 } 59} 60 61gdb_test "tfind 0" "Found trace frame 0, tracepoint .*" 62 63gdb_test "interpreter-exec mi \"-trace-find frame-number 0\"" "done.*" 64