1 # Copyright 2010 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 # Test of trace file support.
18 # Note that unlike most of the tracing tests, this can be run on
19 # targets lacking tracepoint support; the program tfile.c has the
20 # ability to generate synthetic trace files directly, and the tfile
21 # target is available to all GDB configs.
23 load_lib "trace-support.exp";
25 if [target_info exists gdb,nofileio] {
26 verbose "Skipping tfile.exp because of no fileio capabilities."
40 set srcfile ${testfile}.c
41 set binfile $objdir/$subdir/$testfile
42 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
43 executable {debug nowarnings}] != "" } {
47 gdb_reinitialize_dir $srcdir/$subdir
49 # Make sure we are starting fresh.
50 remote_file host delete basic.tf
51 remote_file host delete error.tf
57 gdb_test "break done_making_trace_files" "" ""
59 gdb_test "continue" "" ""
61 # tsave command would be tested here...
63 gdb_test "continue" "" ""
65 # Program has presumably exited, now target a trace file it created.
67 gdb_test "target tfile basic.tf" "Created tracepoint.*" "target tfile"
69 gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
70 "info tracepoints on trace file"
73 "Found trace frame 0, tracepoint \[0-9\]+.
74 \#0 write_basic_trace_file ().*" \
75 "tfind 0 on trace file"
77 gdb_test "print testglob" " = 31415" "print testglob on trace file"
79 gdb_test "tfind" "Target failed to find requested trace frame." \
80 "tfind does not find a second frame in trace file"
84 Trace stopped by a tstop command.*
85 Collected 1 trace frame.*
86 Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).*
87 Looking at trace frame 0, tracepoint .*" \
88 "tstatus on trace file"
90 # Now start afresh, using only a trace file.
97 gdb_test "target tfile error.tf" "Created tracepoint.*" "target tfile"
100 "Using a trace file.*
101 Trace stopped by an error \\(made-up error, tracepoint 1\\).*
102 Collected 0 trace frame.*
103 Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).*
104 Not looking at any trace frame.*" \
105 "tstatus on error trace file"