1 # Copyright 2021-2023 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/>.
18 # This test can only be run on x86-64 targets. It checks for a bug
19 # that existed in amd64-tdep.c, and depends on an error being produced
20 # from within that file.
21 if {![istarget x86_64-*] || ![is_lp64_target]} {
25 # This test can only be run on targets which support DWARF-2 and use gas.
26 if {![dwarf2_support]} {
30 standard_testfile .c -dw.S
32 # Make some DWARF for the test.
33 set asm_file [standard_output_file $srcfile2]
34 Dwarf::assemble $asm_file {
42 {DW_AT_language @DW_LANG_C}
46 declare_labels integer_label foo_t_label bar_t_label
48 foo_t_label: DW_TAG_structure_type {
50 {byte_size 3 DW_FORM_sdata}
54 {type :$integer_label}
55 {data_member_location 0 DW_FORM_sdata}
59 integer_label: DW_TAG_base_type {
60 {DW_AT_byte_size 3 DW_FORM_sdata}
61 {DW_AT_encoding @DW_ATE_signed}
65 bar_t_label: DW_TAG_structure_type {
67 {byte_size 3 DW_FORM_sdata}
72 {data_member_location 0 DW_FORM_sdata}
78 {low_pc $main_start addr}
79 {high_pc $main_len data8}
80 {DW_AT_type :$integer_label}
85 {low_pc $get_bar_start addr}
86 {high_pc $get_bar_len data8}
87 {DW_AT_type :$bar_t_label}
93 if { [prepare_for_testing "failed to prepare" ${testfile} \
94 [list $srcfile $asm_file] {nodebug}] } {
102 # At one point this would trigger a divide by zero inside GDB. Now we
103 # just get an error message.
104 gdb_test "print get_bar ()" "could not determine alignment of type"
106 # Check GDB is still running.
107 gdb_test "p 1 + 2" " = 3"