run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / consecutive.exp
CommitLineData
7b6bb8da
JB
1# Copyright 2001, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
c2b8fa57
MS
3
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
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c2b8fa57 7# (at your option) any later version.
e22f8b7c 8#
c2b8fa57
MS
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.
e22f8b7c 13#
c2b8fa57 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c2b8fa57 16
c2b8fa57
MS
17# This file was written by Michael Snyder. (msnyder@redhat.com)
18
19if $tracelevel then {
20 strace $tracelevel
21}
22
23#
24# Test breakpoints at consecutive instruction addresses.
25#
26
c2b8fa57
MS
27
28set testfile "consecutive"
29set srcfile ${testfile}.c
30set binfile ${objdir}/${subdir}/${testfile}
31
fc91c6c2 32if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
33 untested consecutive.exp
34 return -1
c2b8fa57
MS
35}
36
37if [get_compiler_info ${binfile}] {
38 return -1
39}
40
41gdb_exit
42gdb_start
43gdb_reinitialize_dir $srcdir/$subdir
44gdb_load ${binfile}
45
46if [target_info exists gdb_stub] {
47 gdb_step_for_stub;
48}
49
50if ![runto_main] then {
51 perror "couldn't run to breakpoint"
52 continue
53}
54
55set nl "\[\r\n\]+"
56
57gdb_breakpoint foo
58gdb_test "continue" "Breakpoint $decimal, foo .*" \
59 "continue to breakpoint in foo"
60
61set bp_addr 0
62set stop_addr 0
63
ad3986f0 64gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" {
2b28d209 65 -re "=> $hex.*${nl} ($hex).*$gdb_prompt $" {
c2b8fa57
MS
66 set bp_addr $expect_out(1,string)
67 pass "get breakpoint address for foo"
68 }
c2b8fa57
MS
69}
70
71gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
72 "set bp, 2nd instr"
73
ad3986f0 74gdb_test_multiple "step" "stopped at bp, 2nd instr" {
c2b8fa57
MS
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"
79 } else {
80 fail "stopped at bp, 2nd instr (wrong address)"
81 }
82 }
c2b8fa57
MS
83}
84
This page took 0.972445 seconds and 4 git commands to generate.