Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.ada / catch_ex_std.exp
blob2eae854162c4bf6d8aed3f3906884735313faf65
1 # Copyright 2019-2024 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 require allow_shlib_tests
18 load_lib "ada.exp"
20 require allow_ada_tests shared_gnat_runtime_has_debug_info
22 standard_ada_testfile foo
24 set srcfile2 [file join [file dirname $srcfile] some_package.adb]
25 set sofile [standard_output_file libsome_package.so]
27 set outdir [file dirname $binfile]
29 # Create the shared library.
30 if {[gdb_compile_shlib $srcfile2 $sofile {ada debug}] != ""} {
31     return -1
34 # Set linkarg such that the executable can find the shared library.
35 if {[istarget "*-*-mingw*"]
36     || [istarget *-*-cygwin*]
37     || [istarget *-*-pe*]} {
38     # Do not need anything.
39     set linkarg ""
40 } elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
41     set linkarg "-Wl,-rpath,$outdir"
42 } else {
43     set linkarg "-Wl,-rpath,\\\$ORIGIN"
46 # Make sure we link against the shared GNAT run time.
47 set gnatbind_options [list -bargs -shared -margs]
49 # Link against the shared library.
50 set gnatlink_options [list -largs $linkarg -Wl,-lsome_package -margs]
52 set options [list debug]
53 foreach option [concat $gnatbind_options $gnatlink_options] {
54     lappend options [concat "additional_flags=" $option]
57 # Create executable.
58 if {[gdb_compile_ada $srcfile $binfile executable $options] != ""} {
59     return -1
62 clean_restart ${testfile}
64 # Do whatever is necessary to make sure that the shared library is
65 # loaded for remote targets.
66 gdb_load_shlib $sofile
68 if {![runto_main]} {
69    return 0
72 gdb_test "catch exception some_kind_of_error" \
73     "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception"
75 gdb_test "cont" \
76     "Catchpoint \[0-9\]+, .* at .*foo\\.adb:\[0-9\]+.*" \
77     "caught the exception"
79 gdb_test "print \$_ada_exception = some_package.some_kind_of_error'Address" \
80     " = true"