OLD | NEW |
1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. */ | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
15 | 15 |
16 # until.exp -- Expect script to test 'until' in gdb | 16 # until.exp -- Expect script to test 'until' in gdb |
17 | 17 |
18 if $tracelevel then { | |
19 strace $tracelevel | |
20 } | |
21 | |
22 set srcfile break.c | 18 set srcfile break.c |
23 if { [prepare_for_testing until.exp "until" {break.c break1.c} {debug nowarnings
}] } { | 19 if { [prepare_for_testing until.exp "until" {break.c break1.c} {debug nowarnings
}] } { |
24 return -1 | 20 return -1 |
25 } | 21 } |
26 | 22 |
27 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] | 23 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] |
28 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] | 24 set bp_location19 [gdb_get_line_number "set breakpoint 19 here"] |
29 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] | 25 set bp_location20 [gdb_get_line_number "set breakpoint 20 here"] |
30 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] | 26 set bp_location21 [gdb_get_line_number "set breakpoint 21 here"] |
31 | 27 |
32 if ![runto_main] then { | 28 if ![runto_main] then { |
33 fail "Can't run to main" | 29 fail "Can't run to main" |
34 return 0 | 30 return 0 |
35 } | 31 } |
36 | 32 |
37 # Verify that "until <location>" works. (This is really just syntactic | 33 # Verify that "until <location>" works. (This is really just syntactic |
38 # sugar for "tbreak <location>; continue".) | 34 # sugar for "tbreak <location>; continue".) |
39 # | 35 # |
40 gdb_test "until $bp_location1" \ | 36 gdb_test "until $bp_location1" \ |
41 "main .* at .*:$bp_location1.*" \ | 37 "main .* at .*:$bp_location1.*" \ |
42 "until line number" | 38 "until line number" |
43 | 39 |
44 # Verify that a malformed "advance" is gracefully caught. | 40 # Verify that a malformed "advance" is gracefully caught. |
45 # | 41 # |
46 gdb_test "until 80 then stop" \ | 42 gdb_test "until 80 then stop" \ |
47 » "Junk at end of arguments." "malformed until" | 43 "malformed linespec error: unexpected string, \"then stop\"." \ |
| 44 "malformed until" |
48 | 45 |
49 # Rerun up to factorial, outer invocation | 46 # Rerun up to factorial, outer invocation |
50 if { ![runto factorial] } then { gdb_suppress_tests; } | 47 if { ![runto factorial] } then { gdb_suppress_tests; } |
51 delete_breakpoints | 48 delete_breakpoints |
52 | 49 |
53 # At this point, 'until' should continue the inferior up to when all the | 50 # At this point, 'until' should continue the inferior up to when all the |
54 # inner invocations of factorial() are completed and we are back at this | 51 # inner invocations of factorial() are completed and we are back at this |
55 # frame. | 52 # frame. |
56 # | 53 # |
57 gdb_test "until $bp_location19" \ | 54 gdb_test "until $bp_location19" \ |
58 "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\)
.*" \ | 55 "factorial.*value=720.*at.*${srcfile}:$bp_location19.*return \\(value\\)
.*" \ |
59 "until factorial, recursive function" | 56 "until factorial, recursive function" |
60 | 57 |
61 # Run to a function called by main | 58 # Run to a function called by main |
62 # | 59 # |
63 if { ![runto marker2] } then { gdb_suppress_tests; } | 60 if { ![runto marker2] } then { gdb_suppress_tests; } |
64 delete_breakpoints | 61 delete_breakpoints |
65 | 62 |
66 # Now issue an until with another function, not called by the current | 63 # Now issue an until with another function, not called by the current |
67 # frame, as argument. This should not work, i.e. the program should | 64 # frame, as argument. This should not work, i.e. the program should |
68 # stop at main, the caller, where we put the 'guard' breakpoint. | 65 # stop at main, the caller, where we put the 'guard' breakpoint. |
69 # | 66 # |
70 gdb_test "until marker3" \ | 67 gdb_test "until marker3" \ |
71 "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*mark
er2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \ | 68 "($hex in |)main.*argc.*argv.*envp.*at.*${srcfile}:($bp_location20.*mark
er2 \\(43\\)|$bp_location21.*marker3 \\(.stack., .trace.\\)).*" \ |
72 "until func, not called by current frame" | 69 "until func, not called by current frame" |
73 | 70 |
OLD | NEW |