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