]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/solib-abort.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / solib-abort.exp
1 # Copyright 2023-2024 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 # Test corner case of printing solib name when unwinding.
17 # https://sourceware.org/bugzilla/show_bug.cgi?id=29074
18
19 require allow_shlib_tests
20
21 # Library file.
22 set libname "solib-abort-lib"
23 set srcfile_lib ${srcdir}/${subdir}/${libname}.c
24 set binfile_lib [standard_output_file ${libname}.so]
25 # Note: no debugging info here, since this will assure that the solib
26 # name is printed in the stack trace.
27 set lib_flags {}
28
29 # Binary file.
30 set testfile "solib-abort"
31 set srcfile ${srcdir}/${subdir}/${testfile}.c
32 set binfile [standard_output_file ${testfile}]
33 set bin_flags [list debug shlib=${binfile_lib}]
34
35 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
36 || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
37 untested "failed to compile"
38 return -1
39 }
40
41 clean_restart $binfile
42
43 if {![runto_main]} {
44 return 0
45 }
46
47 # Run until the program dies.
48 gdb_test "cont" "Program received signal SIGABRT,.*"
49
50 # The solib name should show up in the stack trace. The bug here was
51 # that if the function calling abort appeared last in the text
52 # section, and if GCC didn't emit an epilogue after the call, then gdb
53 # would use the wrong PC to find the solib name. This test doesn't
54 # exactly test this in all situations, but with the correct
55 # environment it is sufficient.
56 gdb_test "bt" "#$decimal .* in callee .* from .*${libname}\\.so.*"