Skip tests for common directive on hpux
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / skip.exp
CommitLineData
618f726f 1# Copyright 2011-2016 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
1bfeeb0f 27# Right after we start gdb, there's no default file or function to skip.
21b1f8d2 28
a79b18b5 29gdb_test "skip file" "No default file now." "skip file (no default file)"
1bfeeb0f 30gdb_test "skip function" "No default function now."
a79b18b5 31gdb_test "skip" "No default function now." "skip (no default function)"
1bfeeb0f
JL
32
33if ![runto_main] { fail "skip tests suppressed" }
34
1bfeeb0f 35# Test |info skip| with an empty skiplist.
21b1f8d2 36
1bfeeb0f
JL
37gdb_test "info skip" "Not skipping any files or functions\." "info skip empty"
38
1bfeeb0f 39# Create a skiplist entry for the current file and function.
21b1f8d2 40
a79b18b5 41gdb_test "skip file" "File .*$srcfile will be skipped when stepping\." "skip file ($srcfile)"
85817405 42gdb_test "skip" "Function main will be skipped when stepping\." "skip (main)"
1bfeeb0f 43
1bfeeb0f 44# Create a skiplist entry for a specified file and function.
21b1f8d2 45
1bfeeb0f 46gdb_test "skip file skip1.c" "File .*$srcfile1 will be skipped when stepping\."
85817405 47gdb_test "skip function baz" "Function baz will be skipped when stepping\."
1bfeeb0f 48
1bfeeb0f 49# Test bad skiplist entry modification commands
21b1f8d2 50
1bfeeb0f
JL
51gdb_test "skip enable 999" "No skiplist entries found with number 999."
52gdb_test "skip disable 999" "No skiplist entries found with number 999."
53gdb_test "skip delete 999" "No skiplist entries found with number 999."
54gdb_test "skip enable a" "Args must be numbers or '\\$' variables."
55gdb_test "skip disable a" "Args must be numbers or '\\$' variables."
56gdb_test "skip delete a" "Args must be numbers or '\\$' variables."
57
1bfeeb0f 58# Ask for info on a skiplist entry which doesn't exist.
21b1f8d2 59
1bfeeb0f
JL
60gdb_test "info skip 999" "No skiplist entries found with number 999."
61
1bfeeb0f 62# Does |info skip| look right?
21b1f8d2 63
1bfeeb0f 64gdb_test "info skip" \
85817405 65 "Num\\s+Type\\s+Enb\\s+What\\s*
1bfeeb0f 661\\s+file\\s+y\\s+.*$srcfile\\s*
85817405
JK
672\\s+function\\s+y\\s+main\\s*
683\\s+file\\s+y\\s+$srcfile1\\s*
694\\s+function\\s+y\\s+baz\\s*"
1bfeeb0f 70
1bfeeb0f
JL
71# Right now, we have an outstanding skiplist entry on both source
72# files, so when we step into the first line in main(), we should step
73# right over it and go to the second line of main().
1bfeeb0f
JL
74
75if ![runto_main] { fail "skip tests suppressed" }
a79b18b5 76gdb_test "step" ".*" "step in the main"
1bfeeb0f
JL
77gdb_test "bt" "\\s*\\#0\\s+main.*" "step after all ignored"
78
1bfeeb0f
JL
79# Now remove skip.c from the skiplist. Our first step should take us
80# into foo(), and our second step should take us to the next line in
81# main().
21b1f8d2 82
1bfeeb0f
JL
83gdb_test "skip delete 1"
84# Check that entry 1 is missing from |info skip|
85gdb_test "info skip" \
85817405
JK
86 "Num\\s+Type\\s+Enb\\s+What\\s*
872\\s+function\\s+y\\s+main\\s*
883\\s+file\\s+y\\s+$srcfile1\\s*
894\\s+function\\s+y\\s+baz\\s*" \
a79b18b5 90 "info skip (delete 1)"
1bfeeb0f
JL
91
92if ![runto_main] { fail "skip tests suppressed" }
9482b9fb
DE
93set test "step after deleting 1"
94gdb_test "step" "foo \\(\\) at.*" "$test (1)"
95gdb_test "step" ".*" "$test (2)" ; # Return from foo()
96gdb_test "step" "main \\(\\) at.*" "$test (3)"
1bfeeb0f 97
1bfeeb0f
JL
98# Now disable the skiplist entry for skip1.c. We should now
99# step into foo(), then into bar(), but not into baz().
21b1f8d2 100
1bfeeb0f
JL
101gdb_test "skip disable 3"
102# Is entry 3 disabled in |info skip|?
103gdb_test "info skip 3" ".*\\n3\\s+file\\s+n.*" \
104 "info skip shows entry as disabled"
105
106if ![runto_main] { fail "skip tests suppressed" }
9482b9fb
DE
107set test "step after disabling 3"
108gdb_test "step" "bar \\(\\) at.*" "$test (1)"
109gdb_test "step" ".*" "$test (2)"; # Return from foo()
110gdb_test "step" "foo \\(\\) at.*" "$test (3)"
111gdb_test "step" ".*" "$test (4)"; # Return from bar()
112gdb_test "step" "main \\(\\) at.*" "$test (5)"
1bfeeb0f 113
1bfeeb0f 114# Enable skiplist entry 3 and make sure we step over it like before.
21b1f8d2 115
1bfeeb0f
JL
116gdb_test "skip enable 3"
117# Is entry 3 enabled in |info skip|?
118gdb_test "info skip 3" ".*\\n3\\s+file\\s+y.*" \
119 "info skip shows entry as enabled"
120if ![runto_main] { fail "skip tests suppressed" }
9482b9fb
DE
121set test "step after enable 3"
122gdb_test "step" "foo \\(\\) at.*" "$test (1)"
123gdb_test "step" ".*" "$test (2)"; # Return from foo()
124gdb_test "step" "main \\(\\) at.*" "$test (3)"
1bfeeb0f
JL
125
126gdb_test "skip disable"
127gdb_test "info skip" \
85817405
JK
128 "Num\\s+Type\\s+Enb\\s+What\\s*
1292\\s+function\\s+n\\s+main\\s*
1303\\s+file\\s+n\\s+$srcfile1\\s*
1314\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
132 "info skip after disabling all"
133
134gdb_test "skip enable"
135gdb_test "info skip" \
85817405
JK
136 "Num\\s+Type\\s+Enb\\s+What\\s*
1372\\s+function\\s+y\\s+main\\s*
1383\\s+file\\s+y\\s+$srcfile1\\s*
1394\\s+function\\s+y\\s+baz\\s*" \
1bfeeb0f
JL
140 "info skip after enabling all"
141
142gdb_test "skip disable 4 2-3"
143gdb_test "info skip" \
85817405
JK
144 "Num\\s+Type\\s+Enb\\s+What\\s*
1452\\s+function\\s+n\\s+main\\s*
1463\\s+file\\s+n\\s+$srcfile1\\s*
1474\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
148 "info skip after disabling 4 2-3"
149
150gdb_test "skip enable 2-3"
151gdb_test "info skip" \
85817405
JK
152 "Num\\s+Type\\s+Enb\\s+What\\s*
1532\\s+function\\s+y\\s+main\\s*
1543\\s+file\\s+y\\s+$srcfile1\\s*
1554\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
156 "info skip after enabling 2-3"
157
158gdb_test "info skip 2-3" \
85817405
JK
159 "Num\\s+Type\\s+Enb\\s+What\\s*
1602\\s+function\\s+y\\s+main\\s*
1613\\s+file\\s+y\\s+$srcfile1\\s*" \
1bfeeb0f
JL
162 "info skip 2-3"
163
164gdb_test "skip delete 2 3"
165gdb_test "info skip" \
85817405 166 "4\\s+function\\s+n\\s+baz\\s*" \
1bfeeb0f
JL
167 "info skip after deleting 2 3"
168
169gdb_test "skip delete"
170gdb_test "info skip" "Not skipping any files or functions\." \
171 "info skip after deleting all"
This page took 0.572866 seconds and 4 git commands to generate.