1 # Copyright
2021-2022 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 #
Set a breakpoint
on libc
's _exit, and verify that it triggers. The function
17 # tends to do a syscall immediately after the prologue, and if the breakpoint is
18 # set past the syscall due to faulty prologue skipping, the breakpoint will not
21 # In particular, we're trying to excercise the instruction analysis
22 # functionality of prologue skipping.
If the non
-minimal symbols are
23 # read
for libc
, then that functionality might not be used because f.i.
24 # line
-info is used instead. Also
, if the minimal symbols are not read
25 #
for libc
, then the breakpoint is
set on the exec
-local _exit@plt instead
,
26 # and that functionality will also not be used.
28 # We may
get the required setup in case of a libc with misssing separate
29 # debuginfo
, but we want the same effect
if that debuginfo is installed.
31 # So
, we use
-readnever to read minimal symbols
, but not non
-miminal symbols.
33 # Because the code at _exit may be and usually is optimized
, the test is in
34 # the gdb.opt directory.
38 # See
if we have target board readnow.exp or similar.
39 if { [lsearch
-exact $GDBFLAGS
-readnow
] != -1 \
40 ||
[lsearch
-exact $GDBFLAGS
--readnow
] != -1 } {
41 untested
"--readnever not allowed in combination with --readnow"
45 save_vars
{ GDBFLAGS
} {
46 append GDBFLAGS
" -readnever"
48 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile nodebug]} {
53 if ![runto_main
] then {
57 gdb_breakpoint
"_exit"
59 # Give some background information about the breakpoint
(s
) and corresponding
61 gdb_test
"info breakpoints"
62 gdb_test
"info shared"
64 #
If the skip_prologue analysis of _exit is too eager
, we may not hit the
66 gdb_continue_to_breakpoint
"_exit" "_exit \\(\\) .*"