binutils-gdb/gdb/testsuite/gdb.ada/variant.exp
Tom Tromey a63b3b2f74 Introduce and use foreach_gnat_encoding
gnat-llvm does not support the -fgnat-encodings flag.  This patch
prepares gdb's Ada tests to handle this situation by introducing a new
foreach_gnat_encoding.  A subsequent patch may change this to support
gnat-llvm; meanwhile this is a little cleaner anyway.
2024-09-06 10:22:13 -06:00

56 lines
2.0 KiB
Plaintext

# Copyright 2020-2024 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib "ada.exp"
load_lib "gdb-python.exp"
require allow_ada_tests
standard_ada_testfile pkg
foreach_gnat_encoding scenario flags {none all minimal} {
lappend flags debug
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
return -1
}
clean_restart ${testfile}-${scenario}
set bp_location [gdb_get_line_number "STOP" ${testdir}/pkg.adb]
runto "pkg.adb:$bp_location"
gdb_test "print r" "= \\(c => 100 'd'\\)"
gdb_test "print q" " = \\(c => 0 '\\\[\"00\"\\\]', x_first => 27\\)"
gdb_test "print st1" " = \\(i => -4, one => 1, x => 2\\)"
gdb_test "print st2" " = \\(i => 99, one => 1, y => 77\\)"
gdb_test "print nav1" " = \\(one => 0, two => 93, str => \"\"\\)"
gdb_test "print nav2" \
" = \\(one => 3, two => 0, str => \"zzz\", onevalue => 33, str2 => \"\"\\)"
gdb_test "print nav3" \
" = \\(one => 3, two => 7, str => \"zzz\", onevalue => 33, str2 => \"qqqqqqq\", twovalue => 88\\)"
# This is only supported for the DWARF encoding.
if {$scenario == "minimal" && [allow_python_tests]} {
gdb_test_no_output \
"python t = gdb.lookup_type('nested_and_variable')" \
"fetch type for python"
gdb_test "python print(t.dynamic)" "True"
gdb_test "python print(t\['onevalue'\].bitpos)" "None"
}
}