Skip tests for common directive on hpux
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / skip.exp
1 # Copyright 2011-2016 Free Software Foundation, Inc.
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
18 if { [prepare_for_testing skip.exp "skip" \
19 {skip.c skip1.c } \
20 {debug nowarnings}] } {
21 return -1
22 }
23
24 set srcfile skip.c
25 set srcfile1 skip1.c
26
27 # Right after we start gdb, there's no default file or function to skip.
28
29 gdb_test "skip file" "No default file now." "skip file (no default file)"
30 gdb_test "skip function" "No default function now."
31 gdb_test "skip" "No default function now." "skip (no default function)"
32
33 if ![runto_main] { fail "skip tests suppressed" }
34
35 # Test |info skip| with an empty skiplist.
36
37 gdb_test "info skip" "Not skipping any files or functions\." "info skip empty"
38
39 # Create a skiplist entry for the current file and function.
40
41 gdb_test "skip file" "File .*$srcfile will be skipped when stepping\." "skip file ($srcfile)"
42 gdb_test "skip" "Function main will be skipped when stepping\." "skip (main)"
43
44 # Create a skiplist entry for a specified file and function.
45
46 gdb_test "skip file skip1.c" "File .*$srcfile1 will be skipped when stepping\."
47 gdb_test "skip function baz" "Function baz will be skipped when stepping\."
48
49 # Test bad skiplist entry modification commands
50
51 gdb_test "skip enable 999" "No skiplist entries found with number 999."
52 gdb_test "skip disable 999" "No skiplist entries found with number 999."
53 gdb_test "skip delete 999" "No skiplist entries found with number 999."
54 gdb_test "skip enable a" "Args must be numbers or '\\$' variables."
55 gdb_test "skip disable a" "Args must be numbers or '\\$' variables."
56 gdb_test "skip delete a" "Args must be numbers or '\\$' variables."
57
58 # Ask for info on a skiplist entry which doesn't exist.
59
60 gdb_test "info skip 999" "No skiplist entries found with number 999."
61
62 # Does |info skip| look right?
63
64 gdb_test "info skip" \
65 "Num\\s+Type\\s+Enb\\s+What\\s*
66 1\\s+file\\s+y\\s+.*$srcfile\\s*
67 2\\s+function\\s+y\\s+main\\s*
68 3\\s+file\\s+y\\s+$srcfile1\\s*
69 4\\s+function\\s+y\\s+baz\\s*"
70
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().
74
75 if ![runto_main] { fail "skip tests suppressed" }
76 gdb_test "step" ".*" "step in the main"
77 gdb_test "bt" "\\s*\\#0\\s+main.*" "step after all ignored"
78
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().
82
83 gdb_test "skip delete 1"
84 # Check that entry 1 is missing from |info skip|
85 gdb_test "info skip" \
86 "Num\\s+Type\\s+Enb\\s+What\\s*
87 2\\s+function\\s+y\\s+main\\s*
88 3\\s+file\\s+y\\s+$srcfile1\\s*
89 4\\s+function\\s+y\\s+baz\\s*" \
90 "info skip (delete 1)"
91
92 if ![runto_main] { fail "skip tests suppressed" }
93 set test "step after deleting 1"
94 gdb_test "step" "foo \\(\\) at.*" "$test (1)"
95 gdb_test "step" ".*" "$test (2)" ; # Return from foo()
96 gdb_test "step" "main \\(\\) at.*" "$test (3)"
97
98 # Now disable the skiplist entry for skip1.c. We should now
99 # step into foo(), then into bar(), but not into baz().
100
101 gdb_test "skip disable 3"
102 # Is entry 3 disabled in |info skip|?
103 gdb_test "info skip 3" ".*\\n3\\s+file\\s+n.*" \
104 "info skip shows entry as disabled"
105
106 if ![runto_main] { fail "skip tests suppressed" }
107 set test "step after disabling 3"
108 gdb_test "step" "bar \\(\\) at.*" "$test (1)"
109 gdb_test "step" ".*" "$test (2)"; # Return from foo()
110 gdb_test "step" "foo \\(\\) at.*" "$test (3)"
111 gdb_test "step" ".*" "$test (4)"; # Return from bar()
112 gdb_test "step" "main \\(\\) at.*" "$test (5)"
113
114 # Enable skiplist entry 3 and make sure we step over it like before.
115
116 gdb_test "skip enable 3"
117 # Is entry 3 enabled in |info skip|?
118 gdb_test "info skip 3" ".*\\n3\\s+file\\s+y.*" \
119 "info skip shows entry as enabled"
120 if ![runto_main] { fail "skip tests suppressed" }
121 set test "step after enable 3"
122 gdb_test "step" "foo \\(\\) at.*" "$test (1)"
123 gdb_test "step" ".*" "$test (2)"; # Return from foo()
124 gdb_test "step" "main \\(\\) at.*" "$test (3)"
125
126 gdb_test "skip disable"
127 gdb_test "info skip" \
128 "Num\\s+Type\\s+Enb\\s+What\\s*
129 2\\s+function\\s+n\\s+main\\s*
130 3\\s+file\\s+n\\s+$srcfile1\\s*
131 4\\s+function\\s+n\\s+baz\\s*" \
132 "info skip after disabling all"
133
134 gdb_test "skip enable"
135 gdb_test "info skip" \
136 "Num\\s+Type\\s+Enb\\s+What\\s*
137 2\\s+function\\s+y\\s+main\\s*
138 3\\s+file\\s+y\\s+$srcfile1\\s*
139 4\\s+function\\s+y\\s+baz\\s*" \
140 "info skip after enabling all"
141
142 gdb_test "skip disable 4 2-3"
143 gdb_test "info skip" \
144 "Num\\s+Type\\s+Enb\\s+What\\s*
145 2\\s+function\\s+n\\s+main\\s*
146 3\\s+file\\s+n\\s+$srcfile1\\s*
147 4\\s+function\\s+n\\s+baz\\s*" \
148 "info skip after disabling 4 2-3"
149
150 gdb_test "skip enable 2-3"
151 gdb_test "info skip" \
152 "Num\\s+Type\\s+Enb\\s+What\\s*
153 2\\s+function\\s+y\\s+main\\s*
154 3\\s+file\\s+y\\s+$srcfile1\\s*
155 4\\s+function\\s+n\\s+baz\\s*" \
156 "info skip after enabling 2-3"
157
158 gdb_test "info skip 2-3" \
159 "Num\\s+Type\\s+Enb\\s+What\\s*
160 2\\s+function\\s+y\\s+main\\s*
161 3\\s+file\\s+y\\s+$srcfile1\\s*" \
162 "info skip 2-3"
163
164 gdb_test "skip delete 2 3"
165 gdb_test "info skip" \
166 "4\\s+function\\s+n\\s+baz\\s*" \
167 "info skip after deleting 2 3"
168
169 gdb_test "skip delete"
170 gdb_test "info skip" "Not skipping any files or functions\." \
171 "info skip after deleting all"
This page took 0.034993 seconds and 5 git commands to generate.