]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dwarf2/dw2-align.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-align.exp
CommitLineData
1d506c26 1# Copyright 2018-2024 Free Software Foundation, Inc.
007e1530
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/>.
15load_lib dwarf.exp
16
17# This test can only be run on targets which support DWARF-2 and use gas.
ce8d533e 18require dwarf2_support
007e1530 19
d1c8a76d 20standard_testfile main.c -dw.S
007e1530
TT
21
22# Make some DWARF for the test.
23
24set asm_file [standard_output_file $srcfile2]
25Dwarf::assemble $asm_file {
26 global srcdir subdir srcfile
27
28 cu {} {
29 DW_TAG_compile_unit {
30 {DW_AT_language @DW_LANG_C_plus_plus}
9476b583 31 {DW_AT_name $srcfile}
007e1530
TT
32 {DW_AT_comp_dir /tmp}
33 } {
34 declare_labels itype ptype
35
36 itype: DW_TAG_base_type {
37 {DW_AT_byte_size 4 DW_FORM_sdata}
38 {DW_AT_encoding @DW_ATE_signed}
39 {DW_AT_name int_4096}
40 {DW_AT_alignment 4096 DW_FORM_sdata}
41 }
42
43 ptype: DW_TAG_pointer_type {
44 {DW_AT_byte_size 8 DW_FORM_sdata}
45 {DW_AT_type :$itype}
46 {DW_AT_alignment 4096 DW_FORM_sdata}
47 }
48
49 DW_TAG_typedef {
50 {DW_AT_name ptr_4096}
51 {DW_AT_type :$ptype}
52 }
53
54 DW_TAG_structure_type {
55 {DW_AT_name "struct_4096"}
56 {DW_AT_byte_size 4096 DW_FORM_sdata}
57 {DW_AT_alignment 4096 DW_FORM_udata}
58 } {
59 member {
60 {name a}
61 {type :$itype}
62 {data_member_location 0 data1}
63 }
64 }
65 }
66 }
67}
68
69if { [prepare_for_testing "failed to prepare" ${testfile} \
70 [list $srcfile $asm_file] {nodebug}] } {
71 return -1
72}
73
74if ![runto_main] {
75 return -1
76}
77
78gdb_test_no_output "set lang c++"
79gdb_test "print alignof(int_4096)" " = 4096"
80gdb_test "print alignof(ptr_4096)" " = 4096"
81gdb_test "print alignof(struct_4096)" " = 4096"