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 2 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, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
21 # This file was written by Michael Snyder. (msnyder@redhat.com)
28 # Test breakpoints at consecutive instruction addresses.
34 set testfile "consecutive"
35 set srcfile ${testfile}.c
36 set binfile ${objdir}/${subdir}/${testfile}
38 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
39 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
42 if [get_compiler_info ${binfile}] {
48 gdb_reinitialize_dir $srcdir/$subdir
51 if [target_info exists gdb_stub] {
55 if ![runto_main] then {
56 perror "couldn't run to breakpoint"
63 gdb_test "continue" "Breakpoint $decimal, foo .*" \
64 "continue to breakpoint in foo"
69 send_gdb "x /2i \$pc\n"
76 -re "$hex.*${nl}($hex).*$gdb_prompt $" {
77 set bp_addr $expect_out(1,string)
78 pass "get breakpoint address for foo"
80 -re ".*$gdb_prompt $" {
81 fail "get breakpoint address for foo"
85 fail "get breakpoint address for foo (timeout)"
90 gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
95 -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
96 set stop_addr $expect_out(1,string)
97 if [eval expr "$bp_addr == $stop_addr"] then {
98 pass "stopped at bp, 2nd instr"
100 fail "stopped at bp, 2nd instr (wrong address)"
103 -re ".*$gdb_prompt $" {
104 fail "stopped at bp, 2nd instr"
107 fail "stopped at bp, 2nd instr (timeout)"