1# This testcase is part of GDB, the GNU debugger.
2
3# Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18if $tracelevel then {
19    strace $tracelevel
20}
21
22set testfile step-break
23set srcfile ${testfile}.c
24set binfile ${objdir}/${subdir}/${testfile}
25
26if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
27     untested step-break.exp
28     return -1
29}
30
31gdb_exit
32gdb_start
33gdb_reinitialize_dir $srcdir/$subdir
34gdb_load ${binfile}
35
36if ![runto_main] then {
37   fail "Can't run to main"
38   return 0
39}
40
41set bp_location [gdb_get_line_number "set breakpoint here"]
42
43gdb_test "break $bp_location" \
44    "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
45    "breakpoint line number"
46
47gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(\\) at .*$srcfile:$bp_location.*set breakpoint here.*" \
48    "run until breakpoint set at a line number"
49
50gdb_test "next 2" ".*place2.*" "next 2 (1)"
51gdb_test "next 2" ".*place3.*" "next 2 (2)"
52gdb_test "next 2" ".*place2.*" "next 2 (3)"
53gdb_test "next 2" ".*place3.*" "next 2 (4)"
54gdb_test "next 2" ".*place2.*" "next 2 (5)"
55gdb_test "next 2" ".*place3.*" "next 2 (6)"
56
57return 0
58