Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / inlined_subroutine-inheritance.exp
blob88de1086ae5b184ecd821234500e7ac53f0e10c3
1 # Copyright 2018-2024 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 require dwarf2_support
26 standard_testfile main.c .S
28 # Create the DWARF.  This is derived from the reproducer in the Fedora
29 # bugzila mentioned above.  For clarity, some "superfluous" DIES have
30 # been left instead of simplifying/pruning the test further.
31 set asm_file [standard_output_file $srcfile2]
32 Dwarf::assemble $asm_file {
33     declare_labels Db D72f8 D736e
34     declare_labels D266465 D266477 D266483 D266496 D266498 D266ad3 D266ad9 \
35         D266ade D26b227 D26b237
36     declare_labels D26d8b1 D26d8c3 D26d8cf D26d944 D26d946 D26e103 D26e145 \
37         D26e415 D26e48c D26df00 D26df06 D26df0b D272519 D274c1a D274c42
39     cu {} {
40         Db: compile_unit {
41             {language @DW_LANG_C99}
42             {name "<artificial>"}
43         } {
44             D72f8: subprogram {
45                 {abstract_origin %$D272519}
46                 {low_pc 0xb9e20 addr}
47                 {high_pc 0x1f5 data4}
48             } {
49                 D736e: inlined_subroutine {
50                     {abstract_origin %$D26b227}
51                     {low_pc 0xb9efc addr}
52                     {high_pc 0xc data4}
53                 } {
54                     formal_parameter {
55                         {abstract_origin %$D274c42}
56                     }
57                 }
58             }
59         }
60     }
62     cu {} {
63         D266465: compile_unit {
64             {language @DW_LANG_C99}
65         } {
66             D266477: typedef {
67                 {name "size_t"}
68                 {type :$D266483}
69             }
71             D266483: base_type {
72                 {byte_size 8 sdata}
73                 {encoding @DW_ATE_unsigned}
74             }
76             D266496: pointer_type {
77                 {byte_size 8 sdata}
78             }
80             D266498: restrict_type {
81                 {type :$D266496}
82             }
84             D266ad3: pointer_type {
85                 {byte_size 8 sdata}
86                 {type :$D266ade}
87             }
89             D266ad9: restrict_type {
90                 {type :$D266ad3}
91             }
93             D266ade: const_type {}
95             D26b227: subprogram {
96                 {external 1 flag}
97                 {name "memcpy"}
98                 {type :$D266496}
99             } {
100                 D26b237: formal_parameter {
101                     {name "__dest"}
102                     {type :$D266498}
103                 }
104                 formal_parameter {
105                     {name "__src"}
106                     {type :$D266ad9}
107                 }
108                 formal_parameter {
109                     {name "__len"}
110                     {type :$D266477}
111                 }
112             }
113         }
114     }
116     cu {} {
117         D26d8b1: compile_unit {
118             {language @DW_LANG_C99}
119         } {
120             D26d8c3: typedef {
121                 {name "size_t"}
122                 {type :$D26d8cf}
123             }
125             D26d8cf: base_type {
126                 {byte_size 8 sdata}
127                 {encoding @DW_ATE_unsigned}
128                 {name "long unsigned int"}
129             }
131             D26d944: pointer_type {
132                 {byte_size 8 sdata}
133             }
135             D26d946: restrict_type {
136                 {type :$D26d944}
137             }
139             D26e103: structure_type {
140                 {name "__object"}
141                 {byte_size 12 sdata}
142             } {
143                 member {
144                     {name "__ob_next"}
145                     {type :$D26e145}
146                     {data_member_location 0 sdata}
147                 }
148             }
150             D26e145: pointer_type {
151                 {byte_size 8 sdata}
152                 {type :$D26e103}
153             }
155             D26e415: typedef {
156                 {name "PyObject"}
157                 {type :$D26e103}
158             }
160             D26e48c: pointer_type {
161                 {byte_size 8 sdata}
162                 {type :$D26e415}
163             }
165             D26df00: pointer_type {
166                 {byte_size 8 sdata}
167                 {type :$D26df0b}
168             }
170             D26df06: restrict_type {
171                 {type :$D26df00}
172             }
174             D26df0b: const_type {}
176             D272519: subprogram {
177                 {name "bytes_repeat"}
178                 {type :$D26e48c}
179             }
181             D274c1a: subprogram {
182                 {external 1 flag}
183                 {name "memcpy"}
184                 {type :$D26d944}
185             } {
186                 formal_parameter {
187                     {name "__dest"}
188                     {type :$D26d946}
189                 }
190                 formal_parameter {
191                     {name "__src"}
192                     {type :$D26df06}
193                 }
194                 D274c42: formal_parameter {
195                     {name "__len"}
196                     {type :$D26d8c3}
197                 }
198             }
199         }
200     }
203 if {[prepare_for_testing "failed to prepare" $testfile \
204          "${asm_file} ${srcfile}" {}]} {
205     return -1
208 # All we need to do is set a breakpoint, which causes the DWARF
209 # info to be read, to demonstrate the problem.
211 gdb_breakpoint "bytes_repeat" message