gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / disconnected-tracing.exp
CommitLineData
8acc9f48 1# Copyright 2012-2013 Free Software Foundation, Inc.
c772f8e7
HZ
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 disconnected-tracing.
17
18load_lib "trace-support.exp";
19
497a5eb0 20standard_testfile
61e44cfa 21set executable $testfile
c772f8e7
HZ
22set expfile $testfile.exp
23set gdbserver_reconnect_p 1
24
25if { [info proc gdb_reconnect] == "" } {
26 unsupported "target does not support reconnect"
27 return -1
28}
29
30if [prepare_for_testing $expfile $executable $srcfile \
31 {debug nowarnings}] {
32 untested "failed to prepare for trace tests"
33 return -1
34}
35
36if ![runto_main] {
37 fail "can't run to main to check for trace support"
38 return -1
39}
40
41if ![gdb_target_supports_trace] {
42 unsupported "target does not support trace"
43 return -1;
44}
45
8d735b87 46# Disconnect in tracing.
c772f8e7 47
8d735b87
YQ
48proc disconnected_tracing { } { with_test_prefix "trace" {
49 global executable
c772f8e7 50
8d735b87
YQ
51 # Start with a fresh gdb.
52 clean_restart ${executable}
53 if ![runto_main] {
54 fail "Can't run to main"
55 return -1
56 }
57
58 gdb_test_no_output "set confirm off"
59 gdb_test_no_output "set disconnected-tracing on"
60 gdb_test "trace main" ".*"
61 gdb_test_no_output "tstart"
62
63 gdb_test "info tracepoints" ".*in main at.*" "first info tracepoints"
64
65 gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
66 if { [gdb_reconnect] == 0 } {
67 pass "first reconnect after unload"
68 } else {
69 fail "first reconnect after unload"
70 return 0
71 }
72 gdb_test "info tracepoints" ".*in main at.*" "second info tracepoints"
73
74 delete_breakpoints
75 gdb_test "info tracepoints" ".*No tracepoints..*" "third info tracepoints"
76
77 gdb_test "disconnect" "Ending remote debugging\\." "second disconnect"
78 if { [gdb_reconnect] == 0 } {
79 pass "second reconnect after unload"
80 } else {
81 fail "second reconnect after unload"
82 return 0
83 }
84 gdb_test "info tracepoints" ".*in main at.*" "fourth info tracepoints"
85}}
86
87disconnected_tracing
88
89# Disconnected in tfind
90
91proc disconnected_tfind { } { with_test_prefix "tfind" {
92 global executable
93 global decimal
94
95 # Start with a fresh gdb.
96 clean_restart ${executable}
97 if ![runto_main] {
98 fail "Can't run to main"
99 return -1
100 }
101
102 gdb_test_no_output "set confirm off"
103 gdb_test_no_output "set disconnected-tracing on"
104 gdb_test "trace start" ".*"
105 gdb_test_no_output "tstart"
106
107 gdb_test "break end" "Breakpoint ${decimal} at .*"
108 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
109 gdb_test_no_output "tstop"
110
111 gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
112 gdb_test "p \$trace_frame" ".*\\\$${decimal} = 0.*" \
113 "p \$trace_frame before disconnected"
114 gdb_test "p \$tracepoint" ".*\\\$${decimal} = 2.*" \
115 "p \$tracepoint before disconnected"
116
117 gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
118
119 gdb_test "p \$trace_frame" ".*\\\$${decimal} = -1.*"
120 gdb_test "p \$tracepoint" ".*\\\$${decimal} = -1.*"
121 gdb_test "p \$trace_line" ".*\\\$${decimal} = -1.*"
122 gdb_test "p \$trace_file" ".*\\\$${decimal} = void.*"
123 gdb_test "p \$trace_func" ".*\\\$${decimal} = void.*"
124}}
c772f8e7 125
8d735b87 126disconnected_tfind
This page took 0.102434 seconds and 4 git commands to generate.