Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
1bfeeb0f | 27 | # Right after we start gdb, there's no default file or function to skip. |
21b1f8d2 | 28 | |
a79b18b5 | 29 | gdb_test "skip file" "No default file now." "skip file (no default file)" |
1bfeeb0f | 30 | gdb_test "skip function" "No default function now." |
a79b18b5 | 31 | gdb_test "skip" "No default function now." "skip (no default function)" |
1bfeeb0f JL |
32 | |
33 | if ![runto_main] { fail "skip tests suppressed" } | |
34 | ||
1bfeeb0f | 35 | # Test |info skip| with an empty skiplist. |
21b1f8d2 | 36 | |
1bfeeb0f JL |
37 | gdb_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 | 41 | gdb_test "skip file" "File .*$srcfile will be skipped when stepping\." "skip file ($srcfile)" |
85817405 | 42 | gdb_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 | 46 | gdb_test "skip file skip1.c" "File .*$srcfile1 will be skipped when stepping\." |
85817405 | 47 | gdb_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 |
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 | ||
1bfeeb0f | 58 | # Ask for info on a skiplist entry which doesn't exist. |
21b1f8d2 | 59 | |
1bfeeb0f JL |
60 | gdb_test "info skip 999" "No skiplist entries found with number 999." |
61 | ||
1bfeeb0f | 62 | # Does |info skip| look right? |
21b1f8d2 | 63 | |
1bfeeb0f | 64 | gdb_test "info skip" \ |
85817405 | 65 | "Num\\s+Type\\s+Enb\\s+What\\s* |
1bfeeb0f | 66 | 1\\s+file\\s+y\\s+.*$srcfile\\s* |
85817405 JK |
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*" | |
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 | |
75 | if ![runto_main] { fail "skip tests suppressed" } | |
a79b18b5 | 76 | gdb_test "step" ".*" "step in the main" |
1bfeeb0f JL |
77 | gdb_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 |
83 | gdb_test "skip delete 1" |
84 | # Check that entry 1 is missing from |info skip| | |
85 | gdb_test "info skip" \ | |
85817405 JK |
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*" \ | |
a79b18b5 | 90 | "info skip (delete 1)" |
1bfeeb0f JL |
91 | |
92 | if ![runto_main] { fail "skip tests suppressed" } | |
9482b9fb DE |
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)" | |
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 |
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" } | |
9482b9fb DE |
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)" | |
1bfeeb0f | 113 | |
1bfeeb0f | 114 | # Enable skiplist entry 3 and make sure we step over it like before. |
21b1f8d2 | 115 | |
1bfeeb0f JL |
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" } | |
9482b9fb DE |
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)" | |
1bfeeb0f JL |
125 | |
126 | gdb_test "skip disable" | |
127 | gdb_test "info skip" \ | |
85817405 JK |
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*" \ | |
1bfeeb0f JL |
132 | "info skip after disabling all" |
133 | ||
134 | gdb_test "skip enable" | |
135 | gdb_test "info skip" \ | |
85817405 JK |
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*" \ | |
1bfeeb0f JL |
140 | "info skip after enabling all" |
141 | ||
142 | gdb_test "skip disable 4 2-3" | |
143 | gdb_test "info skip" \ | |
85817405 JK |
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*" \ | |
1bfeeb0f JL |
148 | "info skip after disabling 4 2-3" |
149 | ||
150 | gdb_test "skip enable 2-3" | |
151 | gdb_test "info skip" \ | |
85817405 JK |
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*" \ | |
1bfeeb0f JL |
156 | "info skip after enabling 2-3" |
157 | ||
158 | gdb_test "info skip 2-3" \ | |
85817405 JK |
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*" \ | |
1bfeeb0f JL |
162 | "info skip 2-3" |
163 | ||
164 | gdb_test "skip delete 2 3" | |
165 | gdb_test "info skip" \ | |
85817405 | 166 | "4\\s+function\\s+n\\s+baz\\s*" \ |
1bfeeb0f JL |
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" |