]>
Commit | Line | Data |
---|---|---|
0fb0cc75 | 1 | # Copyright (C) 2008, 2009 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 | ||
19 | if $tracelevel { | |
20 | strace $tracelevel | |
21 | } | |
22 | ||
23 | # Test stepping over permanent breakpoints on i386. | |
24 | ||
25 | if ![istarget "i?86-*-*"] then { | |
26 | verbose "Skipping skip over permanent breakpoint on i386 tests." | |
27 | return | |
28 | } | |
29 | ||
30 | set testfile "i386-prologue" | |
31 | set srcfile ${testfile}.c | |
32 | set binfile ${objdir}/${subdir}/${testfile} | |
33 | ||
34 | # some targets have leading underscores on assembly symbols. | |
35 | # TODO: detect this automatically | |
36 | set additional_flags "" | |
37 | if [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. | |
43 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } { | |
44 | untested i386-prologue.exp | |
45 | return -1 | |
46 | } | |
47 | ||
48 | ||
49 | gdb_exit | |
50 | gdb_start | |
51 | gdb_reinitialize_dir $srcdir/$subdir | |
52 | gdb_load ${binfile} | |
53 | ||
54 | # | |
55 | # Run to `main' where we begin our tests. | |
56 | # | |
57 | ||
58 | if ![runto_main] then { | |
59 | return -1 | |
60 | } | |
61 | ||
62 | set function standard | |
63 | ||
64 | set retcode [gdb_test_multiple "disassemble $function" "Disassemble function '$function'" { | |
65 | -re ".*($hex) <$function\\+0>.*($hex) <$function\\+4>.*($hex) <$function\\+5>.*($hex) <$function\\+6>.*$gdb_prompt $" { | |
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 | ||
73 | if {$retcode != 0} { | |
74 | fail "Disassemble failed, skipping entire test." | |
75 | return -1 | |
76 | } | |
77 | ||
78 | gdb_breakpoint "*$function_start" | |
79 | ||
80 | gdb_breakpoint "*$address" | |
81 | ||
82 | gdb_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. | |
89 | set start_esp 0 | |
90 | gdb_test_multiple "print \$esp" "Fetch esp value." { | |
91 | -re "\\\$1.*($hex).*$gdb_prompt $" { | |
92 | set start_esp $expect_out(1,string); | |
93 | } | |
94 | } | |
95 | ||
96 | gdb_test "continue" "Breakpoint .*, $address in $function.*" \ | |
97 | "Stop at permanent breakpoint." | |
98 | ||
99 | gdb_test "stepi" "$address1|$address2 in $function.*" \ | |
100 | "Single stepping past permanent breakpoint." | |
101 | ||
102 | gdb_test "print \$esp" ".*$start_esp.*" \ | |
103 | "ESP value does not match - step_permanent_breakpoint wrong." | |
104 |