[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.base / hbreak-in-shr-unsupported.exp
blobccc7c61066535644433913efc147e63fab77e7c2
1 # Copyright 2014-2019 Free Software Foundation, Inc.
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.
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.
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/>. */
16 # Test that trying to inserting a hw breakpoint in a shared library
17 # when the target doesn't support hw breakpoints doesn't silently
18 # error out without informing the user.
20 if {[skip_shlib_tests]} {
21 return -1
24 set main_src hbreak-in-shr-unsupported.c
25 set lib_src hbreak-in-shr-unsupported-shr.c
26 standard_testfile ${main_src} ${lib_src}
27 set lib_basename hbreak-in-shr-unsupported-shr.so
28 set lib_so [standard_output_file ${lib_basename}]
30 set lib_opts "debug"
31 set exec_opts [list debug shlib=${lib_so}]
33 if [get_compiler_info] {
34 return -1
37 if { [gdb_compile_shlib ${srcdir}/${subdir}/${lib_src} ${lib_so} $lib_opts] != ""
38 || [gdb_compile ${srcdir}/${subdir}/${main_src} ${binfile} executable $exec_opts] != ""} {
39 untested "failed to compile"
40 return -1
43 clean_restart $binfile
44 gdb_load_shlib $lib_so
46 if ![runto_main] then {
47 fail "can't run to main"
48 return -1
51 set is_target_remote [gdb_is_target_remote]
53 # Get main breakpoint out of the way.
54 delete_breakpoints
56 # Easier to test if GDB inserts breakpoints immediately.
57 gdb_test_no_output "set breakpoint always-inserted on"
59 # Force-disable Z1 packets, in case the target actually supports
60 # these.
61 if {$is_target_remote} {
62 gdb_test_no_output "set remote Z-packet off"
65 # Probe for hw breakpoints support. With Z packets disabled, this
66 # should always fail with remote targets. For other targets, with no
67 # way to force-disable hw breakpoints support, best we can do is skip
68 # the remainder of the test if hardware breakpoint insertion in a
69 # function in the main executable succeeds.
70 set cant_insert_hbreak 0
71 set supports_hbreak 0
72 set test "probe hbreak support"
73 gdb_test_multiple "hbreak main" $test {
74 -re "No hardware breakpoint support in the target.*$gdb_prompt $" {
75 pass $test
77 -re "Hardware breakpoints used exceeds limit.*$gdb_prompt $" {
78 pass $test
80 -re "Cannot insert hardware breakpoint.*$gdb_prompt $" {
81 set cant_insert_hbreak 1
82 set supports_hbreak 1
83 pass $test
85 -re "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*$gdb_prompt $" {
86 set supports_hbreak 1
87 if {$is_target_remote} {
88 # Z-packets have been force-disabled, so this shouldn't
89 # happen.
90 fail $test
91 } else {
92 pass $test
97 if {!$supports_hbreak} {
98 unsupported "no hbreak support"
99 return
102 if {!$cant_insert_hbreak} {
103 unsupported "can't disable hw breakpoint support"
104 return
107 # Get previous hw breakpoint out of the way.
108 delete_breakpoints
110 # Without target support, this should always complain. GDB used to
111 # suppress the error if the breakpoint was set in a shared library.
112 # While that makes sense for software breakpoints (the memory might be
113 # unmapped), it doesn't for hardware breakpoints, as those by
114 # definition are implemented using a mechanism that is not dependent
115 # on being able to modify the target's memory.
116 gdb_test "hbreak shrfunc" "Cannot insert hardware breakpoint.*" \
117 "hbreak shrfunc complains"
119 gdb_test "info break" "hw breakpoint.*y.*$hex.*in shrfunc at.*" \
120 "breakpoint not pending"