gdb.trace/tfile.c: Remove Thumb bit in one more more, general cleanup
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / tfile.exp
CommitLineData
ecd75fc8 1# Copyright 2010-2014 Free Software Foundation, Inc.
00bf0b85
SS
2#
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.
7#
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.
12#
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/>.
15
16# Test of trace file support.
17
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.
22
4ec70201 23load_lib "trace-support.exp"
00bf0b85 24
32cfb09d
TT
25if {![is_remote host] && ![is_remote target]} {
26 set tfile_basic [standard_output_file tfile-basic.tf]
27 set tfile_error [standard_output_file tfile-error.tf]
28 set tfile_dir [file dirname $tfile_basic]/
29 set purely_local 1
30} else {
31 set tfile_basic tfile-basic.tf
32 set tfile_error tfile-error.tf
33 set tfile_dir ""
34 set purely_local 0
35}
36
497a5eb0 37standard_testfile
00bf0b85 38if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
32cfb09d 39 executable \
1b5d0ab3 40 [list debug \
32cfb09d
TT
41 "additional_flags=-DTFILE_DIR=\"$tfile_dir\""]] \
42 != "" } {
3b48433d 43 untested ${testfile}.exp
00bf0b85
SS
44 return -1
45}
00bf0b85
SS
46
47# Make sure we are starting fresh.
32cfb09d
TT
48remote_file host delete $tfile_basic
49remote_file host delete $tfile_error
50remote_file target delete $tfile_basic
51remote_file target delete $tfile_error
00bf0b85 52
b4429ea2
YQ
53if { ![generate_tracefile $binfile] } {
54 unsupported "Unable to generate trace file"
55}
56
32cfb09d
TT
57if {!$purely_local} {
58 # Copy tracefile from target to host through build.
59 remote_download host [remote_upload target tfile-basic.tf] tfile-basic.tf
60 remote_download host [remote_upload target tfile-error.tf] tfile-error.tf
61}
00bf0b85 62
b4429ea2 63clean_restart $binfile
00bf0b85
SS
64
65# Program has presumably exited, now target a trace file it created.
66
32cfb09d
TT
67gdb_test "target tfile $tfile_basic" "Created tracepoint.*" \
68 "target tfile [file tail $tfile_basic]"
00bf0b85
SS
69
70gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \
71 "info tracepoints on trace file"
72
af54718e
SS
73gdb_test "tfind 0" \
74 "Found trace frame 0, tracepoint \[0-9\]+.
75\#0 write_basic_trace_file ().*" \
76 "tfind 0 on trace file"
00bf0b85 77
fce3c1f0
SS
78# Note that there is no tracepoint collecting these globals, we
79# just happen to know they are covered by the trace frame.
80
00bf0b85
SS
81gdb_test "print testglob" " = 31415" "print testglob on trace file"
82
fce3c1f0
SS
83gdb_test "print testglob2" " = 271828" "print testglob2 on trace file"
84
3f1175a9
PA
85# This global is not covered by the trace frame, but since it's const,
86# we should be able to read it from the executable.
87
fce3c1f0
SS
88gdb_test "print constglob" " = 10000" "print constglob on trace file"
89
3f1175a9
PA
90# Similarly, disassembly should find the read-only pieces in the executable.
91gdb_test "disassemble main" \
92 "Dump of assembler code for function main:.* $hex <\\+0\\>:.*End of assembler dump\."
93
94# This global is also not covered by the trace frame, and since it's
95# non-const, we should _not_ read it from the executable, as that
96# would show the variable's initial value, not the current at time the
97# trace frame was created.
98
99gdb_test "print nonconstglob" \
100 " = <unavailable>" "print nonconstglob on trace file"
101
00bf0b85
SS
102gdb_test "tfind" "Target failed to find requested trace frame." \
103 "tfind does not find a second frame in trace file"
104
105gdb_test "tstatus" \
106 "Using a trace file.*
107Trace stopped by a tstop command.*
4daf5ac0
SS
108Collected 1 trace frame.*
109Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).*
00bf0b85
SS
110Looking at trace frame 0, tracepoint .*" \
111 "tstatus on trace file"
112
ffd5ec24
PA
113gdb_test "tfind end" "No longer looking at any trace frame" "leave tfind mode"
114
115gdb_test "backtrace" "No stack\." \
116 "no stack if no traceframe selected"
117
118gdb_test "info registers" "The program has no registers now\." \
119 "no registers if no traceframe selected"
120
6c28cbf2 121# Now start afresh, using only a trace file.
00bf0b85 122
6c28cbf2
SS
123gdb_exit
124gdb_start
00bf0b85 125
6c28cbf2 126gdb_load $binfile
00bf0b85 127
32cfb09d
TT
128gdb_test "target tfile $tfile_error" "Created tracepoint.*" \
129 "target tfile [file tail $tfile_error]"
00bf0b85 130
6c28cbf2
SS
131gdb_test "tstatus" \
132 "Using a trace file.*
133Trace stopped by an error \\(made-up error, tracepoint 1\\).*
134Collected 0 trace frame.*
135Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).*
136Not looking at any trace frame.*" \
137 "tstatus on error trace file"
c91c8c16
PA
138
139# Make sure we can reopen without error.
140gdb_test \
32cfb09d
TT
141 "interpreter-exec mi \"-target-select tfile $tfile_basic\"" \
142 "\\^connected.*" \
143 "interpreter-exec mi \"-target-select tfile tfile-basic.tf\""
f5911ea1
HAQ
144
145gdb_test "interpreter-exec mi \"-trace-status\"" \
32cfb09d 146 "\\^done,supported=\"file\",trace-file=\".*$tfile_basic\",running=\"0\",stop-reason=\"request\",frames=\"${decimal}\",frames-created=\"${decimal}\",buffer-size=\"${decimal}\",buffer-free=\"${decimal}\",disconnected=\".*\",circular=\".*\",user-name=\"\",notes=\"\",start-time=\".*\",stop-time=\".*\"" \
f5911ea1 147 "-trace-status"
9852c492
YQ
148
149# Test completion works well.
150
0d4d0e77
YQ
151if { [readline_is_used] } {
152 gdb_test "target tfile [file rootname $tfile_basic]\t" \
153 "Assuming tracepoint.*" \
154 "complete-command 'target tfile'"
155}
This page took 0.551871 seconds and 4 git commands to generate.