]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-bp_permanent.exp
Add is_ilp32_target/is_lp64_target.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-bp_permanent.exp
CommitLineData
4c38e0a4 1# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
514f746b
AR
2
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.
7#
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.
12#
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/>.
15
16
17# This file is part of the gdb testsuite.
18
19if $tracelevel {
20 strace $tracelevel
21}
22
23# Test stepping over permanent breakpoints on i386.
24
add265ae 25if {(![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"]) || ![is_ilp32_target] } then {
514f746b
AR
26 verbose "Skipping skip over permanent breakpoint on i386 tests."
27 return
28}
29
30set testfile "i386-prologue"
31set srcfile ${testfile}.c
32set binfile ${objdir}/${subdir}/${testfile}
33
34# some targets have leading underscores on assembly symbols.
35# TODO: detect this automatically
36set additional_flags ""
37if [istarget "i?86-*-cygwin*"] then {
38 set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
39}
40
41# Don't use "debug", so that we don't have line information for the assembly
42# fragments.
43if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } {
44 untested i386-prologue.exp
45 return -1
46}
47
48
49gdb_exit
50gdb_start
51gdb_reinitialize_dir $srcdir/$subdir
52gdb_load ${binfile}
53
54#
55# Run to `main' where we begin our tests.
56#
57
58if ![runto_main] then {
59 return -1
60}
61
62set function standard
63
64set retcode [gdb_test_multiple "disassemble $function" "Disassemble function '$function'" {
691f8dc1 65 -re ".*($hex) <\\+0>.*($hex) <\\+4>.*($hex) <\\+5>.*($hex) <\\+6>.*$gdb_prompt $" {
514f746b
AR
66 set function_start $expect_out(1,string);
67 set address $expect_out(2,string);
68 set address1 $expect_out(3,string);
69 set address2 $expect_out(4,string);
70 }
71}]
72
73if {$retcode != 0} {
74 fail "Disassemble failed, skipping entire test."
75 return -1
76}
77
78gdb_breakpoint "*$function_start"
79
80gdb_breakpoint "*$address"
81
82gdb_test "continue" "Breakpoint .*, $function_start in $function.*" \
83 "Stop at the '$function' start breakpoint (fetching esp)."
84
85# We want to fetch esp at the start of '$function' function to make sure
86# skip_permanent_breakpoint implementation really skips only the perm.
87# breakpoint. If, for whatever reason, 'leave' instruction doesn't get
88# executed, esp will not have this value.
89set start_esp 0
90gdb_test_multiple "print \$esp" "Fetch esp value." {
91 -re "\\\$1.*($hex).*$gdb_prompt $" {
92 set start_esp $expect_out(1,string);
93 }
94}
95
96gdb_test "continue" "Breakpoint .*, $address in $function.*" \
97 "Stop at permanent breakpoint."
98
99gdb_test "stepi" "$address1|$address2 in $function.*" \
100 "Single stepping past permanent breakpoint."
101
102gdb_test "print \$esp" ".*$start_esp.*" \
103 "ESP value does not match - step_permanent_breakpoint wrong."
104