]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/consecutive.exp
* gdb.arch/altivec-abi.exp: Replace gdb_suppress_entire_file with
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / consecutive.exp
CommitLineData
c2b8fa57
MS
1# Copyright 2001
2# Free Software Foundation, Inc.
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
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
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.
13#
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.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# This file was written by Michael Snyder. (msnyder@redhat.com)
22
23if $tracelevel then {
24 strace $tracelevel
25}
26
27#
28# Test breakpoints at consecutive instruction addresses.
29#
30
31set prms_id 0
32set bug_id 0
33
34set testfile "consecutive"
35set srcfile ${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37
fc91c6c2 38if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
39 untested consecutive.exp
40 return -1
c2b8fa57
MS
41}
42
43if [get_compiler_info ${binfile}] {
44 return -1
45}
46
47gdb_exit
48gdb_start
49gdb_reinitialize_dir $srcdir/$subdir
50gdb_load ${binfile}
51
52if [target_info exists gdb_stub] {
53 gdb_step_for_stub;
54}
55
56if ![runto_main] then {
57 perror "couldn't run to breakpoint"
58 continue
59}
60
61set nl "\[\r\n\]+"
62
63gdb_breakpoint foo
64gdb_test "continue" "Breakpoint $decimal, foo .*" \
65 "continue to breakpoint in foo"
66
67set bp_addr 0
68set stop_addr 0
69
70send_gdb "x /2i \$pc\n"
71gdb_expect {
72 global hex
73 global nl
74 global bp_addr
75 global gdb_prompt
76
77 -re "$hex.*${nl}($hex).*$gdb_prompt $" {
78 set bp_addr $expect_out(1,string)
79 pass "get breakpoint address for foo"
80 }
81 -re ".*$gdb_prompt $" {
82 fail "get breakpoint address for foo"
83 return 0;
84 }
85 timeout {
86 fail "get breakpoint address for foo (timeout)"
87 return 0;
88 }
89}
90
91gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
92 "set bp, 2nd instr"
93
94send_gdb "step\n"
95gdb_expect {
96 -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
97 set stop_addr $expect_out(1,string)
98 if [eval expr "$bp_addr == $stop_addr"] then {
99 pass "stopped at bp, 2nd instr"
100 } else {
101 fail "stopped at bp, 2nd instr (wrong address)"
102 }
103 }
104 -re ".*$gdb_prompt $" {
105 fail "stopped at bp, 2nd instr"
106 }
107 timeout {
108 fail "stopped at bp, 2nd instr (timeout)"
109
110 }
111}
112