1 # Copyright
(C
) 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 breakpoints work correctly when stack protector is used.
18 # Note
on Debian
/Ubuntu
, stack protector is
on by default
, and is
19 # currently force disabled in gdb_compile due to the XFAIL below.
21 # Ensure the compiler is gcc
/clang and is new enough to support stack
23 if { !([test_compiler_info
"gcc-*"] || [test_compiler_info "clang-*"])
24 ||
[test_compiler_info
{gcc
-[0-3]-*}]
25 ||
[test_compiler_info
{gcc
-4-0-*}]
26 ||
[test_compiler_info
{clang
-[0-4]=*}] } {
32 set protector_options
{ "-fno-stack-protector" "-fstack-protector" \
33 "-fstack-protector-all" "-fstack-protector-strong" }
35 proc simple_func_break_test
{ protection
} {
41 lappend options additional_flags
=$protection
43 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile $options]} {
47 clean_restart $
{binfile
}
49 if { ![runto_main
] } then {
50 fail
"can't run to main"
54 #
Break on function foo and ensure it stops
on the first line of code.
57 if { $protection
== "-fstack-protector-all"
58 && [test_compiler_info
"gcc-*"] } {
59 setup_xfail
"gcc/88432" "*-*-linux*"
61 gdb_continue_to_breakpoint
"foo" ".*break here.*"
66 foreach_with_prefix protection $protector_options
{
67 simple_func_break_test $protection