1*56bb7041Schristos# Copyright 2020 Free Software Foundation, Inc.
2*56bb7041Schristos#
3*56bb7041Schristos# This program is free software; you can redistribute it and/or modify
4*56bb7041Schristos# it under the terms of the GNU General Public License as published by
5*56bb7041Schristos# the Free Software Foundation; either version 3 of the License, or
6*56bb7041Schristos# (at your option) any later version.
7*56bb7041Schristos#
8*56bb7041Schristos# This program is distributed in the hope that it will be useful,
9*56bb7041Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
10*56bb7041Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11*56bb7041Schristos# GNU General Public License for more details.
12*56bb7041Schristos#
13*56bb7041Schristos# You should have received a copy of the GNU General Public License
14*56bb7041Schristos# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15*56bb7041Schristos
16*56bb7041Schristosload_lib "ada.exp"
17*56bb7041Schristosload_lib "gdb-python.exp"
18*56bb7041Schristos
19*56bb7041Schristosif { [skip_ada_tests] } { return -1 }
20*56bb7041Schristos
21*56bb7041Schristosstandard_ada_testfile pkg
22*56bb7041Schristos
23*56bb7041Schristosforeach_with_prefix scenario {none all minimal} {
24*56bb7041Schristos    set flags {debug}
25*56bb7041Schristos    if {$scenario != "none"} {
26*56bb7041Schristos	lappend flags additional_flags=-fgnat-encodings=$scenario
27*56bb7041Schristos    }
28*56bb7041Schristos
29*56bb7041Schristos    if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
30*56bb7041Schristos	return -1
31*56bb7041Schristos    }
32*56bb7041Schristos
33*56bb7041Schristos    clean_restart ${testfile}
34*56bb7041Schristos
35*56bb7041Schristos    set bp_location [gdb_get_line_number "STOP" ${testdir}/pkg.adb]
36*56bb7041Schristos    runto "pkg.adb:$bp_location"
37*56bb7041Schristos
38*56bb7041Schristos    gdb_test "print r" "= \\(c => 100 'd'\\)"
39*56bb7041Schristos    gdb_test "print q" " = \\(c => 0 '\\\[\"00\"\\\]', x_first => 27\\)"
40*56bb7041Schristos
41*56bb7041Schristos    gdb_test "print st1" " = \\(i => -4, one => 1, x => 2\\)"
42*56bb7041Schristos    gdb_test "print st2" " = \\(i => 99, one => 1, y => 77\\)"
43*56bb7041Schristos
44*56bb7041Schristos    gdb_test "print nav1" " = \\(one => 0, two => 93, str => \"\"\\)"
45*56bb7041Schristos    gdb_test "print nav2" \
46*56bb7041Schristos	" = \\(one => 3, two => 0, str => \"zzz\", onevalue => 33, str2 => \"\"\\)"
47*56bb7041Schristos    gdb_test "print nav3" \
48*56bb7041Schristos	" = \\(one => 3, two => 7, str => \"zzz\", onevalue => 33, str2 => \"qqqqqqq\", twovalue => 88\\)"
49*56bb7041Schristos
50*56bb7041Schristos    # This is only supported for the DWARF encoding.
51*56bb7041Schristos    if {$scenario == "minimal" && ![skip_python_tests]} {
52*56bb7041Schristos	gdb_test_no_output \
53*56bb7041Schristos	    "python t = gdb.lookup_type('nested_and_variable')" \
54*56bb7041Schristos	    "fetch type for python"
55*56bb7041Schristos	gdb_test "python print(t.dynamic)" "True"
56*56bb7041Schristos	gdb_test "python print(t\['onevalue'\].bitpos)" "None"
57*56bb7041Schristos    }
58*56bb7041Schristos}
59