]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/passc-dyn.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / passc-dyn.exp
CommitLineData
e2882c85 1# Copyright 1998-2018 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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Michael Snyder (msnyder@cygnus.com)
17
4ec70201 18load_lib "trace-support.exp"
c906108c 19
c906108c
SS
20
21gdb_exit
22gdb_start
497a5eb0 23standard_testfile actions.c
f8b7eaf3
DJ
24if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
25 executable {debug nowarnings}] != "" } {
5b362f04 26 untested "failed to compile"
f8b7eaf3 27 return -1
c906108c 28}
f8b7eaf3 29gdb_load $binfile
de7ff789
MS
30gdb_test "tstop" ".*" ""
31gdb_test "tfind none" ".*" ""
f8b7eaf3 32runto_main
c906108c
SS
33gdb_reinitialize_dir $srcdir/$subdir
34
c906108c 35if { ![gdb_target_supports_trace] } then {
bc6c7af4 36 unsupported "current target does not support trace"
ae59b1da 37 return 1
c906108c
SS
38
39}
40
41# If testing on a remote host, download the source file.
42# remote_download host $srcdir/$subdir/$srcfile
43
44
45#
46# test passcount dynamically (live target)
47#
48
4ec70201 49set baseline [gdb_find_recursion_test_baseline $srcfile]
c906108c
SS
50
51if { $baseline == -1 } then {
bc6c7af4 52 fail "could not find gdb_recursion_test function"
4ec70201 53 return
c906108c
SS
54}
55
56# define relative source line numbers:
57# all subsequent line numbers are relative to this first one (baseline)
58
59set testline2 [expr $baseline + 4]
60set testline3 [expr $baseline + 5]
61set testline4 [expr $baseline + 6]
62
63#
64# test passcount command semantics (live test)
65#
66
67## Set three tracepoints with three different passcounts.
68## Verify that the experiment stops after the one with the
69## lowest passcount is hit.
70
71gdb_delete_tracepoints
72set tdp2 [gdb_gettpnum "$testline2"]
73set tdp3 [gdb_gettpnum "$testline3"]
74set tdp4 [gdb_gettpnum "$testline4"]
75if { $tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0 } then {
76 fail "setting tracepoints"
4ec70201 77 return
c906108c
SS
78}
79
80gdb_test "passcount 4 $tdp2" "Setting tracepoint $tdp2's passcount to 4" \
81 "4.5: set passcount for tracepoint $tdp2"
82gdb_test "passcount 2 $tdp3" "Setting tracepoint $tdp3's passcount to 2" \
83 "4.5: set passcount for tracepoint $tdp3"
84gdb_test "passcount 3 $tdp4" "Setting tracepoint $tdp4's passcount to 3" \
85 "4.5: set passcount for tracepoint $tdp4"
86
de7ff789 87gdb_test "tstart" ".*" ""
c906108c 88
de7ff789 89gdb_test "break end" ".*" ""
f8b7eaf3
DJ
90gdb_test "continue" \
91 "Continuing.*Breakpoint $decimal, end.*" \
92 "run trace experiment"
de7ff789 93gdb_test "tstop" ".*" ""
c906108c 94
de7ff789 95gdb_test "tfind none" ".*" ""
c906108c 96if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x -1 x" ""] {
5b362f04 97 untested "skipping further tests due to print failure"
b60f0898 98 return -1
c906108c
SS
99}
100
de7ff789 101gdb_test "tfind tracepoint $tdp2" ".*" ""
c906108c 102if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 0 x" ""] {
5b362f04 103 untested "skipping further tests due to print failure"
b60f0898 104 return -1
c906108c
SS
105}
106
de7ff789 107gdb_test "tfind tracepoint $tdp3" ".*" ""
c906108c 108if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 1 x" ""] {
5b362f04 109 untested "skipping further tests due to print failure"
b60f0898 110 return -1
c906108c
SS
111}
112
de7ff789 113gdb_test "tfind tracepoint $tdp4" ".*" ""
c906108c 114if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 2 x" ""] {
5b362f04 115 untested "skipping further tests due to print failure"
b60f0898 116 return -1
c906108c
SS
117}
118
de7ff789 119gdb_test "tfind tracepoint $tdp2" ".*" ""
c906108c 120if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 3 x" ""] {
5b362f04 121 untested "skipping further tests due to print failure"
b60f0898 122 return -1
c906108c
SS
123}
124
de7ff789 125gdb_test "tfind tracepoint $tdp3" ".*" ""
c906108c 126if [gdb_test "printf \"x \%d x\\n\", \$trace_frame" "x 4 x" ""] {
5b362f04 127 untested "skipping further tests due to print failure"
b60f0898 128 return -1
c906108c
SS
129}
130
131## We should now be at the last frame, because this frame's passcount
132## should have caused collection to stop. If we do a tfind now,
133## it should fail.
134
135gdb_test "tfind" "failed to find.*" "4.5: dynamic passcount test"
136
137# Finished!
de7ff789 138gdb_test "tfind none" ".*" ""
c906108c 139