1 # Copyright 2018-2020 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 # This tests a segfault that occurs when reading inlined_subroutine DIEs
17 # with abstract_origins pointing to DIEs in other CUs.
19 # See https://bugzilla.redhat.com/show_bug.cgi?id=1638798 .
23 # This test can only be run on targets which support DWARF.
24 if {![dwarf2_support]} {
28 standard_testfile main.c .S
30 # Create the DWARF. This is derived from the reproducer in the Fedora
31 # bugzila mentioned above. For clarity, some "superfluous" DIES have
32 # been left instead of simplifying/pruning the test further.
33 set asm_file [standard_output_file $srcfile2]
34 Dwarf::assemble $asm_file {
35 declare_labels Db D72f8 D736e
36 declare_labels D266465 D266477 D266483 D266496 D266498 D266ad3 D266ad9 \
37 D266ade D26b227 D26b237
38 declare_labels D26d8b1 D26d8c3 D26d8cf D26d944 D26d946 D26e103 D26e145 \
39 D26e415 D26e48c D26df00 D26df06 D26df0b D272519 D274c1a D274c42
43 {language @DW_LANG_C99}
47 {abstract_origin %$D272519}
51 D736e: inlined_subroutine {
52 {abstract_origin %$D26b227}
57 {abstract_origin %$D274c42}
65 D266465: compile_unit {
66 {language @DW_LANG_C99}
75 {encoding @DW_ATE_unsigned}
78 D266496: pointer_type {
82 D266498: restrict_type {
86 D266ad3: pointer_type {
91 D266ad9: restrict_type {
95 D266ade: const_type {}
102 D26b237: formal_parameter {
119 D26d8b1: compile_unit {
120 {language @DW_LANG_C99}
129 {encoding @DW_ATE_unsigned}
130 {name "long unsigned int"}
133 D26d944: pointer_type {
137 D26d946: restrict_type {
141 D26e103: structure_type {
148 {data_member_location 0 sdata}
152 D26e145: pointer_type {
162 D26e48c: pointer_type {
167 D26df00: pointer_type {
172 D26df06: restrict_type {
176 D26df0b: const_type {}
178 D272519: subprogram {
179 {name "bytes_repeat"}
183 D274c1a: subprogram {
196 D274c42: formal_parameter {
205 if {[prepare_for_testing "failed to prepare" $testfile \
206 "${asm_file} ${srcfile}" {}]} {
210 # All we need to do is set a breakpoint, which causes the DWARF
211 # info to be read, to demonstrate the problem.
213 gdb_breakpoint "bytes_repeat" message