Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright (C) 2008-2016 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 | ||
514f746b AR |
19 | # Test stepping over permanent breakpoints on i386. |
20 | ||
af48d08f | 21 | if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { |
514f746b AR |
22 | verbose "Skipping skip over permanent breakpoint on i386 tests." |
23 | return | |
24 | } | |
25 | ||
ddb9f679 | 26 | standard_testfile |
514f746b AR |
27 | |
28 | # some targets have leading underscores on assembly symbols. | |
ee5683ab | 29 | set additional_flags [gdb_target_symbol_prefix_flags] |
514f746b AR |
30 | |
31 | # Don't use "debug", so that we don't have line information for the assembly | |
32 | # fragments. | |
33 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } { | |
3b48433d | 34 | untested ${testfile}.exp |
514f746b AR |
35 | return -1 |
36 | } | |
37 | ||
38 | ||
39 | gdb_exit | |
40 | gdb_start | |
41 | gdb_reinitialize_dir $srcdir/$subdir | |
42 | gdb_load ${binfile} | |
43 | ||
44 | # | |
45 | # Run to `main' where we begin our tests. | |
46 | # | |
47 | ||
48 | if ![runto_main] then { | |
49 | return -1 | |
50 | } | |
51 | ||
af48d08f | 52 | set function "standard" |
514f746b | 53 | |
de97fdd4 | 54 | set retcode [gdb_test_multiple "disassemble $function" "disassemble function '$function'" { |
af48d08f PA |
55 | -re "($hex) <\\+0>.*($hex) <\\+$decimal>.*int3.*($hex) <\\+$decimal>.*leave.*$gdb_prompt $" { |
56 | set address_bp $expect_out(2,string) | |
57 | set address_after_bp $expect_out(3,string) | |
514f746b AR |
58 | } |
59 | }] | |
60 | ||
61 | if {$retcode != 0} { | |
bc6c7af4 | 62 | fail "disassemble failed, skipping entire test." |
514f746b AR |
63 | return -1 |
64 | } | |
65 | ||
af48d08f | 66 | gdb_breakpoint "*$address_bp" |
514f746b | 67 | |
af48d08f PA |
68 | gdb_test "continue" "Breakpoint .*, $address_bp in $function.*" \ |
69 | "stop at permanent breakpoint" | |
514f746b | 70 | |
af48d08f PA |
71 | # We want to fetch the stack pointer at the start of '$function' |
72 | # function to make sure the skip_permanent_breakpoint implementation | |
73 | # really skips only the permanent breakpoint. If, for whatever | |
74 | # reason, the 'leave' instruction executes, the stack pointer will not | |
75 | # have this value. | |
76 | set start_sp 0 | |
77 | gdb_test_multiple "print \$sp" "fetch stack pointer value" { | |
514f746b | 78 | -re "\\\$1.*($hex).*$gdb_prompt $" { |
af48d08f | 79 | set start_sp $expect_out(1,string) |
514f746b AR |
80 | } |
81 | } | |
82 | ||
af48d08f PA |
83 | gdb_test "stepi" "$address_after_bp in $function.*" \ |
84 | "single-step past permanent breakpoint" | |
514f746b | 85 | |
af48d08f PA |
86 | gdb_test "print \$sp" ".*$start_sp.*" \ |
87 | "stack pointer value matches" |