Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / ada-thick-pointer.exp
CommitLineData
88b9d363 1# Copyright 2020-2022 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.
22if {![dwarf2_support]} {
23 return 0
24}
25
26standard_testfile main.c -debug.S
27
28# Set up the DWARF for the test.
29
30set asm_file [standard_output_file $srcfile2]
31Dwarf::assemble $asm_file {
32 global srcdir subdir srcfile
33
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
40
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}
45 }
46
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}
55 }
56 }
57
58 array_pointer: DW_TAG_pointer_type {
59 {DW_AT_type :$array}
60 {DW_AT_byte_size 8 DW_FORM_sdata}
61 }
62
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}
68 }
69
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}
78 }
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}
83 }
84 }
85 }
86 }
87}
88
89if { [prepare_for_testing "failed to prepare" ${testfile} \
90 [list $srcfile $asm_file] {nodebug}] } {
91 return -1
92}
93
94gdb_test_no_output "set language ada"
95gdb_test "ptype array_type" "type = array \\(1 \\.\\. 7\\) of integer"
This page took 0.116193 seconds and 4 git commands to generate.