Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2014-2022 Free Software Foundation, Inc. |
55426c9d JB |
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 | ||
8c161360 | 22 | standard_testfile main.c -dw.S |
55426c9d JB |
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} | |
90c3ec2d | 32 | {MACRO_AT_range {main}} |
55426c9d JB |
33 | } { |
34 | declare_labels boolean_label typedef_label array_label enum_label | |
35 | ||
36 | boolean_label: DW_TAG_base_type { | |
37 | {DW_AT_byte_size 1 DW_FORM_sdata} | |
38 | {DW_AT_encoding @DW_ATE_boolean} | |
39 | {DW_AT_name boolean} | |
40 | } | |
41 | ||
42 | typedef_label: DW_TAG_typedef { | |
43 | {DW_AT_name pck__table} | |
44 | {DW_AT_type :$array_label} | |
45 | } | |
46 | ||
47 | array_label: DW_TAG_array_type { | |
48 | {DW_AT_name pck__table} | |
49 | {DW_AT_type :$boolean_label} | |
50 | } { | |
51 | DW_TAG_subrange_type { | |
52 | {DW_AT_type :$enum_label} | |
53 | {DW_AT_lower_bound 0 DW_FORM_data1} | |
54 | {DW_AT_upper_bound 128 DW_FORM_data1} | |
55 | } | |
56 | } | |
57 | ||
58 | enum_label: DW_TAG_enumeration_type { | |
59 | {DW_AT_name pck__enum_t} | |
60 | {DW_AT_byte_size 1 DW_FORM_sdata} | |
61 | } { | |
62 | DW_TAG_enumerator { | |
63 | {DW_AT_name pck__enum_000} | |
64 | {DW_AT_const_value 0 DW_FORM_sdata} | |
65 | } | |
66 | DW_TAG_enumerator { | |
67 | {DW_AT_name pck__enum_001} | |
68 | {DW_AT_const_value 1 DW_FORM_sdata} | |
69 | } | |
70 | DW_TAG_enumerator { | |
71 | {DW_AT_name pck__enum_128} | |
72 | {DW_AT_const_value 128 DW_FORM_sdata} | |
73 | } | |
74 | } | |
75 | } | |
76 | } | |
77 | } | |
78 | ||
5b362f04 | 79 | if { [prepare_for_testing "failed to prepare" ${testfile} \ |
e0c0f156 | 80 | [list $srcfile $asm_file] {nodebug}] } { |
55426c9d JB |
81 | return -1 |
82 | } | |
83 | ||
55426c9d JB |
84 | gdb_test_no_output "set language ada" |
85 | ||
86 | gdb_test "ptype pck.table" \ | |
87 | "type = array \\(enum_000 \\.\\. enum_128\\) of boolean" |