1 # Copyright 2001, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # This file was written by Michael Snyder. (msnyder@redhat.com)
24 # Test breakpoints at consecutive instruction addresses.
28 set testfile "consecutive"
29 set srcfile ${testfile}.c
30 set binfile ${objdir}/${subdir}/${testfile}
32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
33 untested consecutive.exp
37 if [get_compiler_info ${binfile}] {
43 gdb_reinitialize_dir $srcdir/$subdir
46 if [target_info exists gdb_stub] {
50 if ![runto_main] then {
51 perror "couldn't run to breakpoint"
58 gdb_test "continue" "Breakpoint $decimal, foo .*" \
59 "continue to breakpoint in foo"
64 gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" {
65 -re "=> $hex.*${nl} ($hex).*$gdb_prompt $" {
66 set bp_addr $expect_out(1,string)
67 pass "get breakpoint address for foo"
71 gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
74 gdb_test_multiple "step" "stopped at bp, 2nd instr" {
75 -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
76 set stop_addr $expect_out(1,string)
77 if [eval expr "$bp_addr == $stop_addr"] then {
78 pass "stopped at bp, 2nd instr"
80 fail "stopped at bp, 2nd instr (wrong address)"