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