1 # Copyright 2019-2025 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 that range types with scalar storage order are handled 17 # properly. 18 19 load_lib "ada.exp" 20 21 require allow_ada_tests 22 23 standard_ada_testfile storage 24 25 # Compilation here will fail with gnat-llvm, because at the moment it 26 # does not support Scalar_Storage_Order. However, if that is ever 27 # implemented, we want the test to start working. So, we examine the 28 # output before deciding if this is a real failure. 29 set output [gdb_compile_ada_1 "${srcfile}" "${binfile}" executable debug] 30 if {$output != ""} { 31 if {[regexp "error: reverse storage order .* not supported by LLVM" $output]} { 32 unsupported "scalar storage order not supported" 33 } else { 34 # Otherwise issue the fail. 35 gdb_compile_test $srcfile $output 36 } 37 # Either way we're not running this test. 38 return 39 } 40 41 clean_restart ${testfile} 42 43 set bp_location [gdb_get_line_number "START" ${testdir}/storage.adb] 44 if {![runto "storage.adb:$bp_location"]} { 45 return 46 } 47 48 set re "value => 126, another_value => 12, color => green" 49 50 # This requires a compiler fix that is in GCC 14. 51 set have_xfail [expr ![gnat_version_compare >= 14]] 52 set re_color "(red|green|blue|$decimal)" 53 set re_xfail \ 54 "value => $decimal, another_value => $decimal, color => $re_color" 55 56 set re_pre [string_to_regexp " = ("] 57 set re_post [string_to_regexp ")"] 58 set re $re_pre$re$re_post 59 set re_xfail $re_pre$re_xfail$re_post 60 61 foreach var { V_LE V_BE } { 62 gdb_test_multiple "print $var" "" { 63 -re -wrap $re { 64 pass $gdb_test_name 65 } 66 -re -wrap $re_xfail { 67 if { $have_xfail } { 68 xfail $gdb_test_name 69 } else { 70 fail $gdb_test_name 71 } 72 } 73 } 74 } 75