]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/ppc64-break-on-_exit.exp
c03215ef9f2110e98eab6747a93e9dd4a1a28f29
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / ppc64-break-on-_exit.exp
1 # Copyright 2021-2023 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 # Set a breakpoint on a local copy of glibc's _exit, and verify that it
17 # triggers. The function does a syscall immediately after the prologue, and
18 # if the breakpoint is set past the syscall due to faulty prologue skipping,
19 # the breakpoint will not trigger.
20 #
21 # In particular, we're trying to excercise the instruction analysis
22 # functionality of prologue skipping. If non-minimal symbols are
23 # read, then that functionality might not be used because f.i.
24 # line-info is used instead. So, we use nodebug.
25
26 require {istarget "powerpc*"} is_lp64_target
27
28 set flags { nodebug }
29 if [info exists COMPILE] {
30 standard_testfile .c -main.c
31 lappend flags optimize=-O2
32 lappend flags additional_flags=-fno-stack-protector
33 lappend flags additional_flags=-mlong-double-128
34 lappend flags additional_flags=-fpic
35 lappend flags additional_flags=-ftls-model=initial-exec
36 } else {
37 standard_testfile .s -main.c
38 }
39
40 if { [prepare_for_testing "failed to prepare" ${testfile} \
41 [list $srcfile $srcfile2] $flags] } {
42 return -1
43 }
44
45 if {![runto_main]} {
46 return 0
47 }
48
49 gdb_breakpoint "_exit"
50
51 # If the skip_prologue analysis of _exit is too eager, we may not hit the
52 # breakpoint.
53 gdb_continue_to_breakpoint "_exit" "_exit \\(\\).*"