[PATCH 5/57][Arm][GAS] Add support for MVE instructions: vmull{b,t}
[binutils-gdb.git] / gdb / testsuite / gdb.ada / catch_ex_std.exp
blob63714a8aa8197305ef43942ebbb924604276bbce
1 # Copyright 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 if {[skip_shlib_tests]} {
17     return 0
20 load_lib "ada.exp"
22 standard_ada_testfile foo
24 set ofile ${binfile}.o
26 set srcfile2 [file join [file dirname $srcfile] some_package.adb]
27 set ofile2 [standard_output_file some_package.o]
28 set sofile [standard_output_file libsome_package.so]
30 set outdir [file dirname $binfile]
32 # To make an Ada shared library we have to jump through a number of
33 # hoops.
35 # First compile to a .o.  We can't compile directly to a .so because
36 # GCC rejects that:
37 #    $ gcc -g -shared -fPIC -o qqz.o some_package.adb
38 #    gcc: error: -c or -S required for Ada
39 # And, we can't compile in "ada" mode because dejagnu will try to
40 # invoke gnatmake, which we don't want.
41 if {[target_compile_ada_from_dir $outdir $srcfile2 $ofile2 \
42          object {debug additional_flags=-fPIC}] != ""} {
43     return -1
46 # Now turn the .o into a shared library.
47 if {[gdb_compile_shlib $ofile2 $sofile \
48          {debug additional_flags=-fPIC}] != ""} {
49     return -1
52 # Now we can compile the main program to an object file; but again, we
53 # can't compile directly using gnatmake.
54 if {[target_compile_ada_from_dir $outdir $srcfile $ofile object debug] != ""} {
55     return -1
58 set gnatbind [find_ada_tool gnatbind]
59 set gnatlink [find_ada_tool gnatlink]
61 with_cwd $outdir {
62     # Bind.
63     set status [remote_exec host "$gnatbind -shared foo"]
64     if {[lindex $status 0] == 0} {
65         pass "gnatbind foo"
66     } else {
67         fail "gnatbind foo"
68         return -1
69     }
71     # Finally, link.
72     if {[istarget "*-*-mingw*"]
73         || [istarget *-*-cygwin*]
74         || [istarget *-*-pe*]
75         || [istarget arm*-*-symbianelf*]} {
76         # Do not need anything.
77         set linkarg ""
78     } elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
79         set linkarg "-Wl,-rpath,$outdir"
80     } else {
81         set linkarg "-Wl,-rpath,\\\$ORIGIN"
82     }
83     set status [remote_exec host "$gnatlink foo $linkarg -Wl,-lsome_package"]
84     if {[lindex $status 0] == 0} {
85         pass "gnatlink foo"
86     } else {
87         fail "gnatlink foo"
88         return -1
89     }
92 clean_restart ${testfile}
94 if {![runto_main]} then {
95    return 0
98 gdb_test "catch exception some_kind_of_error" \
99     "Catchpoint \[0-9\]+: `some_kind_of_error' Ada exception"
101 gdb_test "cont" \
102     "Catchpoint \[0-9\]+, .* at .*foo\.adb:\[0-9\]+.*" \
103     "caught the exception"