]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dwarf2/ada-thick-pointer.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / ada-thick-pointer.exp
CommitLineData
1d506c26 1# Copyright 2020-2024 Free Software Foundation, Inc.
e26624c6
TT
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
16# Test that handling of Ada thick pointers does not rewrite other
17# similar types.
18
19load_lib dwarf.exp
20
21# This test can only be run on targets which support DWARF-2 and use gas.
ce8d533e 22require dwarf2_support
e26624c6
TT
23
24standard_testfile main.c -debug.S
25
26# Set up the DWARF for the test.
27
28set asm_file [standard_output_file $srcfile2]
29Dwarf::assemble $asm_file {
30 global srcdir subdir srcfile
31
32 cu {} {
33 DW_TAG_compile_unit {
34 {DW_AT_language @DW_LANG_Ada95}
35 {DW_AT_name $srcfile}
36 } {
37 declare_labels integer array array_pointer bounds_pointer
38
39 integer: DW_TAG_base_type {
40 {DW_AT_byte_size 8 DW_FORM_sdata}
41 {DW_AT_encoding @DW_ATE_signed}
42 {DW_AT_name integer}
43 }
44
45 array: DW_TAG_array_type {
46 {DW_AT_name array_type}
47 {DW_AT_type :$integer}
48 } {
49 DW_TAG_subrange_type {
50 {DW_AT_type :$integer}
51 {DW_AT_lower_bound 1 DW_FORM_data1}
52 {DW_AT_upper_bound 7 DW_FORM_data1}
53 }
54 }
55
56 array_pointer: DW_TAG_pointer_type {
57 {DW_AT_type :$array}
58 {DW_AT_byte_size 8 DW_FORM_sdata}
59 }
60
61 # This isn't exactly what GNAT emits, but it doesn't
62 # matter.
63 bounds_pointer: DW_TAG_pointer_type {
64 {DW_AT_type :$integer}
65 {DW_AT_byte_size 8 DW_FORM_sdata}
66 }
67
68 DW_TAG_structure_type {
69 {DW_AT_name thick_pointer_type}
70 {DW_AT_byte_size 8 DW_FORM_sdata}
71 } {
72 DW_TAG_member {
73 {DW_AT_name P_ARRAY}
74 {DW_AT_type :$array_pointer}
75 {DW_AT_data_member_location 0 DW_FORM_sdata}
76 }
77 DW_TAG_member {
78 {DW_AT_name P_BOUNDS}
79 {DW_AT_type :$bounds_pointer}
80 {DW_AT_data_member_location 8 DW_FORM_sdata}
81 }
82 }
83 }
84 }
85}
86
87if { [prepare_for_testing "failed to prepare" ${testfile} \
88 [list $srcfile $asm_file] {nodebug}] } {
89 return -1
90}
91
92gdb_test_no_output "set language ada"
93gdb_test "ptype array_type" "type = array \\(1 \\.\\. 7\\) of integer"