]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/passc-dyn.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / passc-dyn.exp
CommitLineData
6aba47ca 1# Copyright 1998, 2005, 2007 Free Software Foundation, Inc.
c906108c
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 2 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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Michael Snyder (msnyder@cygnus.com)
21
22load_lib "trace-support.exp";
23
24if $tracelevel then {
25 strace $tracelevel
26}
27
28set prms_id 0
29set bug_id 0
30
31gdb_exit
32gdb_start
33if [istarget "m68k-*-elf"] then {
34 load_lib "emc-support.exp";
35 set srcfile gdb_c_test.c
36 set binfile [board_info target d490_binfile];
37 gdb_test "set remotetimeout 6" "" ""
38 set timeout 500
39 gdb_target_monitor $binfile
40 # Give a TSTOP and ignore errors, to make sure any previous trace is off
41 gdb_test "tstop" "" ""
42 gdb_test "tfind none" "" ""
43 send_gdb "compare-sections CS\n"
44 gdb_expect {
45 -re "MIS-MATCHED.*$gdb_prompt $" {
b60f0898
JB
46 untested passc-dyn.exp
47 return -1
c906108c
SS
48 all tests in this module will fail.";
49 }
50 -re ".*$gdb_prompt $" { }
51 }
52} else {
53 set testfile "actions"
54 set srcfile ${testfile}.c
55 set binfile $objdir/$subdir/$testfile
56 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
fc91c6c2 57 executable {debug nowarnings}] != "" } {
b60f0898
JB
58 untested passc-dyn.exp
59 return -1
c906108c
SS
60 }
61 gdb_load $binfile
62 gdb_test "tstop" "" ""
63 gdb_test "tfind none" "" ""
64 runto_main
65}
66gdb_reinitialize_dir $srcdir/$subdir
67
68# We generously give ourselves one "pass" if we successfully
69# detect that this test cannot be run on this target!
70if { ![gdb_target_supports_trace] } then {
5f579bc5 71 pass "Current target does not support trace"
c906108c
SS
72 return 1;
73
74}
75
76# If testing on a remote host, download the source file.
77# remote_download host $srcdir/$subdir/$srcfile
78
79
80#
81# test passcount dynamically (live target)
82#
83
84set baseline [gdb_find_recursion_test_baseline $srcfile];
85
86if { $baseline == -1 } then {
87 fail "Could not find gdb_recursion_test function"
88 return;
89}
90
91# define relative source line numbers:
92# all subsequent line numbers are relative to this first one (baseline)
93
94set testline2 [expr $baseline + 4]
95set testline3 [expr $baseline + 5]
96set testline4 [expr $baseline + 6]
97
98#
99# test passcount command semantics (live test)
100#
101
102## Set three tracepoints with three different passcounts.
103## Verify that the experiment stops after the one with the
104## lowest passcount is hit.
105
106gdb_delete_tracepoints
107set tdp2 [gdb_gettpnum "$testline2"]
108set tdp3 [gdb_gettpnum "$testline3"]
109set tdp4 [gdb_gettpnum "$testline4"]
110if { $tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0 } then {
111 fail "setting tracepoints"
112 return;
113}
114
115gdb_test "passcount 4 $tdp2" "Setting tracepoint $tdp2's passcount to 4" \
116 "4.5: set passcount for tracepoint $tdp2"
117gdb_test "passcount 2 $tdp3" "Setting tracepoint $tdp3's passcount to 2" \
118 "4.5: set passcount for tracepoint $tdp3"
119gdb_test "passcount 3 $tdp4" "Setting tracepoint $tdp4's passcount to 3" \
120 "4.5: set passcount for tracepoint $tdp4"
121
122gdb_test "tstart" "" ""
123
124if [istarget "m68k-*-elf"] then {
125 gdb_emclaptop_command "85,1,2,3,4,5,6"
126 sleep 5
127 gdb_emclaptop_command "85,7,8,9,A,B,C"
128 sleep 5
129 gdb_emclaptop_command "85,D,E,F,10,11,12"
130 sleep 5
131 # gdb_test "tstop"
132 ##
133 ## Note! Must NOT give the tstop command, because the passcount
134 ## has already stopped the experiment. You would not
135 ## think this would be an error, but in EMC's mind it is...
136 ##
137} else {
138 gdb_test "break end" "" ""
139 gdb_test "continue" \
140 "Continuing.*Breakpoint $decimal, end.*" \
141 "run trace experiment"
142 gdb_test "tstop" "" ""
143}
144
145gdb_test "tfind none" "" ""
146if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] {
b60f0898
JB
147 untested passc-dyn.exp
148 return -1
c906108c
SS
149}
150
151gdb_test "tfind tracepoint $tdp2" "" ""
152if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] {
b60f0898
JB
153 untested passc-dyn.exp
154 return -1
c906108c
SS
155}
156
157gdb_test "tfind tracepoint $tdp3" "" ""
158if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] {
b60f0898
JB
159 untested passc-dyn.exp
160 return -1
c906108c
SS
161}
162
163gdb_test "tfind tracepoint $tdp4" "" ""
164if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] {
b60f0898
JB
165 untested passc-dyn.exp
166 return -1
c906108c
SS
167}
168
169gdb_test "tfind tracepoint $tdp2" "" ""
170if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] {
b60f0898
JB
171 untested passc-dyn.exp
172 return -1
c906108c
SS
173}
174
175gdb_test "tfind tracepoint $tdp3" "" ""
176if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] {
b60f0898
JB
177 untested passc-dyn.exp
178 return -1
c906108c
SS
179}
180
181## We should now be at the last frame, because this frame's passcount
182## should have caused collection to stop. If we do a tfind now,
183## it should fail.
184
185gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test"
186
187# Finished!
188gdb_test "tfind none" "" ""
189