linespec rewrite:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / advance.exp
CommitLineData
0b302171 1# Copyright 2003, 2007-2012 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
82025e13 18set testfile advance
f2dd3617 19set srcfile ${testfile}.c
82025e13
EZ
20set binfile ${objdir}/${subdir}/${testfile}
21
22remote_exec build "rm -f ${binfile}"
f2dd3617 23if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
b60f0898
JB
24 untested advance.exp
25 return -1
82025e13
EZ
26}
27
28gdb_exit
29gdb_start
30gdb_reinitialize_dir $srcdir/$subdir
31gdb_load ${binfile}
32
33if ![runto_main] then {
34 fail "Can't run to main"
35 return 0
36}
37
38# Verify that "advance <location>" works. (This is really just syntactic
39# sugar for "tbreak <location>; continue".)
40#
41gdb_test "advance [gdb_get_line_number "advance this location"]" \
42 "main .* at .*:.*b = 3.*advance this location.*" \
43 "advance line number"
44
45# Verify that a malformed "advance" is gracefully caught.
46#
47gdb_test "advance [gdb_get_line_number "advance malformed"] then stop" \
40e084e1
KS
48 "malformed linespec error: unexpected string, \"then stop\"" \
49 "malformed advance"
82025e13
EZ
50
51# Verify that "advance <funcname>" works.
52#
53gdb_test "advance func" \
54 "func.*at.*x = x \\+ 5." \
55 "advance func"
56
57# Verify that "advance <funcname>" when funcname is NOT called by the current
58# frame, stops at the end of the current frame.
59#
9ba61c5d
MC
60# gdb can legitimately stop on either the current line or the next line,
61# depending on whether the machine instruction for 'call' on the current
62# line has more instructions after it or not.
63#
82025e13 64gdb_test "advance func3" \
9ba61c5d 65 "(in main|).*(func \\(c\\)|marker1 \\(\\)).*stop here after leaving current frame..."\
82025e13
EZ
66 "advance function not called by current frame"
67
68# break at main again
69#
70gdb_test "break [gdb_get_line_number "break here"]" \
71 ".*Breakpoint.* at .*" \
72 "set breakpoint at call to func3"
73gdb_test "continue" \
74 ".*Breakpoint ${decimal}, main.*func3.*break here.*" \
75 "continue to call to func3 in main"
76
77# Verify that "advance <funcname>" when funcname is called as parameter to
78# another function works.
79#
80gdb_test "advance foo" \
81 "foo \\(a=5\\).*int b = a \\+ 10;"\
82 "advance function called as param"
83
84# Verify that we get an error if we use 'advance' w/o argument
85#
86gdb_test "advance" \
87 "Argument required \\(a location\\)."\
88 "advance with no argument"
89
This page took 1.397069 seconds and 4 git commands to generate.