]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/arr-subrange.exp
aed93cd4fe90b9e29e12a099849a8f7924bfb052
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / arr-subrange.exp
1 # Copyright 2014-2016 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 load_lib dwarf.exp
16
17 # This test can only be run on targets which support DWARF-2 and use gas.
18 if {![dwarf2_support]} {
19 return 0
20 }
21
22 standard_testfile arr-subrange.c arr-subrange-dw.S
23
24 # Make some DWARF for the test.
25 set asm_file [standard_output_file $srcfile2]
26 Dwarf::assemble $asm_file {
27 cu {} {
28 DW_TAG_compile_unit {
29 {DW_AT_language @DW_LANG_Ada95}
30 {DW_AT_name foo.adb}
31 {DW_AT_comp_dir /tmp}
32 {DW_AT_low_pc 0x1000 addr}
33 {DW_AT_high_pc 0x2000 addr}
34 } {
35 declare_labels boolean_label typedef_label array_label enum_label
36
37 boolean_label: DW_TAG_base_type {
38 {DW_AT_byte_size 1 DW_FORM_sdata}
39 {DW_AT_encoding @DW_ATE_boolean}
40 {DW_AT_name boolean}
41 }
42
43 typedef_label: DW_TAG_typedef {
44 {DW_AT_name pck__table}
45 {DW_AT_type :$array_label}
46 }
47
48 array_label: DW_TAG_array_type {
49 {DW_AT_name pck__table}
50 {DW_AT_type :$boolean_label}
51 } {
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}
56 }
57 }
58
59 enum_label: DW_TAG_enumeration_type {
60 {DW_AT_name pck__enum_t}
61 {DW_AT_byte_size 1 DW_FORM_sdata}
62 } {
63 DW_TAG_enumerator {
64 {DW_AT_name pck__enum_000}
65 {DW_AT_const_value 0 DW_FORM_sdata}
66 }
67 DW_TAG_enumerator {
68 {DW_AT_name pck__enum_001}
69 {DW_AT_const_value 1 DW_FORM_sdata}
70 }
71 DW_TAG_enumerator {
72 {DW_AT_name pck__enum_128}
73 {DW_AT_const_value 128 DW_FORM_sdata}
74 }
75 }
76 }
77 }
78 }
79
80 if { [prepare_for_testing "failed to prepare" ${testfile} \
81 [list $srcfile $asm_file] {nodebug}] } {
82 return -1
83 }
84
85 gdb_test_no_output "set language ada"
86
87 gdb_test "ptype pck.table" \
88 "type = array \\(enum_000 \\.\\. enum_128\\) of boolean"