]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/skip.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / skip.exp
CommitLineData
32d0add0 1# Copyright 2011-2015 Free Software Foundation, Inc.
1bfeeb0f
JL
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# This file was written by Justin Lebar. (justin.lebar@gmail.com)
17
18if { [prepare_for_testing skip.exp "skip" \
19 {skip.c skip1.c } \
20 {debug nowarnings}] } {
21 return -1
22}
23
24set srcfile skip.c
25set srcfile1 skip1.c
26
27#
28# Right after we start gdb, there's no default file or function to skip.
29#
a79b18b5 30gdb_test "skip file" "No default file now." "skip file (no default file)"
1bfeeb0f 31gdb_test "skip function" "No default function now."
a79b18b5 32gdb_test "skip" "No default function now." "skip (no default function)"
1bfeeb0f
JL
33
34if ![runto_main] { fail "skip tests suppressed" }
35
36#
37# Test |info skip| with an empty skiplist.
38#
39gdb_test "info skip" "Not skipping any files or functions\." "info skip empty"
40
41#
42# Create a skiplist entry for the current file and function.
43#
a79b18b5 44gdb_test "skip file" "File .*$srcfile will be skipped when stepping\." "skip file ($srcfile)"
85817405 45gdb_test "skip" "Function main will be skipped when stepping\." "skip (main)"
1bfeeb0f
JL
46
47#
48# Create a skiplist entry for a specified file and function.
49#
50gdb_test "skip file skip1.c" "File .*$srcfile1 will be skipped when stepping\."
85817405 51gdb_test "skip function baz" "Function baz will be skipped when stepping\."
1bfeeb0f
JL
52
53#
54# Test bad skiplist entry modification commands
55#
56gdb_test "skip enable 999" "No skiplist entries found with number 999."
57gdb_test "skip disable 999" "No skiplist entries found with number 999."
58gdb_test "skip delete 999" "No skiplist entries found with number 999."
59gdb_test "skip enable a" "Args must be numbers or '\\$' variables."
60gdb_test "skip disable a" "Args must be numbers or '\\$' variables."
61gdb_test "skip delete a" "Args must be numbers or '\\$' variables."
62
63#
64# Ask for info on a skiplist entry which doesn't exist.
65#
66gdb_test "info skip 999" "No skiplist entries found with number 999."
67
68#
69# Does |info skip| look right?
70#
71gdb_test "info skip" \
85817405 72 "Num\\s+Type\\s+Enb\\s+What\\s*
1bfeeb0f 731\\s+file\\s+y\\s+.*$srcfile\\s*
85817405
JK
742\\s+function\\s+y\\s+main\\s*
753\\s+file\\s+y\\s+$srcfile1\\s*
764\\s+function\\s+y\\s+baz\\s*"
1bfeeb0f
JL
77
78#
79# Right now, we have an outstanding skiplist entry on both source
80# files, so when we step into the first line in main(), we should step
81# right over it and go to the second line of main().
82#
83
84if ![runto_main] { fail "skip tests suppressed" }
a79b18b5 85gdb_test "step" ".*" "step in the main"
1bfeeb0f
JL
86gdb_test "bt" "\\s*\\#0\\s+main.*" "step after all ignored"
87
88#
89# Now remove skip.c from the skiplist. Our first step should take us
90# into foo(), and our second step should take us to the next line in
91# main().
92#
93gdb_test "skip delete 1"
94# Check that entry 1 is missing from |info skip|
95gdb_test "info skip" \
85817405
JK
96 "Num\\s+Type\\s+Enb\\s+What\\s*
972\\s+function\\s+y\\s+main\\s*
983\\s+file\\s+y\\s+$srcfile1\\s*
994\\s+function\\s+y\\s+baz\\s*" \
a79b18b5 100 "info skip (delete 1)"
1bfeeb0f
JL
101
102if ![runto_main] { fail "skip tests suppressed" }
103gdb_test "step" "foo \\(\\) at.*" "step after deleting 1 (1)"
a79b18b5
YQ
104gdb_test "step" ".*" "step after deleting 1 (2)" ; # Return from foo()
105gdb_test "step" "main \\(\\) at.*" "step after deleting 1 (3)"
1bfeeb0f
JL
106
107#
108# Now disable the skiplist entry for skip1.c. We should now
109# step into foo(), then into bar(), but not into baz().
110#
111gdb_test "skip disable 3"
112# Is entry 3 disabled in |info skip|?
113gdb_test "info skip 3" ".*\\n3\\s+file\\s+n.*" \
114 "info skip shows entry as disabled"
115
116if ![runto_main] { fail "skip tests suppressed" }
117gdb_test "step" "bar \\(\\) at.*" "step after disabling 3 (1)"
a79b18b5
YQ
118gdb_test "step" ".*" "step after disabling 3 (2)"; # Return from foo()
119gdb_test "step" "foo \\(\\) at.*" "step after disabling 3 (3)"
120gdb_test "step" ".*" "step after disabling 3 (4)"; # Return from bar()
121gdb_test "step" "main \\(\\) at.*" "step after disabling 3 (5)"
1bfeeb0f
JL
122
123#
124# Enable skiplist entry 3 and make sure we step over it like before.
125#
126gdb_test "skip enable 3"
127# Is entry 3 enabled in |info skip|?
128gdb_test "info skip 3" ".*\\n3\\s+file\\s+y.*" \
129 "info skip shows entry as enabled"
130if ![runto_main] { fail "skip tests suppressed" }
a79b18b5
YQ
131gdb_test "step" "foo \\(\\) at.*" "step after enable 3 (1)"
132gdb_test "step" ".*" "step after enable 3 (2)"; # Return from foo()
133gdb_test "step" "main \\(\\) at.*" "step after enable 3 (3)"
1bfeeb0f
JL
134
135gdb_test "skip disable"
136gdb_test "info skip" \
85817405
JK
137 "Num\\s+Type\\s+Enb\\s+What\\s*
1382\\s+function\\s+n\\s+main\\s*
1393\\s+file\\s+n\\s+$srcfile1\\s*
1404\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
141 "info skip after disabling all"
142
143gdb_test "skip enable"
144gdb_test "info skip" \
85817405
JK
145 "Num\\s+Type\\s+Enb\\s+What\\s*
1462\\s+function\\s+y\\s+main\\s*
1473\\s+file\\s+y\\s+$srcfile1\\s*
1484\\s+function\\s+y\\s+baz\\s*" \
1bfeeb0f
JL
149 "info skip after enabling all"
150
151gdb_test "skip disable 4 2-3"
152gdb_test "info skip" \
85817405
JK
153 "Num\\s+Type\\s+Enb\\s+What\\s*
1542\\s+function\\s+n\\s+main\\s*
1553\\s+file\\s+n\\s+$srcfile1\\s*
1564\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
157 "info skip after disabling 4 2-3"
158
159gdb_test "skip enable 2-3"
160gdb_test "info skip" \
85817405
JK
161 "Num\\s+Type\\s+Enb\\s+What\\s*
1622\\s+function\\s+y\\s+main\\s*
1633\\s+file\\s+y\\s+$srcfile1\\s*
1644\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
165 "info skip after enabling 2-3"
166
167gdb_test "info skip 2-3" \
85817405
JK
168 "Num\\s+Type\\s+Enb\\s+What\\s*
1692\\s+function\\s+y\\s+main\\s*
1703\\s+file\\s+y\\s+$srcfile1\\s*" \
1bfeeb0f
JL
171 "info skip 2-3"
172
173gdb_test "skip delete 2 3"
174gdb_test "info skip" \
85817405 175 "4\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
176 "info skip after deleting 2 3"
177
178gdb_test "skip delete"
179gdb_test "info skip" "Not skipping any files or functions\." \
180 "info skip after deleting all"