Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright 2003-2019 Free Software Foundation, Inc. |
82025e13 EZ |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
82025e13 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
82025e13 EZ |
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. | |
e22f8b7c | 12 | # |
82025e13 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
82025e13 | 15 | |
82025e13 EZ |
16 | # advance.exp -- Expect script to test 'advance' in gdb |
17 | ||
08b3fe69 | 18 | standard_testfile |
82025e13 | 19 | |
5b362f04 | 20 | if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { |
b60f0898 | 21 | return -1 |
82025e13 EZ |
22 | } |
23 | ||
82025e13 | 24 | if ![runto_main] then { |
bc6c7af4 | 25 | fail "can't run to main" |
82025e13 EZ |
26 | return 0 |
27 | } | |
28 | ||
29 | # Verify that "advance <location>" works. (This is really just syntactic | |
30 | # sugar for "tbreak <location>; continue".) | |
31 | # | |
32 | gdb_test "advance [gdb_get_line_number "advance this location"]" \ | |
33 | "main .* at .*:.*b = 3.*advance this location.*" \ | |
34 | "advance line number" | |
35 | ||
36 | # Verify that a malformed "advance" is gracefully caught. | |
37 | # | |
38 | gdb_test "advance [gdb_get_line_number "advance malformed"] then stop" \ | |
40e084e1 KS |
39 | "malformed linespec error: unexpected string, \"then stop\"" \ |
40 | "malformed advance" | |
82025e13 EZ |
41 | |
42 | # Verify that "advance <funcname>" works. | |
43 | # | |
44 | gdb_test "advance func" \ | |
45 | "func.*at.*x = x \\+ 5." \ | |
46 | "advance func" | |
47 | ||
48 | # Verify that "advance <funcname>" when funcname is NOT called by the current | |
49 | # frame, stops at the end of the current frame. | |
50 | # | |
9ba61c5d MC |
51 | # gdb can legitimately stop on either the current line or the next line, |
52 | # depending on whether the machine instruction for 'call' on the current | |
53 | # line has more instructions after it or not. | |
54 | # | |
82025e13 | 55 | gdb_test "advance func3" \ |
9ba61c5d | 56 | "(in main|).*(func \\(c\\)|marker1 \\(\\)).*stop here after leaving current frame..."\ |
82025e13 EZ |
57 | "advance function not called by current frame" |
58 | ||
59 | # break at main again | |
60 | # | |
61 | gdb_test "break [gdb_get_line_number "break here"]" \ | |
62 | ".*Breakpoint.* at .*" \ | |
63 | "set breakpoint at call to func3" | |
64 | gdb_test "continue" \ | |
65 | ".*Breakpoint ${decimal}, main.*func3.*break here.*" \ | |
66 | "continue to call to func3 in main" | |
67 | ||
68 | # Verify that "advance <funcname>" when funcname is called as parameter to | |
69 | # another function works. | |
70 | # | |
71 | gdb_test "advance foo" \ | |
72 | "foo \\(a=5\\).*int b = a \\+ 10;"\ | |
73 | "advance function called as param" | |
74 | ||
75 | # Verify that we get an error if we use 'advance' w/o argument | |
76 | # | |
77 | gdb_test "advance" \ | |
78 | "Argument required \\(a location\\)."\ | |
79 | "advance with no argument" | |
80 |