Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2018-2020 Free Software Foundation, Inc. |
c24bdb02 KS |
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/>. | |
15 | ||
16 | # This tests a segfault that occurs when reading inlined_subroutine DIEs | |
17 | # with abstract_origins pointing to DIEs in other CUs. | |
18 | # | |
19 | # See https://bugzilla.redhat.com/show_bug.cgi?id=1638798 . | |
20 | ||
21 | load_lib dwarf.exp | |
22 | ||
23 | # This test can only be run on targets which support DWARF. | |
24 | if {![dwarf2_support]} { | |
25 | return 0 | |
26 | } | |
27 | ||
28 | standard_testfile main.c .S | |
29 | ||
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 | |
40 | ||
41 | cu {} { | |
42 | Db: compile_unit { | |
43 | {language @DW_LANG_C99} | |
44 | {name "<artificial>"} | |
45 | } { | |
46 | D72f8: subprogram { | |
385b97d3 | 47 | {abstract_origin %$D272519} |
c24bdb02 KS |
48 | {low_pc 0xb9e20 addr} |
49 | {high_pc 0x1f5 data4} | |
50 | } { | |
51 | D736e: inlined_subroutine { | |
385b97d3 | 52 | {abstract_origin %$D26b227} |
c24bdb02 KS |
53 | {low_pc 0xb9efc addr} |
54 | {high_pc 0xc data4} | |
55 | } { | |
56 | formal_parameter { | |
385b97d3 | 57 | {abstract_origin %$D274c42} |
c24bdb02 KS |
58 | } |
59 | } | |
60 | } | |
61 | } | |
62 | } | |
63 | ||
64 | cu {} { | |
65 | D266465: compile_unit { | |
66 | {language @DW_LANG_C99} | |
67 | } { | |
68 | D266477: typedef { | |
69 | {name "size_t"} | |
70 | {type :$D266483} | |
71 | } | |
72 | ||
73 | D266483: base_type { | |
74 | {byte_size 8 sdata} | |
75 | {encoding @DW_ATE_unsigned} | |
76 | } | |
77 | ||
78 | D266496: pointer_type { | |
79 | {byte_size 8 sdata} | |
80 | } | |
81 | ||
82 | D266498: restrict_type { | |
83 | {type :$D266496} | |
84 | } | |
85 | ||
86 | D266ad3: pointer_type { | |
87 | {byte_size 8 sdata} | |
88 | {type :$D266ade} | |
89 | } | |
90 | ||
91 | D266ad9: restrict_type { | |
92 | {type :$D266ad3} | |
93 | } | |
94 | ||
95 | D266ade: const_type {} | |
96 | ||
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 | } | |
117 | ||
118 | cu {} { | |
119 | D26d8b1: compile_unit { | |
120 | {language @DW_LANG_C99} | |
121 | } { | |
122 | D26d8c3: typedef { | |
123 | {name "size_t"} | |
124 | {type :$D26d8cf} | |
125 | } | |
126 | ||
127 | D26d8cf: base_type { | |
128 | {byte_size 8 sdata} | |
129 | {encoding @DW_ATE_unsigned} | |
130 | {name "long unsigned int"} | |
131 | } | |
132 | ||
133 | D26d944: pointer_type { | |
134 | {byte_size 8 sdata} | |
135 | } | |
136 | ||
137 | D26d946: restrict_type { | |
138 | {type :$D26d944} | |
139 | } | |
140 | ||
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 | } | |
151 | ||
152 | D26e145: pointer_type { | |
153 | {byte_size 8 sdata} | |
154 | {type :$D26e103} | |
155 | } | |
156 | ||
157 | D26e415: typedef { | |
158 | {name "PyObject"} | |
159 | {type :$D26e103} | |
160 | } | |
161 | ||
162 | D26e48c: pointer_type { | |
163 | {byte_size 8 sdata} | |
164 | {type :$D26e415} | |
165 | } | |
166 | ||
167 | D26df00: pointer_type { | |
168 | {byte_size 8 sdata} | |
169 | {type :$D26df0b} | |
170 | } | |
171 | ||
172 | D26df06: restrict_type { | |
173 | {type :$D26df00} | |
174 | } | |
175 | ||
176 | D26df0b: const_type {} | |
177 | ||
178 | D272519: subprogram { | |
179 | {name "bytes_repeat"} | |
180 | {type :$D26e48c} | |
181 | } | |
182 | ||
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 | } | |
203 | } | |
204 | ||
205 | if {[prepare_for_testing "failed to prepare" $testfile \ | |
206 | "${asm_file} ${srcfile}" {}]} { | |
207 | return -1 | |
208 | } | |
209 | ||
210 | # All we need to do is set a breakpoint, which causes the DWARF | |
211 | # info to be read, to demonstrate the problem. | |
212 | ||
213 | gdb_breakpoint "bytes_repeat" message |