1 # Copyright 2014-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/>.
17 # This test can only be run on targets which support DWARF-2 and use gas.
18 if {![dwarf2_support]} {
22 standard_testfile arr-subrange.c arr-subrange-dw.S
24 # Make some DWARF for the test.
25 set asm_file [standard_output_file $srcfile2]
26 Dwarf::assemble $asm_file {
29 {DW_AT_language @DW_LANG_Ada95}
32 {DW_AT_low_pc 0x1000 addr}
33 {DW_AT_high_pc 0x2000 addr}
35 declare_labels boolean_label typedef_label array_label enum_label
37 boolean_label: DW_TAG_base_type {
38 {DW_AT_byte_size 1 DW_FORM_sdata}
39 {DW_AT_encoding @DW_ATE_boolean}
43 typedef_label: DW_TAG_typedef {
44 {DW_AT_name pck__table}
45 {DW_AT_type :$array_label}
48 array_label: DW_TAG_array_type {
49 {DW_AT_name pck__table}
50 {DW_AT_type :$boolean_label}
52 DW_TAG_subrange_type {
53 {DW_AT_type :$enum_label}
54 {DW_AT_lower_bound 0 DW_FORM_data1}
55 {DW_AT_upper_bound 128 DW_FORM_data1}
59 enum_label: DW_TAG_enumeration_type {
60 {DW_AT_name pck__enum_t}
61 {DW_AT_byte_size 1 DW_FORM_sdata}
64 {DW_AT_name pck__enum_000}
65 {DW_AT_const_value 0 DW_FORM_sdata}
68 {DW_AT_name pck__enum_001}
69 {DW_AT_const_value 1 DW_FORM_sdata}
72 {DW_AT_name pck__enum_128}
73 {DW_AT_const_value 128 DW_FORM_sdata}
80 if { [prepare_for_testing "failed to prepare" ${testfile} \
81 [list $srcfile $asm_file] {nodebug}] } {
85 gdb_test_no_output "set language ada"
87 gdb_test "ptype pck.table" \
88 "type = array \\(enum_000 \\.\\. enum_128\\) of boolean"