Automatic date update in version.in
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.dwarf2 / ada-thick-pointer.exp
blob781efd6a580f12d66909ecc800c7c538d7cbc3f8
1 # Copyright 2020-2022 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/>.
16 # Test that handling of Ada thick pointers does not rewrite other
17 # similar types.
19 load_lib dwarf.exp
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 if {![dwarf2_support]} {
23 return 0
26 standard_testfile main.c -debug.S
28 # Set up the DWARF for the test.
30 set asm_file [standard_output_file $srcfile2]
31 Dwarf::assemble $asm_file {
32 global srcdir subdir srcfile
34 cu {} {
35 DW_TAG_compile_unit {
36 {DW_AT_language @DW_LANG_Ada95}
37 {DW_AT_name $srcfile}
38 } {
39 declare_labels integer array array_pointer bounds_pointer
41 integer: DW_TAG_base_type {
42 {DW_AT_byte_size 8 DW_FORM_sdata}
43 {DW_AT_encoding @DW_ATE_signed}
44 {DW_AT_name integer}
47 array: DW_TAG_array_type {
48 {DW_AT_name array_type}
49 {DW_AT_type :$integer}
50 } {
51 DW_TAG_subrange_type {
52 {DW_AT_type :$integer}
53 {DW_AT_lower_bound 1 DW_FORM_data1}
54 {DW_AT_upper_bound 7 DW_FORM_data1}
58 array_pointer: DW_TAG_pointer_type {
59 {DW_AT_type :$array}
60 {DW_AT_byte_size 8 DW_FORM_sdata}
63 # This isn't exactly what GNAT emits, but it doesn't
64 # matter.
65 bounds_pointer: DW_TAG_pointer_type {
66 {DW_AT_type :$integer}
67 {DW_AT_byte_size 8 DW_FORM_sdata}
70 DW_TAG_structure_type {
71 {DW_AT_name thick_pointer_type}
72 {DW_AT_byte_size 8 DW_FORM_sdata}
73 } {
74 DW_TAG_member {
75 {DW_AT_name P_ARRAY}
76 {DW_AT_type :$array_pointer}
77 {DW_AT_data_member_location 0 DW_FORM_sdata}
79 DW_TAG_member {
80 {DW_AT_name P_BOUNDS}
81 {DW_AT_type :$bounds_pointer}
82 {DW_AT_data_member_location 8 DW_FORM_sdata}
89 if { [prepare_for_testing "failed to prepare" ${testfile} \
90 [list $srcfile $asm_file] {nodebug}] } {
91 return -1
94 gdb_test_no_output "set language ada"
95 gdb_test "ptype array_type" "type = array \\(1 \\.\\. 7\\) of integer"