Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright 2010-2012 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 | ||
23 | load_lib "trace-support.exp"; | |
24 | ||
25 | if [target_info exists gdb,nofileio] { | |
26 | verbose "Skipping tfile.exp because of no fileio capabilities." | |
27 | continue | |
28 | } | |
29 | ||
00bf0b85 SS |
30 | |
31 | gdb_exit | |
32 | gdb_start | |
33 | set testfile "tfile" | |
34 | set srcfile ${testfile}.c | |
35 | set binfile $objdir/$subdir/$testfile | |
36 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
37 | executable {debug nowarnings}] != "" } { | |
3b48433d | 38 | untested ${testfile}.exp |
00bf0b85 SS |
39 | return -1 |
40 | } | |
41 | gdb_reinitialize_dir $srcdir/$subdir | |
42 | ||
43 | # Make sure we are starting fresh. | |
6c28cbf2 SS |
44 | remote_file host delete basic.tf |
45 | remote_file host delete error.tf | |
00bf0b85 SS |
46 | |
47 | gdb_load $binfile | |
48 | ||
49 | runto_main | |
50 | ||
de7ff789 | 51 | gdb_test "break done_making_trace_files" ".*" "" |
00bf0b85 | 52 | |
de7ff789 | 53 | gdb_test "continue" ".*" "" |
00bf0b85 SS |
54 | |
55 | # tsave command would be tested here... | |
56 | ||
de7ff789 | 57 | gdb_test "continue" ".*" "" |
00bf0b85 SS |
58 | |
59 | # Program has presumably exited, now target a trace file it created. | |
60 | ||
61 | gdb_test "target tfile basic.tf" "Created tracepoint.*" "target tfile" | |
62 | ||
63 | gdb_test "info trace" ".*tracepoint.*in write_basic_trace_file.*" \ | |
64 | "info tracepoints on trace file" | |
65 | ||
af54718e SS |
66 | gdb_test "tfind 0" \ |
67 | "Found trace frame 0, tracepoint \[0-9\]+. | |
68 | \#0 write_basic_trace_file ().*" \ | |
69 | "tfind 0 on trace file" | |
00bf0b85 | 70 | |
fce3c1f0 SS |
71 | # Note that there is no tracepoint collecting these globals, we |
72 | # just happen to know they are covered by the trace frame. | |
73 | ||
00bf0b85 SS |
74 | gdb_test "print testglob" " = 31415" "print testglob on trace file" |
75 | ||
fce3c1f0 SS |
76 | gdb_test "print testglob2" " = 271828" "print testglob2 on trace file" |
77 | ||
78 | gdb_test "print constglob" " = 10000" "print constglob on trace file" | |
79 | ||
00bf0b85 SS |
80 | gdb_test "tfind" "Target failed to find requested trace frame." \ |
81 | "tfind does not find a second frame in trace file" | |
82 | ||
83 | gdb_test "tstatus" \ | |
84 | "Using a trace file.* | |
85 | Trace stopped by a tstop command.* | |
4daf5ac0 SS |
86 | Collected 1 trace frame.* |
87 | Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).* | |
00bf0b85 SS |
88 | Looking at trace frame 0, tracepoint .*" \ |
89 | "tstatus on trace file" | |
90 | ||
ffd5ec24 PA |
91 | gdb_test "tfind end" "No longer looking at any trace frame" "leave tfind mode" |
92 | ||
93 | gdb_test "backtrace" "No stack\." \ | |
94 | "no stack if no traceframe selected" | |
95 | ||
96 | gdb_test "info registers" "The program has no registers now\." \ | |
97 | "no registers if no traceframe selected" | |
98 | ||
6c28cbf2 | 99 | # Now start afresh, using only a trace file. |
00bf0b85 | 100 | |
6c28cbf2 SS |
101 | gdb_exit |
102 | gdb_start | |
00bf0b85 | 103 | |
6c28cbf2 | 104 | gdb_load $binfile |
00bf0b85 | 105 | |
6c28cbf2 | 106 | gdb_test "target tfile error.tf" "Created tracepoint.*" "target tfile" |
00bf0b85 | 107 | |
6c28cbf2 SS |
108 | gdb_test "tstatus" \ |
109 | "Using a trace file.* | |
110 | Trace stopped by an error \\(made-up error, tracepoint 1\\).* | |
111 | Collected 0 trace frame.* | |
112 | Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).* | |
113 | Not looking at any trace frame.*" \ | |
114 | "tstatus on error trace file" | |
c91c8c16 PA |
115 | |
116 | # Make sure we can reopen without error. | |
117 | gdb_test \ | |
118 | "interpreter-exec mi \"-target-select tfile basic.tf\"" \ | |
119 | "\\^connected.*" |