1 # Copyright
2003-2022 Free Software Foundation
, Inc.
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.
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.
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
/>.
*/
16 # advance.exp
-- Expect script to test
'advance' in gdb
20 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile debug]} {
24 if ![runto_main
] then {
28 # Verify that
"advance <location>" works. (This is really just syntactic
29 # sugar
for "tbreak <location>; continue".)
31 gdb_test
"advance [gdb_get_line_number "advance this location"]" \
32 "main .* at .*:.*b = 3.*advance this location.*" \
35 # Verify that a malformed
"advance" is gracefully caught.
37 gdb_test
"advance [gdb_get_line_number "advance malformed"] then stop" \
38 "malformed linespec error: unexpected string, \"then stop\"" \
41 # Verify that
"advance <funcname>" works.
43 gdb_test
"advance func" \
44 "func.*at.*x = x \\+ 5."
46 # Verify that
"advance <funcname>" when funcname is NOT called by the current
47 # frame
, stops at the end of the current frame.
49 # gdb can legitimately stop
on either the current line or the next line
,
50 # depending
on whether the machine instruction
for 'call' on the current
51 # line has more instructions after it or not.
53 gdb_test
"advance func3" \
54 "(in main|).*(func \\(c\\)|marker1 \\(\\)).*stop here after leaving current frame..."\
55 "advance function not called by current frame"
59 gdb_test
"break [gdb_get_line_number "break here"]" \
60 ".*Breakpoint.* at .*" \
61 "set breakpoint at call to func3"
63 ".*Breakpoint ${decimal}, main.*func3.*break here.*" \
64 "continue to call to func3 in main"
66 # Verify that
"advance <funcname>" when funcname is called as parameter to
67 # another function works.
69 gdb_test
"advance foo" \
70 "foo \\(a=5\\).*int b = a \\+ 10;"\
71 "advance function called as param"
73 # Verify that we
get an error
if we use
'advance' w
/o
argument
76 "Argument required \\(a location\\)."\
77 "advance with no argument"