1 # Copyright 2001, 2007, 2008 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 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@prep.ai.mit.edu
19 # This file was written by Michael Snyder. (msnyder@redhat.com)
26 # Test breakpoints at consecutive instruction addresses.
32 set testfile "consecutive"
33 set srcfile ${testfile}.c
34 set binfile ${objdir}/${subdir}/${testfile}
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
37 untested consecutive.exp
41 if [get_compiler_info ${binfile}] {
47 gdb_reinitialize_dir $srcdir/$subdir
50 if [target_info exists gdb_stub] {
54 if ![runto_main] then {
55 perror "couldn't run to breakpoint"
62 gdb_test "continue" "Breakpoint $decimal, foo .*" \
63 "continue to breakpoint in foo"
68 send_gdb "x /2i \$pc\n"
75 -re "$hex.*${nl}($hex).*$gdb_prompt $" {
76 set bp_addr $expect_out(1,string)
77 pass "get breakpoint address for foo"
79 -re ".*$gdb_prompt $" {
80 fail "get breakpoint address for foo"
84 fail "get breakpoint address for foo (timeout)"
89 gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
94 -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
95 set stop_addr $expect_out(1,string)
96 if [eval expr "$bp_addr == $stop_addr"] then {
97 pass "stopped at bp, 2nd instr"
99 fail "stopped at bp, 2nd instr (wrong address)"
102 -re ".*$gdb_prompt $" {
103 fail "stopped at bp, 2nd instr"
106 fail "stopped at bp, 2nd instr (timeout)"