]>
Commit | Line | Data |
---|---|---|
076855f9 PA |
1 | # Copyright 2014 Free Software Foundation, Inc. |
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 | if {[skip_hw_breakpoint_tests]} { | |
17 | return 0 | |
18 | } | |
19 | ||
20 | standard_testfile | |
21 | ||
22 | if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { | |
23 | return -1 | |
24 | } | |
25 | ||
26 | if ![runto_main] { | |
27 | fail "Can't run to main" | |
28 | return -1 | |
29 | } | |
30 | ||
831517df YQ |
31 | # If we can read the memory at address 0, skip the test. |
32 | gdb_test_multiple "x 0" "memory at address 0" { | |
33 | -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { } | |
34 | -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { } | |
35 | -re ".*$gdb_prompt $" { | |
36 | untested "Memory at address 0 is readable" | |
37 | return | |
38 | } | |
39 | } | |
40 | ||
076855f9 PA |
41 | delete_breakpoints |
42 | ||
43 | # Test whether the target supports hardware breakpoints at all. | |
44 | ||
45 | set supports_hbreak 0 | |
46 | set test "probe hardware breakpoint support" | |
47 | gdb_test_multiple "hbreak main" $test { | |
48 | -re "No hardware breakpoint support in the target.*$gdb_prompt $" { | |
49 | pass $test | |
50 | } | |
51 | -re "Hardware breakpoints used exceeds limit.*$gdb_prompt $" { | |
52 | pass $test | |
53 | } | |
54 | -re "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*$gdb_prompt $" { | |
55 | set supports_hbreak 1 | |
56 | pass $test | |
57 | } | |
58 | } | |
59 | ||
60 | if {!$supports_hbreak} { | |
61 | unsupported "hardware breakpoints" | |
62 | return | |
63 | } | |
64 | ||
65 | delete_breakpoints | |
66 | ||
67 | # Force immediate breakpoint insertion. | |
68 | gdb_test_no_output "set breakpoint always-inserted on" | |
69 | ||
70 | # Hardware breakpoints are implemented using a mechanism that is not | |
71 | # dependent on being able to modify the target's memory, we should be | |
72 | # able to set them even in unmapped memory areas. | |
73 | gdb_test "hbreak *0" "Hardware assisted breakpoint \[0-9\]+ at 0x0" | |
74 | ||
75 | gdb_test "info break" "hw breakpoint.*y.*0x0\+\[ \t\]\+" \ | |
76 | "info break shows hw breakpoint" | |
77 | ||
78 | gdb_test_no_output "delete \$bpnum" "" "delete" \ | |
79 | "delete hw breakpoint" | |
80 | ||
81 | gdb_test "info break" "No breakpoints or watchpoints\." \ | |
82 | "info break shows no breakpoints" |