Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.ada / catch_assert_if.exp
blob48b1c85b8bc5cb1b769b6e47e1219bcbf473aadf
1 # Copyright 2018-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 load_lib "ada.exp"
18 require allow_ada_tests gnat_runtime_has_debug_info
20 standard_ada_testfile bla
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-gnata ]] != "" } {
23    return -1
26 clean_restart ${testfile}
28 set eol "\r\n"
29 set sp "\[ \t\]*"
31 # Here is the scenario:
32 #  - Restart the debugger from scratch, runto_main
33 #    We'll catch assertions if Global_Var = 2
34 #  - continue, we should see the second failed assertion
35 #  - continue, the program exits.
37 if {![runto_main]} {
38    return 0
41 gdb_test "catch assert if Global_Var = 2" \
42          "Catchpoint $decimal: failed Ada assertions" \
43          "insert catchpoint on failed assertions with condition"
45 # Check that condition is stored and properly displayed.
47 set exp_bp ".*$decimal${sp}catchpoint${sp}keep${sp}y${sp}failed Ada assertions$eol${sp}stop only if Global_Var = 2.*"
48 gdb_test "info breakpoint" $exp_bp "Check catch assertions with condition"
50 set bp_location [gdb_get_line_number "STOP" ${testdir}/bla.adb]
52 set catchpoint_msg \
53   "Catchpoint $decimal, failed assertion at $hex in bla \\\(\\\).*at .*bla.adb:$bp_location"
54 gdb_test "continue" \
55          "Continuing\\.$eol$eol$catchpoint_msg$eol.*STOP" \
56          "continuing to expected failed assertion"
58 gdb_test "continue" \
59          "Continuing\\..*$inferior_exited_re.*" \
60          "continuing to program completion"