Update copyright year range in all GDB files.
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / inlined_subroutine-inheritance.exp
blobef3078afab96765b4224ee4a5cb50fe42c77969d
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 .
21 load_lib dwarf.exp
23 # This test can only be run on targets which support DWARF.
24 if {![dwarf2_support]} {
25     return 0
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
41     cu {} {
42         Db: compile_unit {
43             {language @DW_LANG_C99}
44             {name "<artificial>"}
45         } {
46             D72f8: subprogram {
47                 {abstract_origin %$D272519}
48                 {low_pc 0xb9e20 addr}
49                 {high_pc 0x1f5 data4}
50             } {
51                 D736e: inlined_subroutine {
52                     {abstract_origin %$D26b227}
53                     {low_pc 0xb9efc addr}
54                     {high_pc 0xc data4}
55                 } {
56                     formal_parameter {
57                         {abstract_origin %$D274c42}
58                     }
59                 }
60             }
61         }
62     }
64     cu {} {
65         D266465: compile_unit {
66             {language @DW_LANG_C99}
67         } {
68             D266477: typedef {
69                 {name "size_t"}
70                 {type :$D266483}
71             }
73             D266483: base_type {
74                 {byte_size 8 sdata}
75                 {encoding @DW_ATE_unsigned}
76             }
78             D266496: pointer_type {
79                 {byte_size 8 sdata}
80             }
82             D266498: restrict_type {
83                 {type :$D266496}
84             }
86             D266ad3: pointer_type {
87                 {byte_size 8 sdata}
88                 {type :$D266ade}
89             }
91             D266ad9: restrict_type {
92                 {type :$D266ad3}
93             }
95             D266ade: const_type {}
97             D26b227: subprogram {
98                 {external 1 flag}
99                 {name "memcpy"}
100                 {type :$D266496}
101             } {
102                 D26b237: formal_parameter {
103                     {name "__dest"}
104                     {type :$D266498}
105                 }
106                 formal_parameter {
107                     {name "__src"}
108                     {type :$D266ad9}
109                 }
110                 formal_parameter {
111                     {name "__len"}
112                     {type :$D266477}
113                 }
114             }
115         }
116     }
118     cu {} {
119         D26d8b1: compile_unit {
120             {language @DW_LANG_C99}
121         } {
122             D26d8c3: typedef {
123                 {name "size_t"}
124                 {type :$D26d8cf}
125             }
127             D26d8cf: base_type {
128                 {byte_size 8 sdata}
129                 {encoding @DW_ATE_unsigned}
130                 {name "long unsigned int"}
131             }
133             D26d944: pointer_type {
134                 {byte_size 8 sdata}
135             }
137             D26d946: restrict_type {
138                 {type :$D26d944}
139             }
141             D26e103: structure_type {
142                 {name "__object"}
143                 {byte_size 12 sdata}
144             } {
145                 member {
146                     {name "__ob_next"}
147                     {type :$D26e145}
148                     {data_member_location 0 sdata}
149                 }
150             }
152             D26e145: pointer_type {
153                 {byte_size 8 sdata}
154                 {type :$D26e103}
155             }
157             D26e415: typedef {
158                 {name "PyObject"}
159                 {type :$D26e103}
160             }
162             D26e48c: pointer_type {
163                 {byte_size 8 sdata}
164                 {type :$D26e415}
165             }
167             D26df00: pointer_type {
168                 {byte_size 8 sdata}
169                 {type :$D26df0b}
170             }
172             D26df06: restrict_type {
173                 {type :$D26df00}
174             }
176             D26df0b: const_type {}
178             D272519: subprogram {
179                 {name "bytes_repeat"}
180                 {type :$D26e48c}
181             }
183             D274c1a: subprogram {
184                 {external 1 flag}
185                 {name "memcpy"}
186                 {type :$D26d944}
187             } {
188                 formal_parameter {
189                     {name "__dest"}
190                     {type :$D26d946}
191                 }
192                 formal_parameter {
193                     {name "__src"}
194                     {type :$D26df06}
195                 }
196                 D274c42: formal_parameter {
197                     {name "__len"}
198                     {type :$D26d8c3}
199                 }
200             }
201         }
202     }
205 if {[prepare_for_testing "failed to prepare" $testfile \
206          "${asm_file} ${srcfile}" {}]} {
207     return -1
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