]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-archer-vla-tests.patch
- updated to 14.1 + rebased Fedora buildid patches set
[packages/gdb.git] / gdb-archer-vla-tests.patch
1 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.ada/packed_array.exp
2 ===================================================================
3 --- gdb-7.12.50.20170207.orig/gdb/testsuite/gdb.ada/packed_array.exp    2017-02-26 19:15:28.552824751 +0100
4 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.ada/packed_array.exp 2017-02-26 19:15:36.597882316 +0100
5 @@ -56,5 +56,11 @@
6          # are.  Observed with (FSF GNU Ada 4.5.3 20110124).
7          xfail $test
8      }
9 +    -re "= \\(\\)\[\r\n\]+$gdb_prompt $" {
10 +       # archer-jankratochvil-vla resolves it as a dynamic type resolved as an
11 +       # empty array [0..-1].
12 +       # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref)
13 +        xfail $test
14 +    }
15  }
16  
17 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
18 ===================================================================
19 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
20 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S        2017-02-26 19:15:36.598882323 +0100
21 @@ -0,0 +1,358 @@
22 +       .file   "x86_64-vla-pointer.c"
23 +       .text
24 +.Ltext0:
25 +       .globl  foo
26 +       .type   foo, @function
27 +foo:
28 +.LFB0:
29 +       .file 1 "gdb.arch/x86_64-vla-pointer.c"
30 +       # gdb.arch/x86_64-vla-pointer.c:22
31 +       .loc 1 22 0
32 +       .cfi_startproc
33 +# BLOCK 2 seq:0
34 +# PRED: ENTRY (FALLTHRU)
35 +       pushq   %rbp
36 +       .cfi_def_cfa_offset 16
37 +       .cfi_offset 6, -16
38 +       movq    %rsp, %rbp
39 +       .cfi_def_cfa_register 6
40 +       pushq   %rbx
41 +       subq    $56, %rsp
42 +       .cfi_offset 3, -24
43 +       movl    %edi, -52(%rbp)
44 +       # gdb.arch/x86_64-vla-pointer.c:22
45 +       .loc 1 22 0
46 +       movq    %rsp, %rax
47 +       movq    %rax, %rsi
48 +       # gdb.arch/x86_64-vla-pointer.c:23
49 +       .loc 1 23 0
50 +       movl    -52(%rbp), %eax
51 +       movslq  %eax, %rdx
52 +       subq    $1, %rdx
53 +       movq    %rdx, -32(%rbp)
54 +       movslq  %eax, %rdx
55 +       movq    %rdx, %r8
56 +       movl    $0, %r9d
57 +       # gdb.arch/x86_64-vla-pointer.c:24
58 +       .loc 1 24 0
59 +       movslq  %eax, %rdx
60 +       movq    %rdx, %rcx
61 +       movl    $0, %ebx
62 +       cltq
63 +       movl    $16, %edx
64 +       subq    $1, %rdx
65 +       addq    %rdx, %rax
66 +       movl    $16, %ebx
67 +       movl    $0, %edx
68 +       divq    %rbx
69 +       imulq   $16, %rax, %rax
70 +       subq    %rax, %rsp
71 +       movq    %rsp, %rax
72 +       addq    $0, %rax
73 +       movq    %rax, -40(%rbp)
74 +       # gdb.arch/x86_64-vla-pointer.c:27
75 +       .loc 1 27 0
76 +       movl    $0, -20(%rbp)
77 +# SUCC: 4 [100.0%] 
78 +       jmp     .L2
79 +# BLOCK 3 seq:1
80 +# PRED: 4
81 +.L3:
82 +       # gdb.arch/x86_64-vla-pointer.c:28
83 +       .loc 1 28 0 discriminator 3
84 +       movl    -20(%rbp), %eax
85 +       movl    %eax, %ecx
86 +       movq    -40(%rbp), %rdx
87 +       movl    -20(%rbp), %eax
88 +       cltq
89 +       movb    %cl, (%rdx,%rax)
90 +# SUCC: 4 (FALLTHRU,DFS_BACK)
91 +       # gdb.arch/x86_64-vla-pointer.c:27
92 +       .loc 1 27 0 discriminator 3
93 +       addl    $1, -20(%rbp)
94 +# BLOCK 4 seq:2
95 +# PRED: 3 (FALLTHRU,DFS_BACK) 2 [100.0%] 
96 +.L2:
97 +       # gdb.arch/x86_64-vla-pointer.c:27
98 +       .loc 1 27 0 is_stmt 0 discriminator 1
99 +       movl    -20(%rbp), %eax
100 +       cmpl    -52(%rbp), %eax
101 +# SUCC: 3 5 (FALLTHRU)
102 +       jl      .L3
103 +# BLOCK 5 seq:3
104 +# PRED: 4 (FALLTHRU)
105 +       # gdb.arch/x86_64-vla-pointer.c:30
106 +       .loc 1 30 0 is_stmt 1
107 +       movq    -40(%rbp), %rax
108 +       movb    $0, (%rax)
109 +       movq    %rsi, %rsp
110 +       # gdb.arch/x86_64-vla-pointer.c:31
111 +       .loc 1 31 0
112 +       nop
113 +       movq    -8(%rbp), %rbx
114 +       leave
115 +       .cfi_def_cfa 7, 8
116 +# SUCC: EXIT [100.0%] 
117 +       ret
118 +       .cfi_endproc
119 +.LFE0:
120 +       .size   foo, .-foo
121 +.Letext0:
122 +       .section        .debug_info,"",@progbits
123 +.Ldebug_info0:
124 +       .long   0xa5    # Length of Compilation Unit Info
125 +       .value  0x4     # DWARF version number
126 +       .long   .Ldebug_abbrev0 # Offset Into Abbrev. Section
127 +       .byte   0x8     # Pointer Size (in bytes)
128 +       .uleb128 0x1    # (DIE (0xb) DW_TAG_compile_unit)
129 +       .long   .LASF3  # DW_AT_producer: "GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g"
130 +       .byte   0xc     # DW_AT_language
131 +       .long   .LASF4  # DW_AT_name: "gdb.arch/x86_64-vla-pointer.c"
132 +       .long   .LASF5  # DW_AT_comp_dir: "/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite"
133 +       .quad   .Ltext0 # DW_AT_low_pc
134 +       .quad   .Letext0-.Ltext0        # DW_AT_high_pc
135 +       .long   .Ldebug_line0   # DW_AT_stmt_list
136 +       .uleb128 0x2    # (DIE (0x2d) DW_TAG_subprogram)
137 +                       # DW_AT_external
138 +       .ascii "foo\0"  # DW_AT_name
139 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
140 +       .byte   0x15    # DW_AT_decl_line
141 +                       # DW_AT_prototyped
142 +       .quad   .LFB0   # DW_AT_low_pc
143 +       .quad   .LFE0-.LFB0     # DW_AT_high_pc
144 +       .uleb128 0x1    # DW_AT_frame_base
145 +       .byte   0x9c    # DW_OP_call_frame_cfa
146 +                       # DW_AT_GNU_all_call_sites
147 +       .long   0x80    # DW_AT_sibling
148 +       .uleb128 0x3    # (DIE (0x4a) DW_TAG_formal_parameter)
149 +       .long   .LASF6  # DW_AT_name: "size"
150 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
151 +       .byte   0x15    # DW_AT_decl_line
152 +       .long   0x80    # DW_AT_type
153 +       .uleb128 0x3    # DW_AT_location
154 +       .byte   0x91    # DW_OP_fbreg
155 +       .sleb128 -68
156 +       .uleb128 0x4    # (DIE (0x59) DW_TAG_typedef)
157 +       .long   .LASF7  # DW_AT_name: "array_t"
158 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
159 +       .byte   0x17    # DW_AT_decl_line
160 +       .long   0x87    # DW_AT_type
161 +       .uleb128 0x5    # (DIE (0x64) DW_TAG_variable)
162 +       .long   .LASF0  # DW_AT_name: "array"
163 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
164 +       .byte   0x18    # DW_AT_decl_line
165 +       .long   0x59    # DW_AT_type
166 +       .uleb128 0x3    # DW_AT_location
167 +       .byte   0x91    # DW_OP_fbreg
168 +       .sleb128 -56
169 +       .byte   0x6     # DW_OP_deref
170 +       .uleb128 0x6    # (DIE (0x73) DW_TAG_variable)
171 +       .ascii "i\0"    # DW_AT_name
172 +       .byte   0x1     # DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
173 +       .byte   0x19    # DW_AT_decl_line
174 +       .long   0x80    # DW_AT_type
175 +       .uleb128 0x2    # DW_AT_location
176 +       .byte   0x91    # DW_OP_fbreg
177 +       .sleb128 -36
178 +       .byte   0       # end of children of DIE 0x2d
179 +       .uleb128 0x7    # (DIE (0x80) DW_TAG_base_type)
180 +       .byte   0x4     # DW_AT_byte_size
181 +       .byte   0x5     # DW_AT_encoding
182 +       .ascii "int\0"  # DW_AT_name
183 +       .uleb128 0x8    # (DIE (0x87) DW_TAG_array_type)
184 +       .long   0xa1    # DW_AT_type
185 +       .long   0x9a    # DW_AT_sibling
186 +       .uleb128 0x9    # (DIE (0x90) DW_TAG_subrange_type)
187 +       .long   0x9a    # DW_AT_type
188 +       .uleb128 0x3    # DW_AT_upper_bound
189 +       .byte   0x91    # DW_OP_fbreg
190 +       .sleb128 -48
191 +       .byte   0x6     # DW_OP_deref
192 +       .byte   0       # end of children of DIE 0x87
193 +       .uleb128 0xa    # (DIE (0x9a) DW_TAG_base_type)
194 +       .byte   0x8     # DW_AT_byte_size
195 +       .byte   0x7     # DW_AT_encoding
196 +       .long   .LASF1  # DW_AT_name: "sizetype"
197 +       .uleb128 0xa    # (DIE (0xa1) DW_TAG_base_type)
198 +       .byte   0x1     # DW_AT_byte_size
199 +       .byte   0x6     # DW_AT_encoding
200 +       .long   .LASF2  # DW_AT_name: "char"
201 +       .byte   0       # end of children of DIE 0xb
202 +       .section        .debug_abbrev,"",@progbits
203 +.Ldebug_abbrev0:
204 +       .uleb128 0x1    # (abbrev code)
205 +       .uleb128 0x11   # (TAG: DW_TAG_compile_unit)
206 +       .byte   0x1     # DW_children_yes
207 +       .uleb128 0x25   # (DW_AT_producer)
208 +       .uleb128 0xe    # (DW_FORM_strp)
209 +       .uleb128 0x13   # (DW_AT_language)
210 +       .uleb128 0xb    # (DW_FORM_data1)
211 +       .uleb128 0x3    # (DW_AT_name)
212 +       .uleb128 0xe    # (DW_FORM_strp)
213 +       .uleb128 0x1b   # (DW_AT_comp_dir)
214 +       .uleb128 0xe    # (DW_FORM_strp)
215 +       .uleb128 0x11   # (DW_AT_low_pc)
216 +       .uleb128 0x1    # (DW_FORM_addr)
217 +       .uleb128 0x12   # (DW_AT_high_pc)
218 +       .uleb128 0x7    # (DW_FORM_data8)
219 +       .uleb128 0x10   # (DW_AT_stmt_list)
220 +       .uleb128 0x17   # (DW_FORM_sec_offset)
221 +       .byte   0
222 +       .byte   0
223 +       .uleb128 0x2    # (abbrev code)
224 +       .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
225 +       .byte   0x1     # DW_children_yes
226 +       .uleb128 0x3f   # (DW_AT_external)
227 +       .uleb128 0x19   # (DW_FORM_flag_present)
228 +       .uleb128 0x3    # (DW_AT_name)
229 +       .uleb128 0x8    # (DW_FORM_string)
230 +       .uleb128 0x3a   # (DW_AT_decl_file)
231 +       .uleb128 0xb    # (DW_FORM_data1)
232 +       .uleb128 0x3b   # (DW_AT_decl_line)
233 +       .uleb128 0xb    # (DW_FORM_data1)
234 +       .uleb128 0x27   # (DW_AT_prototyped)
235 +       .uleb128 0x19   # (DW_FORM_flag_present)
236 +       .uleb128 0x11   # (DW_AT_low_pc)
237 +       .uleb128 0x1    # (DW_FORM_addr)
238 +       .uleb128 0x12   # (DW_AT_high_pc)
239 +       .uleb128 0x7    # (DW_FORM_data8)
240 +       .uleb128 0x40   # (DW_AT_frame_base)
241 +       .uleb128 0x18   # (DW_FORM_exprloc)
242 +       .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
243 +       .uleb128 0x19   # (DW_FORM_flag_present)
244 +       .uleb128 0x1    # (DW_AT_sibling)
245 +       .uleb128 0x13   # (DW_FORM_ref4)
246 +       .byte   0
247 +       .byte   0
248 +       .uleb128 0x3    # (abbrev code)
249 +       .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
250 +       .byte   0       # DW_children_no
251 +       .uleb128 0x3    # (DW_AT_name)
252 +       .uleb128 0xe    # (DW_FORM_strp)
253 +       .uleb128 0x3a   # (DW_AT_decl_file)
254 +       .uleb128 0xb    # (DW_FORM_data1)
255 +       .uleb128 0x3b   # (DW_AT_decl_line)
256 +       .uleb128 0xb    # (DW_FORM_data1)
257 +       .uleb128 0x49   # (DW_AT_type)
258 +       .uleb128 0x13   # (DW_FORM_ref4)
259 +       .uleb128 0x2    # (DW_AT_location)
260 +       .uleb128 0x18   # (DW_FORM_exprloc)
261 +       .byte   0
262 +       .byte   0
263 +       .uleb128 0x4    # (abbrev code)
264 +       .uleb128 0x16   # (TAG: DW_TAG_typedef)
265 +       .byte   0       # DW_children_no
266 +       .uleb128 0x3    # (DW_AT_name)
267 +       .uleb128 0xe    # (DW_FORM_strp)
268 +       .uleb128 0x3a   # (DW_AT_decl_file)
269 +       .uleb128 0xb    # (DW_FORM_data1)
270 +       .uleb128 0x3b   # (DW_AT_decl_line)
271 +       .uleb128 0xb    # (DW_FORM_data1)
272 +       .uleb128 0x49   # (DW_AT_type)
273 +       .uleb128 0x13   # (DW_FORM_ref4)
274 +       .byte   0
275 +       .byte   0
276 +       .uleb128 0x5    # (abbrev code)
277 +       .uleb128 0x34   # (TAG: DW_TAG_variable)
278 +       .byte   0       # DW_children_no
279 +       .uleb128 0x3    # (DW_AT_name)
280 +       .uleb128 0xe    # (DW_FORM_strp)
281 +       .uleb128 0x3a   # (DW_AT_decl_file)
282 +       .uleb128 0xb    # (DW_FORM_data1)
283 +       .uleb128 0x3b   # (DW_AT_decl_line)
284 +       .uleb128 0xb    # (DW_FORM_data1)
285 +       .uleb128 0x49   # (DW_AT_type)
286 +       .uleb128 0x13   # (DW_FORM_ref4)
287 +       .uleb128 0x2    # (DW_AT_location)
288 +       .uleb128 0x18   # (DW_FORM_exprloc)
289 +       .byte   0
290 +       .byte   0
291 +       .uleb128 0x6    # (abbrev code)
292 +       .uleb128 0x34   # (TAG: DW_TAG_variable)
293 +       .byte   0       # DW_children_no
294 +       .uleb128 0x3    # (DW_AT_name)
295 +       .uleb128 0x8    # (DW_FORM_string)
296 +       .uleb128 0x3a   # (DW_AT_decl_file)
297 +       .uleb128 0xb    # (DW_FORM_data1)
298 +       .uleb128 0x3b   # (DW_AT_decl_line)
299 +       .uleb128 0xb    # (DW_FORM_data1)
300 +       .uleb128 0x49   # (DW_AT_type)
301 +       .uleb128 0x13   # (DW_FORM_ref4)
302 +       .uleb128 0x2    # (DW_AT_location)
303 +       .uleb128 0x18   # (DW_FORM_exprloc)
304 +       .byte   0
305 +       .byte   0
306 +       .uleb128 0x7    # (abbrev code)
307 +       .uleb128 0x24   # (TAG: DW_TAG_base_type)
308 +       .byte   0       # DW_children_no
309 +       .uleb128 0xb    # (DW_AT_byte_size)
310 +       .uleb128 0xb    # (DW_FORM_data1)
311 +       .uleb128 0x3e   # (DW_AT_encoding)
312 +       .uleb128 0xb    # (DW_FORM_data1)
313 +       .uleb128 0x3    # (DW_AT_name)
314 +       .uleb128 0x8    # (DW_FORM_string)
315 +       .byte   0
316 +       .byte   0
317 +       .uleb128 0x8    # (abbrev code)
318 +       .uleb128 0x1    # (TAG: DW_TAG_array_type)
319 +       .byte   0x1     # DW_children_yes
320 +       .uleb128 0x49   # (DW_AT_type)
321 +       .uleb128 0x13   # (DW_FORM_ref4)
322 +       .uleb128 0x1    # (DW_AT_sibling)
323 +       .uleb128 0x13   # (DW_FORM_ref4)
324 +       .byte   0
325 +       .byte   0
326 +       .uleb128 0x9    # (abbrev code)
327 +       .uleb128 0x21   # (TAG: DW_TAG_subrange_type)
328 +       .byte   0       # DW_children_no
329 +       .uleb128 0x49   # (DW_AT_type)
330 +       .uleb128 0x13   # (DW_FORM_ref4)
331 +       .uleb128 0x2f   # (DW_AT_upper_bound)
332 +       .uleb128 0x18   # (DW_FORM_exprloc)
333 +       .byte   0
334 +       .byte   0
335 +       .uleb128 0xa    # (abbrev code)
336 +       .uleb128 0x24   # (TAG: DW_TAG_base_type)
337 +       .byte   0       # DW_children_no
338 +       .uleb128 0xb    # (DW_AT_byte_size)
339 +       .uleb128 0xb    # (DW_FORM_data1)
340 +       .uleb128 0x3e   # (DW_AT_encoding)
341 +       .uleb128 0xb    # (DW_FORM_data1)
342 +       .uleb128 0x3    # (DW_AT_name)
343 +       .uleb128 0xe    # (DW_FORM_strp)
344 +       .byte   0
345 +       .byte   0
346 +       .byte   0
347 +       .section        .debug_aranges,"",@progbits
348 +       .long   0x2c    # Length of Address Ranges Info
349 +       .value  0x2     # DWARF Version
350 +       .long   .Ldebug_info0   # Offset of Compilation Unit Info
351 +       .byte   0x8     # Size of Address
352 +       .byte   0       # Size of Segment Descriptor
353 +       .value  0       # Pad to 16 byte boundary
354 +       .value  0
355 +       .quad   .Ltext0 # Address
356 +       .quad   .Letext0-.Ltext0        # Length
357 +       .quad   0
358 +       .quad   0
359 +       .section        .debug_line,"",@progbits
360 +.Ldebug_line0:
361 +       .section        .debug_str,"MS",@progbits,1
362 +.LASF4:
363 +       .string "gdb.arch/x86_64-vla-pointer.c"
364 +.LASF7:
365 +       .string "array_t"
366 +.LASF3:
367 +       .string "GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g"
368 +.LASF2:
369 +       .string "char"
370 +.LASF1:
371 +       .string "sizetype"
372 +.LASF5:
373 +       .string "/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite"
374 +.LASF6:
375 +       .string "size"
376 +.LASF0:
377 +       .string "array"
378 +       .ident  "GCC: (GNU) 6.2.1 20160916 (Red Hat 6.2.1-2)"
379 +       .section        .note.GNU-stack,"",@progbits
380 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
381 ===================================================================
382 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
383 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c    2017-02-26 19:15:36.598882323 +0100
384 @@ -0,0 +1,45 @@
385 +/* This testcase is part of GDB, the GNU debugger.
386 +
387 +   Copyright 2009 Free Software Foundation, Inc.
388 +
389 +   This program is free software; you can redistribute it and/or modify
390 +   it under the terms of the GNU General Public License as published by
391 +   the Free Software Foundation; either version 3 of the License, or
392 +   (at your option) any later version.
393 +
394 +   This program is distributed in the hope that it will be useful,
395 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
396 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
397 +   GNU General Public License for more details.
398 +
399 +   You should have received a copy of the GNU General Public License
400 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
401 +
402 +#if 0
403 +
404 +void
405 +foo (int size)
406 +{
407 +  typedef char array_t[size];
408 +  array_t array;
409 +  int i;
410 +
411 +  for (i = 0; i < size; i++)
412 +    array[i] = i;
413 +
414 +  array[0] = 0;        /* break-here */
415 +}
416 +
417 +#else
418 +
419 +void foo (int size);
420 +
421 +int
422 +main (void)
423 +{
424 +  foo (26);
425 +  foo (78);
426 +  return 0;
427 +}
428 +
429 +#endif
430 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
431 ===================================================================
432 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
433 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp  2017-02-26 19:15:36.598882323 +0100
434 @@ -0,0 +1,65 @@
435 +# Copyright 2009 Free Software Foundation, Inc.
436 +
437 +# This program is free software; you can redistribute it and/or modify
438 +# it under the terms of the GNU General Public License as published by
439 +# the Free Software Foundation; either version 3 of the License, or
440 +# (at your option) any later version.
441 +#
442 +# This program is distributed in the hope that it will be useful,
443 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
444 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
445 +# GNU General Public License for more details.
446 +#
447 +# You should have received a copy of the GNU General Public License
448 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
449 +
450 +if ![istarget "x86_64-*-*"] then {
451 +    verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64."
452 +    return
453 +}
454 +
455 +set testfile x86_64-vla-pointer
456 +set srcasmfile ${testfile}-foo.S
457 +set srcfile ${testfile}.c
458 +set binfile [standard_output_file ${testfile}]
459 +set binobjfile [standard_output_file ${testfile}-foo.o]
460 +if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
461 +    untested "Couldn't compile test program"
462 +    return -1
463 +}
464 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {}] != "" } {
465 +    untested "Couldn't compile test program"
466 +    return -1
467 +}
468 +
469 +gdb_exit
470 +gdb_start
471 +gdb_reinitialize_dir $srcdir/$subdir
472 +gdb_load ${binfile}
473 +
474 +if ![runto_main] {
475 +    untested x86_64-vla-pointer
476 +    return -1
477 +}
478 +
479 +gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"]
480 +
481 +gdb_continue_to_breakpoint "break-here"
482 +
483 +gdb_test "whatis array" "type = array_t" "first: whatis array"
484 +gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "first: whatis array_t"
485 +gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
486 +
487 +gdb_test "whatis *array" "type = char" "first: whatis *array"
488 +gdb_test "ptype *array" "type = char" "first: ptype *array"
489 +
490 +gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
491 +gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
492 +gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
493 +gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
494 +
495 +gdb_continue_to_breakpoint "break_here"
496 +
497 +gdb_test "whatis array" "type = array_t" "second: whatis array"
498 +gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "second: whatis array_t"
499 +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
500 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
501 ===================================================================
502 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
503 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S        2017-02-26 19:15:36.598882323 +0100
504 @@ -0,0 +1,455 @@
505 +       .file   "x86_64-vla-typedef.c"
506 +       .section        .debug_abbrev,"",@progbits
507 +.Ldebug_abbrev0:
508 +       .section        .debug_info,"",@progbits
509 +.Ldebug_info0:
510 +       .section        .debug_line,"",@progbits
511 +.Ldebug_line0:
512 +       .text
513 +.Ltext0:
514 +.globl foo
515 +       .type   foo, @function
516 +foo:
517 +.LFB2:
518 +       .file 1 "x86_64-vla-typedef.c"
519 +       .loc 1 22 0
520 +       pushq   %rbp
521 +.LCFI0:
522 +       movq    %rsp, %rbp
523 +.LCFI1:
524 +       subq    $64, %rsp
525 +.LCFI2:
526 +       movl    %edi, -36(%rbp)
527 +       .loc 1 22 0
528 +       movq    %rsp, %rax
529 +       movq    %rax, -48(%rbp)
530 +       .loc 1 23 0
531 +       movl    -36(%rbp), %edx
532 +       movslq  %edx,%rax
533 +       subq    $1, %rax
534 +       movq    %rax, -24(%rbp)
535 +       .loc 1 24 0
536 +       movslq  %edx,%rax
537 +       addq    $15, %rax
538 +       addq    $15, %rax
539 +       shrq    $4, %rax
540 +       salq    $4, %rax
541 +       subq    %rax, %rsp
542 +       movq    %rsp, -56(%rbp)
543 +       movq    -56(%rbp), %rax
544 +       addq    $15, %rax
545 +       shrq    $4, %rax
546 +       salq    $4, %rax
547 +       movq    %rax, -56(%rbp)
548 +       movq    -56(%rbp), %rax
549 +       movq    %rax, -16(%rbp)
550 +       .loc 1 27 0
551 +       movl    $0, -4(%rbp)
552 +       jmp     .L2
553 +.L3:
554 +       .loc 1 28 0
555 +       movl    -4(%rbp), %esi
556 +       movl    -4(%rbp), %eax
557 +       movl    %eax, %ecx
558 +       movq    -16(%rbp), %rdx
559 +       movslq  %esi,%rax
560 +       movb    %cl, (%rdx,%rax)
561 +       .loc 1 27 0
562 +       addl    $1, -4(%rbp)
563 +.L2:
564 +       movl    -4(%rbp), %eax
565 +       cmpl    -36(%rbp), %eax
566 +       jl      .L3
567 +       .loc 1 30 0
568 +       .globl  break_here
569 +break_here:
570 +       movq    -16(%rbp), %rax
571 +       movb    $0, (%rax)
572 +       movq    -48(%rbp), %rsp
573 +       .loc 1 31 0
574 +       leave
575 +       ret
576 +.LFE2:
577 +       .size   foo, .-foo
578 +       .section        .debug_frame,"",@progbits
579 +.Lframe0:
580 +       .long   .LECIE0-.LSCIE0
581 +.LSCIE0:
582 +       .long   0xffffffff
583 +       .byte   0x1
584 +       .string ""
585 +       .uleb128 0x1
586 +       .sleb128 -8
587 +       .byte   0x10
588 +       .byte   0xc
589 +       .uleb128 0x7
590 +       .uleb128 0x8
591 +       .byte   0x90
592 +       .uleb128 0x1
593 +       .align 8
594 +.LECIE0:
595 +.LSFDE0:
596 +       .long   .LEFDE0-.LASFDE0
597 +.LASFDE0:
598 +       .long   .Lframe0
599 +       .quad   .LFB2
600 +       .quad   .LFE2-.LFB2
601 +       .byte   0x4
602 +       .long   .LCFI0-.LFB2
603 +       .byte   0xe
604 +       .uleb128 0x10
605 +       .byte   0x86
606 +       .uleb128 0x2
607 +       .byte   0x4
608 +       .long   .LCFI1-.LCFI0
609 +       .byte   0xd
610 +       .uleb128 0x6
611 +       .align 8
612 +.LEFDE0:
613 +       .section        .eh_frame,"a",@progbits
614 +.Lframe1:
615 +       .long   .LECIE1-.LSCIE1
616 +.LSCIE1:
617 +       .long   0x0
618 +       .byte   0x1
619 +       .string "zR"
620 +       .uleb128 0x1
621 +       .sleb128 -8
622 +       .byte   0x10
623 +       .uleb128 0x1
624 +       .byte   0x3
625 +       .byte   0xc
626 +       .uleb128 0x7
627 +       .uleb128 0x8
628 +       .byte   0x90
629 +       .uleb128 0x1
630 +       .align 8
631 +.LECIE1:
632 +.LSFDE1:
633 +       .long   .LEFDE1-.LASFDE1
634 +.LASFDE1:
635 +       .long   .LASFDE1-.Lframe1
636 +       .long   .LFB2
637 +       .long   .LFE2-.LFB2
638 +       .uleb128 0x0
639 +       .byte   0x4
640 +       .long   .LCFI0-.LFB2
641 +       .byte   0xe
642 +       .uleb128 0x10
643 +       .byte   0x86
644 +       .uleb128 0x2
645 +       .byte   0x4
646 +       .long   .LCFI1-.LCFI0
647 +       .byte   0xd
648 +       .uleb128 0x6
649 +       .align 8
650 +.LEFDE1:
651 +       .text
652 +.Letext0:
653 +       .section        .debug_loc,"",@progbits
654 +.Ldebug_loc0:
655 +.LLST0:
656 +       .quad   .LFB2-.Ltext0
657 +       .quad   .LCFI0-.Ltext0
658 +       .value  0x2
659 +       .byte   0x77
660 +       .sleb128 8
661 +       .quad   .LCFI0-.Ltext0
662 +       .quad   .LCFI1-.Ltext0
663 +       .value  0x2
664 +       .byte   0x77
665 +       .sleb128 16
666 +       .quad   .LCFI1-.Ltext0
667 +       .quad   .LFE2-.Ltext0
668 +       .value  0x2
669 +       .byte   0x76
670 +       .sleb128 16
671 +       .quad   0x0
672 +       .quad   0x0
673 +       .section        .debug_info
674 +       .long   .Ldebug_end - .Ldebug_start
675 +.Ldebug_start:
676 +       .value  0x2
677 +       .long   .Ldebug_abbrev0
678 +       .byte   0x8
679 +       .uleb128 0x1
680 +       .long   .LASF2
681 +       .byte   0x1
682 +       .long   .LASF3
683 +       .long   .LASF4
684 +       .quad   .Ltext0
685 +       .quad   .Letext0
686 +       .long   .Ldebug_line0
687 +       .uleb128 0x2
688 +       .byte   0x1
689 +       .string "foo"
690 +       .byte   0x1
691 +       .byte   0x16
692 +       .byte   0x1
693 +       .quad   .LFB2
694 +       .quad   .LFE2
695 +       .long   .LLST0
696 +       .long   0x83
697 +       .uleb128 0x3
698 +       .long   .LASF5
699 +       .byte   0x1
700 +       .byte   0x15
701 +       .long   0x83
702 +       .byte   0x2
703 +       .byte   0x91
704 +       .sleb128 -52
705 +.Ltag_typedef:
706 +       .uleb128 0x4
707 +       .long   .LASF6
708 +       .byte   0x1
709 +       .byte   0x17
710 +       .long   .Ltag_array_type - .debug_info
711 +       .uleb128 0x5    /* Abbrev Number: 5 (DW_TAG_variable) */
712 +       .long   .LASF0
713 +       .byte   0x1
714 +       .byte   0x18
715 +#if 1
716 +       .long   .Ltag_typedef - .debug_info
717 +#else
718 +       /* Debugging only: Skip the typedef indirection.  */
719 +       .long   .Ltag_array_type - .debug_info
720 +#endif
721 +       /* DW_AT_location: DW_FORM_block1: start */
722 +       .byte   0x3
723 +       .byte   0x91
724 +       .sleb128 -32
725 +#if 0
726 +       .byte   0x6     /* DW_OP_deref */
727 +#else
728 +       .byte   0x96    /* DW_OP_nop */
729 +#endif
730 +       /* DW_AT_location: DW_FORM_block1: end */
731 +       .uleb128 0x6
732 +       .string "i"
733 +       .byte   0x1
734 +       .byte   0x19
735 +       .long   0x83
736 +       .byte   0x2
737 +       .byte   0x91
738 +       .sleb128 -20
739 +       .byte   0x0
740 +       .uleb128 0x7
741 +       .byte   0x4
742 +       .byte   0x5
743 +       .string "int"
744 +.Ltag_array_type:
745 +       .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
746 +       .long   0xa0 + (2f - 1f)        /* DW_AT_type: DW_FORM_ref4 */
747 +       .long   0x9d + (2f - 1f)        /* DW_AT_sibling: DW_FORM_ref4 */
748 +1:     /* DW_AT_data_location: DW_FORM_block1: start */
749 +       .byte   2f - 3f /* length */
750 +3:
751 +       .byte   0x97    /* DW_OP_push_object_address */
752 +       .byte   0x6     /* DW_OP_deref */
753 +2:     /* DW_AT_data_location: DW_FORM_block1: end */
754 +       .uleb128 0x9
755 +       .long   0x9d + (2b - 1b)        /* DW_AT_type: DW_FORM_ref4 */
756 +       .byte   0x3
757 +       .byte   0x91
758 +       .sleb128 -40
759 +       .byte   0x6
760 +       .byte   0x0
761 +       .uleb128 0xa
762 +       .byte   0x8
763 +       .byte   0x7
764 +       .uleb128 0xb
765 +       .byte   0x1
766 +       .byte   0x6
767 +       .long   .LASF1
768 +       .byte   0x0
769 +.Ldebug_end:
770 +       .section        .debug_abbrev
771 +       .uleb128 0x1
772 +       .uleb128 0x11
773 +       .byte   0x1
774 +       .uleb128 0x25
775 +       .uleb128 0xe
776 +       .uleb128 0x13
777 +       .uleb128 0xb
778 +       .uleb128 0x3
779 +       .uleb128 0xe
780 +       .uleb128 0x1b
781 +       .uleb128 0xe
782 +       .uleb128 0x11
783 +       .uleb128 0x1
784 +       .uleb128 0x12
785 +       .uleb128 0x1
786 +       .uleb128 0x10
787 +       .uleb128 0x6
788 +       .byte   0x0
789 +       .byte   0x0
790 +       .uleb128 0x2
791 +       .uleb128 0x2e
792 +       .byte   0x1
793 +       .uleb128 0x3f
794 +       .uleb128 0xc
795 +       .uleb128 0x3
796 +       .uleb128 0x8
797 +       .uleb128 0x3a
798 +       .uleb128 0xb
799 +       .uleb128 0x3b
800 +       .uleb128 0xb
801 +       .uleb128 0x27
802 +       .uleb128 0xc
803 +       .uleb128 0x11
804 +       .uleb128 0x1
805 +       .uleb128 0x12
806 +       .uleb128 0x1
807 +       .uleb128 0x40
808 +       .uleb128 0x6
809 +       .uleb128 0x1
810 +       .uleb128 0x13
811 +       .byte   0x0
812 +       .byte   0x0
813 +       .uleb128 0x3
814 +       .uleb128 0x5
815 +       .byte   0x0
816 +       .uleb128 0x3
817 +       .uleb128 0xe
818 +       .uleb128 0x3a
819 +       .uleb128 0xb
820 +       .uleb128 0x3b
821 +       .uleb128 0xb
822 +       .uleb128 0x49
823 +       .uleb128 0x13
824 +       .uleb128 0x2
825 +       .uleb128 0xa
826 +       .byte   0x0
827 +       .byte   0x0
828 +       .uleb128 0x4
829 +       .uleb128 0x16
830 +       .byte   0x0
831 +       .uleb128 0x3
832 +       .uleb128 0xe
833 +       .uleb128 0x3a
834 +       .uleb128 0xb
835 +       .uleb128 0x3b
836 +       .uleb128 0xb
837 +       .uleb128 0x49
838 +       .uleb128 0x13
839 +       .byte   0x0
840 +       .byte   0x0
841 +       .uleb128 0x5
842 +       .uleb128 0x34
843 +       .byte   0x0
844 +       .uleb128 0x3
845 +       .uleb128 0xe
846 +       .uleb128 0x3a
847 +       .uleb128 0xb
848 +       .uleb128 0x3b
849 +       .uleb128 0xb
850 +       .uleb128 0x49
851 +       .uleb128 0x13
852 +       .uleb128 0x2
853 +       .uleb128 0xa
854 +       .byte   0x0
855 +       .byte   0x0
856 +       .uleb128 0x6
857 +       .uleb128 0x34
858 +       .byte   0x0
859 +       .uleb128 0x3
860 +       .uleb128 0x8
861 +       .uleb128 0x3a
862 +       .uleb128 0xb
863 +       .uleb128 0x3b
864 +       .uleb128 0xb
865 +       .uleb128 0x49
866 +       .uleb128 0x13
867 +       .uleb128 0x2
868 +       .uleb128 0xa
869 +       .byte   0x0
870 +       .byte   0x0
871 +       .uleb128 0x7
872 +       .uleb128 0x24
873 +       .byte   0x0
874 +       .uleb128 0xb
875 +       .uleb128 0xb
876 +       .uleb128 0x3e
877 +       .uleb128 0xb
878 +       .uleb128 0x3
879 +       .uleb128 0x8
880 +       .byte   0x0
881 +       .byte   0x0
882 +       .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
883 +       .uleb128 0x1
884 +       .byte   0x1
885 +       .uleb128 0x49   /* DW_AT_type */
886 +       .uleb128 0x13   /* DW_FORM_ref4 */
887 +       .uleb128 0x1    /* DW_AT_sibling */
888 +       .uleb128 0x13   /* DW_FORM_ref4 */
889 +       .uleb128 0x50   /* DW_AT_data_location */
890 +       .uleb128 0xa    /* DW_FORM_block1 */
891 +       .byte   0x0
892 +       .byte   0x0
893 +       .uleb128 0x9
894 +       .uleb128 0x21
895 +       .byte   0x0
896 +       .uleb128 0x49   /* DW_AT_type */
897 +       .uleb128 0x13   /* DW_FORM_ref4 */
898 +       .uleb128 0x2f
899 +       .uleb128 0xa
900 +       .byte   0x0
901 +       .byte   0x0
902 +       .uleb128 0xa
903 +       .uleb128 0x24
904 +       .byte   0x0
905 +       .uleb128 0xb
906 +       .uleb128 0xb
907 +       .uleb128 0x3e
908 +       .uleb128 0xb
909 +       .byte   0x0
910 +       .byte   0x0
911 +       .uleb128 0xb
912 +       .uleb128 0x24
913 +       .byte   0x0
914 +       .uleb128 0xb
915 +       .uleb128 0xb
916 +       .uleb128 0x3e
917 +       .uleb128 0xb
918 +       .uleb128 0x3
919 +       .uleb128 0xe
920 +       .byte   0x0
921 +       .byte   0x0
922 +       .byte   0x0
923 +       .section        .debug_pubnames,"",@progbits
924 +       .long   0x16
925 +       .value  0x2
926 +       .long   .Ldebug_info0
927 +       .long   0xa8
928 +       .long   0x2d
929 +       .string "foo"
930 +       .long   0x0
931 +       .section        .debug_aranges,"",@progbits
932 +       .long   0x2c
933 +       .value  0x2
934 +       .long   .Ldebug_info0
935 +       .byte   0x8
936 +       .byte   0x0
937 +       .value  0x0
938 +       .value  0x0
939 +       .quad   .Ltext0
940 +       .quad   .Letext0-.Ltext0
941 +       .quad   0x0
942 +       .quad   0x0
943 +       .section        .debug_str,"MS",@progbits,1
944 +.LASF0:
945 +       .string "array"
946 +.LASF5:
947 +       .string "size"
948 +.LASF3:
949 +       .string "x86_64-vla-typedef.c"
950 +.LASF6:
951 +       .string "array_t"
952 +.LASF1:
953 +       .string "char"
954 +.LASF4:
955 +       .string "gdb.arch"
956 +.LASF2:
957 +       .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
958 +       .ident  "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
959 +       .section        .note.GNU-stack,"",@progbits
960 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
961 ===================================================================
962 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
963 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c    2017-02-26 19:15:36.599882330 +0100
964 @@ -0,0 +1,45 @@
965 +/* This testcase is part of GDB, the GNU debugger.
966 +
967 +   Copyright 2008 Free Software Foundation, Inc.
968 +
969 +   This program is free software; you can redistribute it and/or modify
970 +   it under the terms of the GNU General Public License as published by
971 +   the Free Software Foundation; either version 3 of the License, or
972 +   (at your option) any later version.
973 +
974 +   This program is distributed in the hope that it will be useful,
975 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
976 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
977 +   GNU General Public License for more details.
978 +
979 +   You should have received a copy of the GNU General Public License
980 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
981 +
982 +#if 0
983 +
984 +void
985 +foo (int size)
986 +{
987 +  typedef char array_t[size];
988 +  array_t array;
989 +  int i;
990 +
991 +  for (i = 0; i < size; i++)
992 +    array[i] = i;
993 +
994 +  array[0] = 0;        /* break-here */
995 +}
996 +
997 +#else
998 +
999 +void foo (int size);
1000 +
1001 +int
1002 +main (void)
1003 +{
1004 +  foo (26);
1005 +  foo (78);
1006 +  return 0;
1007 +}
1008 +
1009 +#endif
1010 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
1011 ===================================================================
1012 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1013 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp  2017-02-26 19:15:36.599882330 +0100
1014 @@ -0,0 +1,64 @@
1015 +# Copyright 2009 Free Software Foundation, Inc.
1016 +
1017 +# This program is free software; you can redistribute it and/or modify
1018 +# it under the terms of the GNU General Public License as published by
1019 +# the Free Software Foundation; either version 3 of the License, or
1020 +# (at your option) any later version.
1021 +#
1022 +# This program is distributed in the hope that it will be useful,
1023 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1024 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1025 +# GNU General Public License for more details.
1026 +#
1027 +# You should have received a copy of the GNU General Public License
1028 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1029 +
1030 +# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
1031 +
1032 +if ![istarget "x86_64-*-*"] then {
1033 +    verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
1034 +    return
1035 +}
1036 +
1037 +set testfile x86_64-vla-typedef
1038 +set srcasmfile ${testfile}-foo.S
1039 +set srcfile ${testfile}.c
1040 +set binfile [standard_output_file ${testfile}]
1041 +set binobjfile [standard_output_file ${testfile}-foo.o]
1042 +if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
1043 +    untested "Couldn't compile test program"
1044 +    return -1
1045 +}
1046 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
1047 +    untested "Couldn't compile test program"
1048 +    return -1
1049 +}
1050 +
1051 +gdb_exit
1052 +gdb_start
1053 +gdb_reinitialize_dir $srcdir/$subdir
1054 +gdb_load ${binfile}
1055 +
1056 +if ![runto_main] {
1057 +    untested x86_64-vla-typedef
1058 +    return -1
1059 +}
1060 +
1061 +gdb_breakpoint "break_here"
1062 +
1063 +gdb_continue_to_breakpoint "break_here"
1064 +
1065 +gdb_test "whatis array" "type = array_t" "first: whatis array"
1066 +
1067 +gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
1068 +
1069 +gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
1070 +gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
1071 +gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
1072 +gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
1073 +
1074 +gdb_continue_to_breakpoint "break_here"
1075 +
1076 +gdb_test "whatis array" "type = array_t" "second: whatis array"
1077 +
1078 +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
1079 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/arrayidx.c
1080 ===================================================================
1081 --- gdb-7.12.50.20170207.orig/gdb/testsuite/gdb.base/arrayidx.c 2017-02-26 19:15:28.555824772 +0100
1082 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/arrayidx.c      2017-02-26 19:15:36.599882330 +0100
1083 @@ -17,6 +17,13 @@
1084  
1085  int array[] = {1, 2, 3, 4};
1086  
1087 +#ifdef __GNUC__
1088 +struct
1089 +  {
1090 +    int a[0];
1091 +  } unbound;
1092 +#endif
1093 +
1094  int
1095  main (void)
1096  {
1097 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/arrayidx.exp
1098 ===================================================================
1099 --- gdb-7.12.50.20170207.orig/gdb/testsuite/gdb.base/arrayidx.exp       2017-02-26 19:15:28.555824772 +0100
1100 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/arrayidx.exp    2017-02-26 19:15:36.599882330 +0100
1101 @@ -49,4 +49,12 @@
1102           "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
1103           "print array with array-indexes on"
1104  
1105 -
1106 +set test "p unbound.a == &unbound.a\[0\]"
1107 +gdb_test_multiple $test $test {
1108 +    -re " = 1\r\n$gdb_prompt $" {
1109 +       pass $test
1110 +    }
1111 +    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
1112 +       unsupported "$test (no GCC)"
1113 +    }
1114 +}
1115 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/internal-var-field-address.c
1116 ===================================================================
1117 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1118 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/internal-var-field-address.c    2017-02-26 19:15:36.599882330 +0100
1119 @@ -0,0 +1,20 @@
1120 +/* This testcase is part of GDB, the GNU debugger.
1121 +
1122 +   Copyright 2009 Free Software Foundation, Inc.
1123 +
1124 +   This program is free software; you can redistribute it and/or modify
1125 +   it under the terms of the GNU General Public License as published by
1126 +   the Free Software Foundation; either version 3 of the License, or
1127 +   (at your option) any later version.
1128 +
1129 +   This program is distributed in the hope that it will be useful,
1130 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1131 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1132 +   GNU General Public License for more details.
1133 +
1134 +   You should have received a copy of the GNU General Public License
1135 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1136 +
1137 +struct {
1138 +  int field;
1139 +} staticstruct = { 1 };
1140 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/internal-var-field-address.exp
1141 ===================================================================
1142 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1143 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/internal-var-field-address.exp  2017-02-26 19:15:36.600882337 +0100
1144 @@ -0,0 +1,26 @@
1145 +# Copyright 2009 Free Software Foundation, Inc.
1146 +
1147 +# This program is free software; you can redistribute it and/or modify
1148 +# it under the terms of the GNU General Public License as published by
1149 +# the Free Software Foundation; either version 3 of the License, or
1150 +# (at your option) any later version.
1151 +#
1152 +# This program is distributed in the hope that it will be useful,
1153 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1154 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1155 +# GNU General Public License for more details.
1156 +#
1157 +# You should have received a copy of the GNU General Public License
1158 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1159 +
1160 +set test internal-var-field-address
1161 +set binfile ${test}.x
1162 +if  { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } {
1163 +    untested "Couldn't compile test program"
1164 +    return -1
1165 +}
1166 +
1167 +clean_restart $binfile
1168 +
1169 +gdb_test {set $varstruct = staticstruct}
1170 +gdb_test {p $varstruct.field} " = 1"
1171 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-frame.c
1172 ===================================================================
1173 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1174 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-frame.c     2017-02-26 19:15:36.600882337 +0100
1175 @@ -0,0 +1,31 @@
1176 +/* This testcase is part of GDB, the GNU debugger.
1177 +
1178 +   Copyright 2011 Free Software Foundation, Inc.
1179 +
1180 +   This program is free software; you can redistribute it and/or modify
1181 +   it under the terms of the GNU General Public License as published by
1182 +   the Free Software Foundation; either version 3 of the License, or
1183 +   (at your option) any later version.
1184 +
1185 +   This program is distributed in the hope that it will be useful,
1186 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1187 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1188 +   GNU General Public License for more details.
1189 +
1190 +   You should have received a copy of the GNU General Public License
1191 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1192 +
1193 +#include <string.h>
1194 +
1195 +int
1196 +main (int argc, char **argv)
1197 +{
1198 +  char s[2 + argc];
1199 +  void (*f) (char *) = 0;
1200 +
1201 +  memset (s, 0, sizeof (s));
1202 +  s[0] = 'X';
1203 +
1204 +  f (s);
1205 +  return 0;
1206 +}
1207 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-frame.exp
1208 ===================================================================
1209 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1210 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-frame.exp   2017-02-26 19:15:36.600882337 +0100
1211 @@ -0,0 +1,38 @@
1212 +# Copyright 2011 Free Software Foundation, Inc.
1213 +#
1214 +# This program is free software; you can redistribute it and/or modify
1215 +# it under the terms of the GNU General Public License as published by
1216 +# the Free Software Foundation; either version 3 of the License, or
1217 +# (at your option) any later version.
1218 +#
1219 +# This program is distributed in the hope that it will be useful,
1220 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1221 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1222 +# GNU General Public License for more details.
1223 +#
1224 +# You should have received a copy of the GNU General Public License
1225 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1226 +
1227 +set testfile vla-frame
1228 +set executable ${testfile}
1229 +
1230 +if { [prepare_for_testing ${testfile}.exp ${executable}] } {
1231 +    return -1
1232 +}
1233 +
1234 +if ![runto_main] {
1235 +    return -1
1236 +}
1237 +
1238 +set test "continue"
1239 +gdb_test_multiple $test $test {
1240 +    -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
1241 +       pass $test
1242 +    }
1243 +    -re "\r\n$gdb_prompt $" {
1244 +       untested ${testfile}.exp
1245 +       return
1246 +    }
1247 +}
1248 +
1249 +gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
1250 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-overflow.c
1251 ===================================================================
1252 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1253 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-overflow.c  2017-02-26 19:15:36.600882337 +0100
1254 @@ -0,0 +1,30 @@
1255 +/* This testcase is part of GDB, the GNU debugger.
1256 +
1257 +   Copyright 2008 Free Software Foundation, Inc.
1258 +
1259 +   This program is free software; you can redistribute it and/or modify
1260 +   it under the terms of the GNU General Public License as published by
1261 +   the Free Software Foundation; either version 3 of the License, or
1262 +   (at your option) any later version.
1263 +
1264 +   This program is distributed in the hope that it will be useful,
1265 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1266 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1267 +   GNU General Public License for more details.
1268 +
1269 +   You should have received a copy of the GNU General Public License
1270 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1271 +
1272 +#include <stdlib.h>
1273 +
1274 +int
1275 +main (int argc, char **argv)
1276 +{
1277 +  int array[argc];
1278 +
1279 +  array[0] = array[0];
1280 +
1281 +  abort ();
1282 +
1283 +  return 0;
1284 +}
1285 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-overflow.exp
1286 ===================================================================
1287 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1288 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla-overflow.exp        2017-02-26 19:15:36.600882337 +0100
1289 @@ -0,0 +1,109 @@
1290 +# Copyright 2008 Free Software Foundation, Inc.
1291 +
1292 +# This program is free software; you can redistribute it and/or modify
1293 +# it under the terms of the GNU General Public License as published by
1294 +# the Free Software Foundation; either version 3 of the License, or
1295 +# (at your option) any later version.
1296 +#
1297 +# This program is distributed in the hope that it will be useful,
1298 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1299 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1300 +# GNU General Public License for more details.
1301 +#
1302 +# You should have received a copy of the GNU General Public License
1303 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1304 +
1305 +# We could crash in:
1306 +# #0  block_linkage_function (bl=0x0) at ../../gdb/block.c:69
1307 +# #1  in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
1308 +#   97   framefunc = block_linkage_function (get_frame_block (frame, NULL));
1309 +# #2  in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
1310 +# #3  in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
1311 +# #4  dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
1312 +# #5  in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
1313 +# #6  in create_array_type (...) at ../../gdb/gdbtypes.c:840
1314 +# ...
1315 +# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
1316 +# ...
1317 +# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
1318 +
1319 +set testfile vla-overflow
1320 +set shfile [standard_output_file ${testfile}-gdb.sh]
1321 +set srcfile ${testfile}.c
1322 +set binfile [standard_output_file ${testfile}]
1323 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
1324 +    untested "Couldn't compile test program"
1325 +    return -1
1326 +}
1327 +
1328 +set f [open "|getconf PAGESIZE" "r"]
1329 +gets $f pagesize
1330 +close $f
1331 +
1332 +gdb_exit
1333 +gdb_start
1334 +gdb_reinitialize_dir $srcdir/$subdir
1335 +gdb_load ${binfile}
1336 +
1337 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
1338 +
1339 +if { [runto_main] < 0 } {
1340 +    untested vla-overflow
1341 +    return -1
1342 +}
1343 +
1344 +# Get the GDB memory size when we stay at main.
1345 +
1346 +proc memory_v_pages_get {} {
1347 +    global pid_of_gdb pagesize
1348 +    set fd [open "/proc/$pid_of_gdb/statm"]
1349 +    gets $fd line
1350 +    close $fd
1351 +    # number of pages of virtual memory
1352 +    scan $line "%d" drs
1353 +    return $drs
1354 +}
1355 +
1356 +set pages_found [memory_v_pages_get]
1357 +
1358 +# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
1359 +set mb_reserve 40
1360 +verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
1361 +set kb_found [expr $pages_found * $pagesize / 1024]
1362 +set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
1363 +verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
1364 +
1365 +# Create the ulimit wrapper.
1366 +set f [open $shfile "w"]
1367 +puts $f "#! /bin/sh"
1368 +puts $f "ulimit -v $kb_permit"
1369 +puts $f "exec $GDB \"\$@\""
1370 +close $f
1371 +remote_exec host "chmod +x $shfile"
1372 +
1373 +gdb_exit
1374 +set GDBold $GDB
1375 +set GDB "$shfile"
1376 +gdb_start
1377 +set GDB $GDBold
1378 +
1379 +gdb_reinitialize_dir $srcdir/$subdir
1380 +gdb_load ${binfile}
1381 +
1382 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
1383 +
1384 +# Check the size again after the second run.
1385 +# We must not stop in main as it would cache `array' and never crash later.
1386 +
1387 +gdb_run_cmd
1388 +
1389 +verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
1390 +
1391 +gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
1392 +
1393 +verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
1394 +
1395 +# `abort' can get expressed as `*__GI_abort'.
1396 +gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
1397 +
1398 +verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
1399 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla.c
1400 ===================================================================
1401 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1402 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla.c   2017-02-26 19:15:36.600882337 +0100
1403 @@ -0,0 +1,55 @@
1404 +/* This testcase is part of GDB, the GNU debugger.
1405 +
1406 +   Copyright 2008 Free Software Foundation, Inc.
1407 +
1408 +   This program is free software; you can redistribute it and/or modify
1409 +   it under the terms of the GNU General Public License as published by
1410 +   the Free Software Foundation; either version 3 of the License, or
1411 +   (at your option) any later version.
1412 +
1413 +   This program is distributed in the hope that it will be useful,
1414 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1415 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1416 +   GNU General Public License for more details.
1417 +
1418 +   You should have received a copy of the GNU General Public License
1419 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1420 +
1421 +#include <string.h>
1422 +
1423 +void
1424 +marker (void)
1425 +{
1426 +}
1427 +
1428 +void
1429 +bar (char *a, char *b, char *c, int size)
1430 +{
1431 +  memset (a, '1', size);
1432 +  memset (b, '2', size);
1433 +  memset (c, '3', 48);
1434 +}
1435 +
1436 +void
1437 +foo (int size)
1438 +{
1439 +  char temp1[size];
1440 +  char temp3[48];
1441 +
1442 +  temp1[size - 1] = '\0';
1443 +  {
1444 +    char temp2[size];
1445 +
1446 +    bar (temp1, temp2, temp3, size);
1447 +
1448 +    marker (); /* break-here */
1449 +  }
1450 +}
1451 +
1452 +int
1453 +main (void)
1454 +{
1455 +  foo (26);
1456 +  foo (78);
1457 +  return 0;
1458 +}
1459 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla.exp
1460 ===================================================================
1461 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1462 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.base/vla.exp 2017-02-26 19:15:36.600882337 +0100
1463 @@ -0,0 +1,62 @@
1464 +# Copyright 2008 Free Software Foundation, Inc.
1465 +
1466 +# This program is free software; you can redistribute it and/or modify
1467 +# it under the terms of the GNU General Public License as published by
1468 +# the Free Software Foundation; either version 3 of the License, or
1469 +# (at your option) any later version.
1470 +#
1471 +# This program is distributed in the hope that it will be useful,
1472 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1473 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1474 +# GNU General Public License for more details.
1475 +#
1476 +# You should have received a copy of the GNU General Public License
1477 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1478 +
1479 +set testfile vla
1480 +set srcfile ${testfile}.c
1481 +set binfile [standard_output_file ${testfile}]
1482 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
1483 +    untested "Couldn't compile test program"
1484 +    return -1
1485 +}
1486 +
1487 +gdb_exit
1488 +gdb_start
1489 +gdb_reinitialize_dir $srcdir/$subdir
1490 +gdb_load ${binfile}
1491 +
1492 +if ![runto_main] {
1493 +    untested vla
1494 +    return -1
1495 +}
1496 +
1497 +gdb_breakpoint [gdb_get_line_number "break-here"]
1498 +
1499 +gdb_continue_to_breakpoint "break-here"
1500 +
1501 +gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1"
1502 +gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2"
1503 +gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
1504 +
1505 +gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
1506 +gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
1507 +gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
1508 +
1509 +gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
1510 +gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
1511 +gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
1512 +
1513 +gdb_continue_to_breakpoint "break-here"
1514 +
1515 +gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1"
1516 +gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2"
1517 +gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
1518 +
1519 +gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
1520 +gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
1521 +gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
1522 +
1523 +gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
1524 +gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
1525 +gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
1526 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.cp/gdb9593.cc
1527 ===================================================================
1528 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1529 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.cp/gdb9593.cc        2017-02-26 19:15:36.601882344 +0100
1530 @@ -0,0 +1,180 @@
1531 +/* This testcase is part of GDB, the GNU debugger.
1532 +
1533 +   Copyright 2008, 2009 Free Software Foundation, Inc.
1534 +
1535 +   This program is free software; you can redistribute it and/or modify
1536 +   it under the terms of the GNU General Public License as published by
1537 +   the Free Software Foundation; either version 3 of the License, or
1538 +   (at your option) any later version.
1539 +
1540 +   This program is distributed in the hope that it will be useful,
1541 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1542 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1543 +   GNU General Public License for more details.
1544 +
1545 +   You should have received a copy of the GNU General Public License
1546 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.
1547 +   */
1548 +#include <iostream>
1549 +
1550 +using namespace std;
1551 +
1552 +class NextOverThrowDerivates
1553 +{
1554 +
1555 +public:
1556 +
1557 +
1558 +  // Single throw an exception in this function.
1559 +  void function1() 
1560 +  {
1561 +    throw 20;
1562 +  }
1563 +
1564 +  // Throw an exception in another function.
1565 +  void function2() 
1566 +  {
1567 +    function1();
1568 +  }
1569 +
1570 +  // Throw an exception in another function, but handle it
1571 +  // locally.
1572 +  void function3 () 
1573 +  {
1574 +    {
1575 +      try
1576 +       {
1577 +         function1 ();
1578 +       }
1579 +      catch (...) 
1580 +       {
1581 +         cout << "Caught and handled function1 exception" << endl;
1582 +       }
1583 +    }
1584 +  }
1585 +
1586 +  void rethrow ()
1587 +  {
1588 +    try
1589 +      {
1590 +       function1 ();
1591 +      }
1592 +    catch (...)
1593 +      {
1594 +       throw;
1595 +      }
1596 +  }
1597 +
1598 +  void finish ()
1599 +  {
1600 +    // We use this to test that a "finish" here does not end up in
1601 +    // this frame, but in the one above.
1602 +    try
1603 +      {
1604 +       function1 ();
1605 +      }
1606 +    catch (int x)
1607 +      {
1608 +      }
1609 +    function1 ();              // marker for until
1610 +  }
1611 +
1612 +  void until ()
1613 +  {
1614 +    function1 ();
1615 +    function1 ();              // until here
1616 +  }
1617 +
1618 +};
1619 +NextOverThrowDerivates next_cases;
1620 +
1621 +
1622 +int main () 
1623 +{ 
1624 +  try
1625 +    {
1626 +      next_cases.function1 ();
1627 +    }
1628 +  catch (...)
1629 +    {
1630 +      // Discard
1631 +    }
1632 +
1633 +  try
1634 +    {
1635 +      next_cases.function2 ();
1636 +    }
1637 +  catch (...)
1638 +    {
1639 +      // Discard
1640 +    }
1641 +
1642 +  try
1643 +    {
1644 +      // This is duplicated so we can next over one but step into
1645 +      // another.
1646 +      next_cases.function2 ();
1647 +    }
1648 +  catch (...)
1649 +    {
1650 +      // Discard
1651 +    }
1652 +
1653 +  next_cases.function3 ();
1654 +
1655 +  try
1656 +    {
1657 +      next_cases.rethrow ();
1658 +    }
1659 +  catch (...)
1660 +    {
1661 +      // Discard
1662 +    }
1663 +
1664 +  try
1665 +    {
1666 +      // Another duplicate so we can test "finish".
1667 +      next_cases.function2 ();
1668 +    }
1669 +  catch (...)
1670 +    {
1671 +      // Discard
1672 +    }
1673 +
1674 +  // Another test for "finish".
1675 +  try
1676 +    {
1677 +      next_cases.finish ();
1678 +    }
1679 +  catch (...)
1680 +    {
1681 +    }
1682 +
1683 +  // Test of "until".
1684 +  try
1685 +    {
1686 +      next_cases.finish ();
1687 +    }
1688 +  catch (...)
1689 +    {
1690 +    }
1691 +
1692 +  // Test of "until" with an argument.
1693 +  try
1694 +    {
1695 +      next_cases.until ();
1696 +    }
1697 +  catch (...)
1698 +    {
1699 +    }
1700 +
1701 +  // Test of "advance".
1702 +  try
1703 +    {
1704 +      next_cases.until ();
1705 +    }
1706 +  catch (...)
1707 +    {
1708 +    }
1709 +}
1710 +
1711 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.cp/gdb9593.exp
1712 ===================================================================
1713 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1714 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.cp/gdb9593.exp       2017-02-26 19:15:36.601882344 +0100
1715 @@ -0,0 +1,182 @@
1716 +# Copyright 2008, 2009 Free Software Foundation, Inc.
1717 +
1718 +# This program is free software; you can redistribute it and/or modify
1719 +# it under the terms of the GNU General Public License as published by
1720 +# the Free Software Foundation; either version 3 of the License, or
1721 +# (at your option) any later version.
1722 +#
1723 +# This program is distributed in the hope that it will be useful,
1724 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1725 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1726 +# GNU General Public License for more details.
1727 +#
1728 +# You should have received a copy of the GNU General Public License
1729 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
1730 +
1731 +
1732 +if $tracelevel then {
1733 +    strace $tracelevel
1734 +}
1735 +
1736 +if { [skip_cplus_tests] } { continue }
1737 +
1738 +set testfile "gdb9593"
1739 +set srcfile ${testfile}.cc
1740 +set binfile [standard_output_file $testfile]
1741 +
1742 +# Create and source the file that provides information about the compiler
1743 +# used to compile the test case.
1744 +if [get_compiler_info "c++"] {
1745 +    untested gdb9593.exp
1746 +    return -1
1747 +}
1748 +
1749 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
1750 +    untested gdb9593.exp
1751 +    return -1
1752 +}
1753 +
1754 +# Some targets can't do function calls, so don't even bother with this
1755 +# test.
1756 +if [target_info exists gdb,cannot_call_functions] {
1757 +    setup_xfail "*-*-*" 9593
1758 +    fail "This target can not call functions"
1759 +    continue
1760 +}
1761 +
1762 +gdb_exit
1763 +gdb_start
1764 +gdb_reinitialize_dir $srcdir/$subdir
1765 +gdb_load ${binfile}
1766 +
1767 +if ![runto_main] then {
1768 +    perror "couldn't run to main"
1769 +    continue
1770 +} 
1771 +
1772 +# See whether we have the needed unwinder hooks.
1773 +set ok 1
1774 +gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" {
1775 +    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
1776 +       pass "check for unwinder hook"
1777 +    }
1778 +    -re "No symbol .* in current context.\r\n$gdb_prompt $" {
1779 +       # Pass the test so we don't get bogus fails in the results.
1780 +       pass "check for unwinder hook"
1781 +       set ok 0
1782 +    }
1783 +}
1784 +if {!$ok} {
1785 +    untested gdb9593.exp
1786 +    return -1
1787 +}
1788 +
1789 +# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593
1790 +
1791 +gdb_test "next" \
1792 +    ".*catch (...).*" \
1793 +    "next over a throw 1"
1794 +
1795 +gdb_test "next" \
1796 +  ".*next_cases.function2.*" \
1797 +  "next past catch 1"
1798 +
1799 +gdb_test "next" \
1800 +    ".*catch (...).*" \
1801 +    "next over a throw 2"
1802 +
1803 +gdb_test "next" \
1804 +  ".*next_cases.function2.*" \
1805 +  "next past catch 2"
1806 +
1807 +gdb_test "step" \
1808 +  ".*function1().*" \
1809 +  "step into function2 1"
1810 +
1811 +gdb_test "next" \
1812 +    ".*catch (...).*" \
1813 +    "next over a throw 3"
1814 +
1815 +gdb_test "next" \
1816 +  ".*next_cases.function3.*" \
1817 +  "next past catch 3"
1818 +
1819 +gdb_test "next" \
1820 +  ".*next_cases.rethrow.*" \
1821 +    "next over a throw 4"
1822 +
1823 +gdb_test "next" \
1824 +  ".*catch (...).*" \
1825 +  "next over a rethrow"
1826 +
1827 +gdb_test "next" \
1828 +  ".*next_cases.function2.*" \
1829 +  "next after a rethrow"
1830 +
1831 +gdb_test "step" \
1832 +  ".*function1().*" \
1833 +  "step into function2 2"
1834 +
1835 +gdb_test "finish" \
1836 +  ".*catch (...).*" \
1837 +  "finish 1"
1838 +
1839 +gdb_test "next" \
1840 +  ".*next_cases.finish ().*" \
1841 +  "next past catch 4"
1842 +
1843 +gdb_test "step" \
1844 +  ".*function1 ().*" \
1845 +  "step into finish method"
1846 +
1847 +gdb_test "finish" \
1848 +  ".*catch (...).*" \
1849 +  "finish 2"
1850 +
1851 +gdb_test "next" \
1852 +  ".*next_cases.finish ().*" \
1853 +  "next past catch 5"
1854 +
1855 +gdb_test "step" \
1856 +  ".*function1 ().*" \
1857 +  "step into finish, for until"
1858 +
1859 +gdb_test "until" \
1860 +  ".*function1 ().*" \
1861 +  "until with no argument 1"
1862 +
1863 +set line [gdb_get_line_number "marker for until" $testfile.cc]
1864 +
1865 +gdb_test "until $line" \
1866 +  ".*function1 ().*" \
1867 +  "next past catch 6"
1868 +
1869 +gdb_test "until" \
1870 +  ".*catch (...).*" \
1871 +  "until with no argument 2"
1872 +
1873 +set line [gdb_get_line_number "until here" $testfile.cc]
1874 +
1875 +gdb_test "next" \
1876 +  ".*next_cases.until ().*" \
1877 +  "next past catch 6"
1878 +
1879 +gdb_test "step" \
1880 +  ".*function1 ().*" \
1881 +  "step into until"
1882 +
1883 +gdb_test "until $line" \
1884 +  ".*catch (...).*" \
1885 +  "until-over-throw"
1886 +
1887 +gdb_test "next" \
1888 +  ".*next_cases.until ().*" \
1889 +  "next past catch 7"
1890 +
1891 +gdb_test "step" \
1892 +  ".*function1 ().*" \
1893 +  "step into until, for advance"
1894 +
1895 +gdb_test "advance $line" \
1896 +  ".*catch (...).*" \
1897 +  "advance-over-throw"
1898 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
1899 ===================================================================
1900 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1901 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S   2017-02-26 19:15:36.601882344 +0100
1902 @@ -0,0 +1,246 @@
1903 +/* This testcase is part of GDB, the GNU debugger.
1904 +
1905 +   Copyright 2010 Free Software Foundation, Inc.
1906 +
1907 +   This program is free software; you can redistribute it and/or modify
1908 +   it under the terms of the GNU General Public License as published by
1909 +   the Free Software Foundation; either version 3 of the License, or
1910 +   (at your option) any later version.
1911 +
1912 +   This program is distributed in the hope that it will be useful,
1913 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1914 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1915 +   GNU General Public License for more details.
1916 +
1917 +   You should have received a copy of the GNU General Public License
1918 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
1919 +
1920 +/* Debug information */
1921 +
1922 +/* We will `break *main' at the very first instruction.  */
1923 +#define main_length 1
1924 +
1925 +       .section        .data
1926 +vardata:
1927 +       /* See DW_OP_lit3 + 1 (0-based).  */
1928 +       .string         "seennotseen"
1929 +
1930 +       .section        .debug_info
1931 +.Lcu1_begin:
1932 +       .4byte          .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1933 +.Lcu1_start:
1934 +       .2byte          2                       /* DWARF version number */
1935 +       .4byte          .Ldebug_abbrev0         /* Offset Into Abbrev. Section */
1936 +       .byte           4                       /* Pointer Size (in bytes) */
1937 +
1938 +       /* CU die */
1939 +       .uleb128        1                       /* Abbrev: DW_TAG_compile_unit */
1940 +       .4byte          .Lproducer              /* DW_AT_producer */
1941 +       /* Use C++ to exploit a bug in parsing DW_AT_name "".  */
1942 +       .byte           4                       /* DW_AT_language (C++) -  */
1943 +       .4byte          main                    /* DW_AT_low_pc */
1944 +       .byte           main_length             /* DW_AT_high_pc */
1945 +
1946 +.Larray_type:
1947 +       .uleb128        2                       /* Abbrev: DW_TAG_array_type */
1948 +       .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
1949 +
1950 +       .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
1951 +       .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
1952 +       .byte           0                       /* DW_AT_lower_bound */
1953 +       .4byte          .Llen_var-.Lcu1_begin   /* DW_AT_upper_bound */
1954 +       .byte           0                       /* End of children of die */
1955 +
1956 +       /* DW_AT_upper_bound is referencing an optimized-out variable.  */
1957 +.Larrayb_type:
1958 +       .uleb128        2                       /* Abbrev: DW_TAG_array_type */
1959 +       .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
1960 +
1961 +       .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
1962 +       .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
1963 +       .byte           0                       /* DW_AT_lower_bound */
1964 +       .4byte          .Llenb_var-.Lcu1_begin  /* DW_AT_upper_bound */
1965 +       .byte           0                       /* End of children of die */
1966 +
1967 +       /* DW_AT_upper_bound is referencing register.  */
1968 +.Larrayreg_type:
1969 +       .uleb128        2                       /* Abbrev: DW_TAG_array_type */
1970 +       .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
1971 +
1972 +       .uleb128        8                       /* Abbrev: DW_TAG_subrange_type with block */
1973 +       .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
1974 +       .byte           0                       /* DW_AT_lower_bound */
1975 +       .byte           2f - 1f                 /* DW_AT_upper_bound */
1976 +1:     .byte           0x50                    /* DW_OP_reg0 */
1977 +2:
1978 +       .byte           0                       /* End of children of die */
1979 +
1980 +.Luint_type:
1981 +       .uleb128        4                       /* Abbrev: DW_TAG_base_type */
1982 +       .4byte          .Luint_str              /* DW_AT_name */
1983 +       .byte           4                       /* DW_AT_byte_size */
1984 +       .byte           7                       /* DW_AT_encoding */
1985 +
1986 +.Lchar_type:
1987 +       .uleb128        4                       /* Abbrev: DW_TAG_base_type */
1988 +       .4byte          .Lchar_str              /* DW_AT_name */
1989 +       .byte           1                       /* DW_AT_byte_size */
1990 +       .byte           6                       /* DW_AT_encoding */
1991 +
1992 +.Llen_var:
1993 +       .uleb128        5                       /* Abbrev: DW_TAG_variable artificial */
1994 +       .byte           1                       /* DW_AT_artificial */
1995 +       .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
1996 +       .4byte          .Llen_loclist-.Lloclist /* DW_AT_location */
1997 +
1998 +       /* optimized-out variable for b_string.  */
1999 +.Llenb_var:
2000 +       .uleb128        7                       /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
2001 +       .byte           1                       /* DW_AT_artificial */
2002 +       .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
2003 +
2004 +       .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
2005 +       .string         "a_string"              /* DW_AT_name */
2006 +       .4byte          .Larray_type-.Lcu1_begin /* DW_AT_type */
2007 +       .byte           2f - 1f                 /* DW_AT_location */
2008 +1:     .byte           3                       /*   DW_OP_addr */
2009 +       .4byte          vardata                 /*   <addr> */
2010 +2:
2011 +
2012 +       /* DW_AT_upper_bound is referencing an optimized-out variable.  */
2013 +       .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
2014 +       .string         "b_string"              /* DW_AT_name */
2015 +       .4byte          .Larrayb_type-.Lcu1_begin /* DW_AT_type */
2016 +       .byte           2f - 1f                 /* DW_AT_location */
2017 +1:     .byte           3                       /*   DW_OP_addr */
2018 +       .4byte          vardata                 /*   <addr> */
2019 +2:
2020 +
2021 +       /* DW_AT_upper_bound is referencing register.  */
2022 +       .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
2023 +       .string         "reg_string"            /* DW_AT_name */
2024 +       .4byte          .Larrayreg_type-.Lcu1_begin /* DW_AT_type */
2025 +       .byte           2f - 1f                 /* DW_AT_location */
2026 +1:     .byte           3                       /*   DW_OP_addr */
2027 +       .4byte          vardata                 /*   <addr> */
2028 +2:
2029 +
2030 +       .byte           0                       /* End of children of CU */
2031 +.Lcu1_end:
2032 +
2033 +       .section        .debug_loc
2034 +.Lloclist:
2035 +.Llen_loclist:
2036 +       .4byte  0                       # Location list begin address
2037 +       .4byte  main_length             # Location list end address
2038 +       .value  2f-1f   # Location expression size
2039 +1:     .byte   0x33    # DW_OP_lit3
2040 +       .byte   0x9f    # DW_OP_stack_value
2041 +2:
2042 +       .quad   0x0     # Location list terminator begin (*.LLST2)
2043 +       .quad   0x0     # Location list terminator end (*.LLST2)
2044 +
2045 +       .section .debug_abbrev
2046 +.Ldebug_abbrev0:
2047 +       .uleb128        1                       /* Abbrev code */
2048 +       .uleb128        0x11                    /* DW_TAG_compile_unit */
2049 +       .byte           0x1                     /* has_children */
2050 +       .uleb128        0x25                    /* DW_AT_producer */
2051 +       .uleb128        0xe                     /* DW_FORM_strp */
2052 +       .uleb128        0x13                    /* DW_AT_language */
2053 +       .uleb128        0xb                     /* DW_FORM_data1 */
2054 +       .uleb128        0x11                    /* DW_AT_low_pc */
2055 +       .uleb128        0x1                     /* DW_FORM_addr */
2056 +       .uleb128        0x12                    /* DW_AT_high_pc */
2057 +       .uleb128        0xb                     /* DW_FORM_data1 */
2058 +       .byte           0x0                     /* Terminator */
2059 +       .byte           0x0                     /* Terminator */
2060 +
2061 +       .uleb128        2                       /* Abbrev code */
2062 +       .uleb128        0x1                     /* TAG: DW_TAG_array_type */
2063 +       .byte           0x1                     /* DW_children_yes */
2064 +       .uleb128        0x49                    /* DW_AT_type */
2065 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2066 +       .byte           0x0                     /* Terminator */
2067 +       .byte           0x0                     /* Terminator */
2068 +
2069 +       .uleb128        3                       /* Abbrev code */
2070 +       .uleb128        0x21                    /* DW_TAG_subrange_type */
2071 +       .byte           0x0                     /* no children */
2072 +       .uleb128        0x49                    /* DW_AT_type */
2073 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2074 +       .uleb128        0x22                    /* DW_AT_lower_bound */
2075 +       .uleb128        0xb                     /* DW_FORM_data1 */
2076 +       .uleb128        0x2f                    /* DW_AT_upper_bound */
2077 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2078 +       .byte           0x0                     /* Terminator */
2079 +       .byte           0x0                     /* Terminator */
2080 +
2081 +       .uleb128        4                       /* Abbrev code */
2082 +       .uleb128        0x24                    /* DW_TAG_base_type */
2083 +       .byte           0x0                     /* no_children */
2084 +       .uleb128        0x3                     /* DW_AT_name */
2085 +       .uleb128        0xe                     /* DW_FORM_strp */
2086 +       .uleb128        0xb                     /* DW_AT_byte_size */
2087 +       .uleb128        0xb                     /* DW_FORM_data1 */
2088 +       .uleb128        0x3e                    /* DW_AT_encoding */
2089 +       .uleb128        0xb                     /* DW_FORM_data1 */
2090 +       .byte           0x0                     /* Terminator */
2091 +       .byte           0x0                     /* Terminator */
2092 +
2093 +       .uleb128        5                       /* Abbrev code */
2094 +       .uleb128        0x34                    /* DW_TAG_variable */
2095 +       .byte           0x0                     /* no_children */
2096 +       .uleb128        0x34                    /* DW_AT_artificial */
2097 +       .uleb128        0x0c                    /* DW_FORM_flag */
2098 +       .uleb128        0x49                    /* DW_AT_type */
2099 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2100 +       .uleb128        0x02                    /* DW_AT_location */
2101 +       .uleb128        0x06                    /* DW_FORM_data4 */
2102 +       .byte           0x0                     /* Terminator */
2103 +       .byte           0x0                     /* Terminator */
2104 +
2105 +       .uleb128        6                       /* Abbrev code */
2106 +       .uleb128        0x34                    /* DW_TAG_variable */
2107 +       .byte           0x0                     /* no_children */
2108 +       .uleb128        0x3                     /* DW_AT_name */
2109 +       .uleb128        0x8                     /* DW_FORM_string */
2110 +       .uleb128        0x49                    /* DW_AT_type */
2111 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2112 +       .uleb128        0x2                     /* DW_AT_location */
2113 +       .uleb128        0xa                     /* DW_FORM_block1 */
2114 +       .byte           0x0                     /* Terminator */
2115 +       .byte           0x0                     /* Terminator */
2116 +
2117 +       .uleb128        7                       /* Abbrev code */
2118 +       .uleb128        0x34                    /* DW_TAG_variable */
2119 +       .byte           0x0                     /* no_children */
2120 +       .uleb128        0x34                    /* DW_AT_artificial */
2121 +       .uleb128        0x0c                    /* DW_FORM_flag */
2122 +       .uleb128        0x49                    /* DW_AT_type */
2123 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2124 +       .byte           0x0                     /* Terminator */
2125 +       .byte           0x0                     /* Terminator */
2126 +
2127 +       .uleb128        8                       /* Abbrev code */
2128 +       .uleb128        0x21                    /* DW_TAG_subrange_type with block */
2129 +       .byte           0x0                     /* no children */
2130 +       .uleb128        0x49                    /* DW_AT_type */
2131 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2132 +       .uleb128        0x22                    /* DW_AT_lower_bound */
2133 +       .uleb128        0xb                     /* DW_FORM_data1 */
2134 +       .uleb128        0x2f                    /* DW_AT_upper_bound */
2135 +       .uleb128        0xa                     /* DW_FORM_block1 */
2136 +       .byte           0x0                     /* Terminator */
2137 +       .byte           0x0                     /* Terminator */
2138 +
2139 +       .byte           0x0                     /* Terminator */
2140 +
2141 +/* String table */
2142 +       .section .debug_str
2143 +.Lproducer:
2144 +       .string         "GNU C 3.3.3"
2145 +.Lchar_str:
2146 +       .string         "char"
2147 +.Luint_str:
2148 +       .string         "unsigned int"
2149 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
2150 ===================================================================
2151 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2152 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2017-02-26 19:15:36.602882352 +0100
2153 @@ -0,0 +1,66 @@
2154 +# Copyright 2010 Free Software Foundation, Inc.
2155 +
2156 +# This program is free software; you can redistribute it and/or modify
2157 +# it under the terms of the GNU General Public License as published by
2158 +# the Free Software Foundation; either version 3 of the License, or
2159 +# (at your option) any later version.
2160 +#
2161 +# This program is distributed in the hope that it will be useful,
2162 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2163 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2164 +# GNU General Public License for more details.
2165 +#
2166 +# You should have received a copy of the GNU General Public License
2167 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2168 +
2169 +# Test printing variable with dynamic bounds which reference a different
2170 +# (artificial in the GCC case) variable containing loclist as its location.
2171 +# This testcase uses value (not address) of the referenced variable:
2172 +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
2173 +
2174 +# This test can only be run on targets which support DWARF-2 and use gas.
2175 +# For now pick a sampling of likely targets.
2176 +if {![istarget *-*-linux*]
2177 +    && ![istarget *-*-gnu*]
2178 +    && ![istarget *-*-elf*]
2179 +    && ![istarget *-*-openbsd*]
2180 +    && ![istarget arm-*-eabi*]
2181 +    && ![istarget powerpc-*-eabi*]} {
2182 +    return 0
2183 +}
2184 +
2185 +set testfile dw2-bound-loclist
2186 +if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
2187 +    return -1
2188 +}
2189 +
2190 +# Verify it behaves at least as an unbound array without inferior.
2191 +
2192 +# FIXME: FSF GDB crashes due to !has_stack_frames ().
2193 +# But in practice that should not happen.
2194 +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
2195 +#set test "p a_string"
2196 +#gdb_test_multiple $test $test {
2197 +#    -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" {
2198 +#      pass $test
2199 +#    }
2200 +#    -re "No registers\\.\r\n$gdb_prompt $" {
2201 +#      kfail "vlaregression" $test
2202 +#    }
2203 +#}
2204 +#
2205 +#gdb_test "ptype a_string" {type = char \[variable length\]}
2206 +
2207 +# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
2208 +if ![runto "*main"] {
2209 +    return -1
2210 +}
2211 +
2212 +gdb_test "p a_string" { = "seen"}
2213 +gdb_test "ptype a_string" {type = char \[4\]}
2214 +
2215 +gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
2216 +gdb_test "ptype b_string" {type = char \[\]}
2217 +
2218 +# The register contains unpredictable value - the array size.
2219 +gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
2220 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
2221 ===================================================================
2222 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2223 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-stripped.c        2017-02-26 19:15:36.602882352 +0100
2224 @@ -0,0 +1,42 @@
2225 +/* This testcase is part of GDB, the GNU debugger.
2226 +
2227 +   Copyright 2004 Free Software Foundation, Inc.
2228 +
2229 +   This program is free software; you can redistribute it and/or modify
2230 +   it under the terms of the GNU General Public License as published by
2231 +   the Free Software Foundation; either version 2 of the License, or
2232 +   (at your option) any later version.
2233 +
2234 +   This program is distributed in the hope that it will be useful,
2235 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2236 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2237 +   GNU General Public License for more details.
2238
2239 +   You should have received a copy of the GNU General Public License
2240 +   along with this program; if not, write to the Free Software
2241 +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2242 +   USA.  */
2243 +
2244 +
2245 +/* The function `func1' traced into must have debug info on offset > 0;
2246 +   (DW_UNSND (attr)).  This is the reason of `func0' existence.  */
2247 +
2248 +void
2249 +func0(int a, int b)
2250 +{
2251 +}
2252 +
2253 +/* `func1' being traced into must have some arguments to dump.  */
2254 +
2255 +void
2256 +func1(int a, int b)
2257 +{
2258 +  func0 (a,b);
2259 +}
2260 +
2261 +int
2262 +main(void)
2263 +{
2264 +  func1 (1, 2);
2265 +  return 0;
2266 +}
2267 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
2268 ===================================================================
2269 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2270 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp      2017-02-26 19:15:36.602882352 +0100
2271 @@ -0,0 +1,79 @@
2272 +# Copyright 2006 Free Software Foundation, Inc.
2273 +
2274 +# This program is free software; you can redistribute it and/or modify
2275 +# it under the terms of the GNU General Public License as published by
2276 +# the Free Software Foundation; either version 2 of the License, or
2277 +# (at your option) any later version.
2278 +# 
2279 +# This program is distributed in the hope that it will be useful,
2280 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2281 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2282 +# GNU General Public License for more details.
2283 +# 
2284 +# You should have received a copy of the GNU General Public License
2285 +# along with this program; if not, write to the Free Software
2286 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2287 +
2288 +# Minimal DWARF-2 unit test
2289 +
2290 +# This test can only be run on targets which support DWARF-2.
2291 +# For now pick a sampling of likely targets.
2292 +if {![istarget *-*-linux*]
2293 +    && ![istarget *-*-gnu*]
2294 +    && ![istarget *-*-elf*]
2295 +    && ![istarget *-*-openbsd*]
2296 +    && ![istarget arm-*-eabi*]
2297 +    && ![istarget powerpc-*-eabi*]} {
2298 +    return 0  
2299 +}
2300 +
2301 +set testfile "dw2-stripped"
2302 +set srcfile ${testfile}.c
2303 +set binfile [standard_output_file ${testfile}.x]
2304 +
2305 +remote_exec build "rm -f ${binfile}"
2306 +
2307 +# get the value of gcc_compiled
2308 +if [get_compiler_info ${binfile}] {
2309 +    return -1
2310 +}
2311 +
2312 +# This test can only be run on gcc as we use additional_flags=FIXME
2313 +if {$gcc_compiled == 0} {
2314 +    return 0
2315 +}
2316 +
2317 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
2318 +    return -1
2319 +}
2320 +
2321 +remote_exec build "objcopy -R .debug_loc ${binfile}"
2322 +set strip_output [remote_exec build "objdump -h ${binfile}"]
2323 +
2324 +set test "stripping test file preservation"
2325 +if [ regexp ".debug_info " $strip_output]  {
2326 +    pass "$test (.debug_info preserved)"
2327 +} else {
2328 +    fail "$test (.debug_info got also stripped)"
2329 +}
2330 +
2331 +set test "stripping test file functionality"
2332 +if [ regexp ".debug_loc " $strip_output]  {
2333 +    fail "$test (.debug_loc still present)"
2334 +} else {
2335 +    pass "$test (.debug_loc stripped)"
2336 +}
2337 +
2338 +gdb_exit
2339 +gdb_start
2340 +gdb_reinitialize_dir $srcdir/$subdir
2341 +gdb_load ${binfile}
2342 +
2343 +# For C programs, "start" should stop in main().
2344 +
2345 +gdb_test "start" \
2346 +         ".*main \\(\\) at .*" \
2347 +         "start"
2348 +gdb_test "step" \
2349 +         "func.* \\(.*\\) at .*" \
2350 +         "step"
2351 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
2352 ===================================================================
2353 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2354 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S     2017-02-26 19:15:36.602882352 +0100
2355 @@ -0,0 +1,83 @@
2356 +/* This testcase is part of GDB, the GNU debugger.
2357 +
2358 +   Copyright 2009 Free Software Foundation, Inc.
2359 +
2360 +   This program is free software; you can redistribute it and/or modify
2361 +   it under the terms of the GNU General Public License as published by
2362 +   the Free Software Foundation; either version 3 of the License, or
2363 +   (at your option) any later version.
2364 +
2365 +   This program is distributed in the hope that it will be useful,
2366 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2367 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2368 +   GNU General Public License for more details.
2369 +
2370 +   You should have received a copy of the GNU General Public License
2371 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
2372 +
2373 +/* Debug information */
2374 +
2375 +       .section .debug_info
2376 +.Lcu1_begin:
2377 +       /* CU header */
2378 +       .4byte  .Lcu1_end - .Lcu1_start         /* Length of Compilation Unit */
2379 +.Lcu1_start:
2380 +       .2byte  2                               /* DWARF Version */
2381 +       .4byte  .Labbrev1_begin                 /* Offset into abbrev section */
2382 +       .byte   4                               /* Pointer size */
2383 +
2384 +       /* CU die */
2385 +       .uleb128 1                              /* Abbrev: DW_TAG_compile_unit */
2386 +       .ascii  "dw2-struct-member-data-location.c\0"   /* DW_AT_name */
2387 +       .ascii  "GNU C 4.3.2\0"                 /* DW_AT_producer */
2388 +       .byte   1                               /* DW_AT_language (C) */
2389 +
2390 +.Ltype_uchar:
2391 +       .uleb128        2                       /* Abbrev: DW_TAG_structure_type */
2392 +       .ascii          "some_struct\0"         /* DW_AT_name */
2393 +
2394 +       .uleb128        3                       /* Abbrev: DW_TAG_member */
2395 +       .ascii          "field\0"               /* DW_AT_name */
2396 +       .byte           0                       /* DW_AT_data_member_location */
2397 +
2398 +       .byte           0                       /* End of children of some_struct */
2399 +
2400 +       .byte           0                       /* End of children of CU */
2401 +
2402 +.Lcu1_end:
2403 +
2404 +/* Abbrev table */
2405 +       .section .debug_abbrev
2406 +.Labbrev1_begin:
2407 +       .uleb128        1                       /* Abbrev code */
2408 +       .uleb128        0x11                    /* DW_TAG_compile_unit */
2409 +       .byte           1                       /* has_children */
2410 +       .uleb128        0x3                     /* DW_AT_name */
2411 +       .uleb128        0x8                     /* DW_FORM_string */
2412 +       .uleb128        0x25                    /* DW_AT_producer */
2413 +       .uleb128        0x8                     /* DW_FORM_string */
2414 +       .uleb128        0x13                    /* DW_AT_language */
2415 +       .uleb128        0xb                     /* DW_FORM_data1 */
2416 +       .byte           0x0                     /* Terminator */
2417 +       .byte           0x0                     /* Terminator */
2418 +
2419 +       .uleb128        2                       /* Abbrev code */
2420 +       .uleb128        0x13                    /* DW_TAG_structure_type */
2421 +       .byte           1                       /* has_children */
2422 +       .uleb128        0x3                     /* DW_AT_name */
2423 +       .uleb128        0x8                     /* DW_FORM_string */
2424 +       .byte           0x0                     /* Terminator */
2425 +       .byte           0x0                     /* Terminator */
2426 +
2427 +       .uleb128        3                       /* Abbrev code */
2428 +       .uleb128        0x0d                    /* DW_TAG_member */
2429 +       .byte           0                       /* has_children */
2430 +       .uleb128        0x3                     /* DW_AT_name */
2431 +       .uleb128        0x8                     /* DW_FORM_string */
2432 +       .uleb128        0x38                    /* DW_AT_data_member_location */
2433 +       .uleb128        0x0b                    /* DW_FORM_data1 */
2434 +       .byte           0x0                     /* Terminator */
2435 +       .byte           0x0                     /* Terminator */
2436 +
2437 +       .byte           0x0                     /* Terminator */
2438 +       .byte           0x0                     /* Terminator */
2439 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
2440 ===================================================================
2441 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2442 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp   2017-02-26 19:15:36.602882352 +0100
2443 @@ -0,0 +1,37 @@
2444 +# Copyright 2009 Free Software Foundation, Inc.
2445 +
2446 +# This program is free software; you can redistribute it and/or modify
2447 +# it under the terms of the GNU General Public License as published by
2448 +# the Free Software Foundation; either version 3 of the License, or
2449 +# (at your option) any later version.
2450 +#
2451 +# This program is distributed in the hope that it will be useful,
2452 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2453 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2454 +# GNU General Public License for more details.
2455 +#
2456 +# You should have received a copy of the GNU General Public License
2457 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2458 +
2459 +# This test can only be run on targets which support DWARF-2 and use gas.
2460 +# For now pick a sampling of likely targets.
2461 +if {![istarget *-*-linux*]
2462 +    && ![istarget *-*-gnu*]
2463 +    && ![istarget *-*-elf*]
2464 +    && ![istarget *-*-openbsd*]
2465 +    && ![istarget arm-*-eabi*]
2466 +    && ![istarget powerpc-*-eabi*]} {
2467 +    return 0  
2468 +}
2469 +
2470 +set testfile "dw2-struct-member-data-location"
2471 +set srcfile ${testfile}.S
2472 +set binfile ${testfile}.x
2473 +
2474 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } {
2475 +    return -1
2476 +}
2477 +
2478 +clean_restart $binfile
2479 +
2480 +gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
2481 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
2482 ===================================================================
2483 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2484 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S        2017-02-26 19:15:36.602882352 +0100
2485 @@ -0,0 +1,121 @@
2486 +/* This testcase is part of GDB, the GNU debugger.
2487 +
2488 +   Copyright 2012 Free Software Foundation, Inc.
2489 +
2490 +   This program is free software; you can redistribute it and/or modify
2491 +   it under the terms of the GNU General Public License as published by
2492 +   the Free Software Foundation; either version 3 of the License, or
2493 +   (at your option) any later version.
2494 +
2495 +   This program is distributed in the hope that it will be useful,
2496 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2497 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2498 +   GNU General Public License for more details.
2499 +
2500 +   You should have received a copy of the GNU General Public License
2501 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
2502 +
2503 +/* Debug information */
2504 +
2505 +       .section        .data
2506 +vardata:
2507 +       .rept           129
2508 +       .ascii          "x"
2509 +       .endr
2510 +       .ascii          "UNSEEN\0"
2511 +
2512 +       .section        .debug_info
2513 +.Lcu1_begin:
2514 +       .4byte          .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
2515 +.Lcu1_start:
2516 +       .2byte          2                       /* DWARF version number */
2517 +       .4byte          .Ldebug_abbrev0         /* Offset Into Abbrev. Section */
2518 +       .byte           4                       /* Pointer Size (in bytes) */
2519 +
2520 +       /* CU die */
2521 +       .uleb128        1                       /* Abbrev: DW_TAG_compile_unit */
2522 +       .ascii          "GNU C 3.3.3\0"         /* DW_AT_producer */
2523 +       .byte           2                       /* DW_AT_language (C) -  */
2524 +
2525 +.Larray_type:
2526 +       .uleb128        2                       /* Abbrev: DW_TAG_array_type */
2527 +       .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
2528 +
2529 +       .uleb128        8                       /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
2530 +       .byte           0                       /* DW_AT_lower_bound */
2531 +       .byte           128                     /* DW_AT_upper_bound */
2532 +
2533 +       .byte           0                       /* End of children of die */
2534 +
2535 +.Lchar_type:
2536 +       .uleb128        4                       /* Abbrev: DW_TAG_base_type */
2537 +       .ascii          "char\0"                /* DW_AT_name */
2538 +       .byte           1                       /* DW_AT_byte_size */
2539 +       .byte           6                       /* DW_AT_encoding */
2540 +
2541 +       .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
2542 +       .ascii          "notype_string\0"       /* DW_AT_name */
2543 +       .4byte          .Larray_type-.Lcu1_begin /* DW_AT_type */
2544 +       .byte           2f - 1f                 /* DW_AT_location */
2545 +1:     .byte           3                       /*   DW_OP_addr */
2546 +       .4byte          vardata                 /*   <addr> */
2547 +2:
2548 +
2549 +       .byte           0                       /* End of children of CU */
2550 +.Lcu1_end:
2551 +
2552 +       .section .debug_abbrev
2553 +.Ldebug_abbrev0:
2554 +       .uleb128        1                       /* Abbrev code */
2555 +       .uleb128        0x11                    /* DW_TAG_compile_unit */
2556 +       .byte           0x1                     /* has_children */
2557 +       .uleb128        0x25                    /* DW_AT_producer */
2558 +       .uleb128        0x8                     /* DW_FORM_string */
2559 +       .uleb128        0x13                    /* DW_AT_language */
2560 +       .uleb128        0xb                     /* DW_FORM_data1 */
2561 +       .byte           0x0                     /* Terminator */
2562 +       .byte           0x0                     /* Terminator */
2563 +
2564 +       .uleb128        2                       /* Abbrev code */
2565 +       .uleb128        0x1                     /* TAG: DW_TAG_array_type */
2566 +       .byte           0x1                     /* DW_children_yes */
2567 +       .uleb128        0x49                    /* DW_AT_type */
2568 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2569 +       .byte           0x0                     /* Terminator */
2570 +       .byte           0x0                     /* Terminator */
2571 +
2572 +       .uleb128        4                       /* Abbrev code */
2573 +       .uleb128        0x24                    /* DW_TAG_base_type */
2574 +       .byte           0x0                     /* no_children */
2575 +       .uleb128        0x3                     /* DW_AT_name */
2576 +       .uleb128        0x8                     /* DW_FORM_string */
2577 +       .uleb128        0xb                     /* DW_AT_byte_size */
2578 +       .uleb128        0xb                     /* DW_FORM_data1 */
2579 +       .uleb128        0x3e                    /* DW_AT_encoding */
2580 +       .uleb128        0xb                     /* DW_FORM_data1 */
2581 +       .byte           0x0                     /* Terminator */
2582 +       .byte           0x0                     /* Terminator */
2583 +
2584 +       .uleb128        6                       /* Abbrev code */
2585 +       .uleb128        0x34                    /* DW_TAG_variable */
2586 +       .byte           0x0                     /* no_children */
2587 +       .uleb128        0x3                     /* DW_AT_name */
2588 +       .uleb128        0x8                     /* DW_FORM_string */
2589 +       .uleb128        0x49                    /* DW_AT_type */
2590 +       .uleb128        0x13                    /* DW_FORM_ref4 */
2591 +       .uleb128        0x2                     /* DW_AT_location */
2592 +       .uleb128        0xa                     /* DW_FORM_block1 */
2593 +       .byte           0x0                     /* Terminator */
2594 +       .byte           0x0                     /* Terminator */
2595 +
2596 +       .uleb128        8                       /* Abbrev code */
2597 +       .uleb128        0x21                    /* DW_TAG_subrange_type without DW_AT_type */
2598 +       .byte           0x0                     /* no children */
2599 +       .uleb128        0x22                    /* DW_AT_lower_bound */
2600 +       .uleb128        0xb                     /* DW_FORM_data1 */
2601 +       .uleb128        0x2f                    /* DW_AT_upper_bound */
2602 +       .uleb128        0xb                     /* DW_FORM_data1 */
2603 +       .byte           0x0                     /* Terminator */
2604 +       .byte           0x0                     /* Terminator */
2605 +
2606 +       .byte           0x0                     /* Terminator */
2607 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
2608 ===================================================================
2609 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2610 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp      2017-02-26 19:15:36.603882359 +0100
2611 @@ -0,0 +1,39 @@
2612 +# Copyright 2012 Free Software Foundation, Inc.
2613 +
2614 +# This program is free software; you can redistribute it and/or modify
2615 +# it under the terms of the GNU General Public License as published by
2616 +# the Free Software Foundation; either version 3 of the License, or
2617 +# (at your option) any later version.
2618 +#
2619 +# This program is distributed in the hope that it will be useful,
2620 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2621 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2622 +# GNU General Public License for more details.
2623 +#
2624 +# You should have received a copy of the GNU General Public License
2625 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2626 +load_lib dwarf.exp
2627 +
2628 +# https://bugzilla.redhat.com/show_bug.cgi?id=806920
2629 +# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
2630 +# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
2631 +# specified DW_AT_type, present only in XLF produced code.
2632 +
2633 +# This test can only be run on targets which support DWARF-2 and use gas.
2634 +if {![dwarf2_support]} {
2635 +    return 0  
2636 +}
2637 +
2638 +set testfile dw2-subrange-no-type
2639 +set srcfile ${testfile}.S
2640 +set executable ${testfile}.x
2641 +set binfile [standard_output_file ${executable}]
2642 +
2643 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
2644 +    return -1
2645 +}
2646 +
2647 +clean_restart $executable
2648 +
2649 +gdb_test "ptype notype_string" {type = char \[129\]}
2650 +gdb_test "p notype_string" " = 'x' <repeats 129 times>"
2651 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dwarf-stride.exp
2652 ===================================================================
2653 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2654 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dwarf-stride.exp     2017-02-26 19:15:36.603882359 +0100
2655 @@ -0,0 +1,42 @@
2656 +# Copyright 2009 Free Software Foundation, Inc.
2657 +
2658 +# This program is free software; you can redistribute it and/or modify
2659 +# it under the terms of the GNU General Public License as published by
2660 +# the Free Software Foundation; either version 2 of the License, or
2661 +# (at your option) any later version.
2662 +# 
2663 +# This program is distributed in the hope that it will be useful,
2664 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2665 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2666 +# GNU General Public License for more details.
2667 +# 
2668 +# You should have received a copy of the GNU General Public License
2669 +# along with this program; if not, write to the Free Software
2670 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
2671 +
2672 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
2673 +
2674 +# This file is part of the gdb testsuite.  Array element stride must not be
2675 +# specified in the number of elements but in a number of bytes instead.
2676 +# Original problem:
2677 +# (gdb) p c40pt(1)
2678 +# $1 = '0-hello', ' ' <repeats 33 times>
2679 +# (gdb) p c40pt(2)
2680 +# warning: Fortran array stride not divisible by the element size
2681 +
2682 +set testfile dwarf-stride
2683 +set srcfile ${testfile}.f90
2684 +
2685 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
2686 +    return -1
2687 +}
2688 +
2689 +if ![runto MAIN__] then {
2690 +    perror "couldn't run to breakpoint MAIN__"
2691 +    continue
2692 +}
2693 +
2694 +gdb_breakpoint [gdb_get_line_number "break-here"]
2695 +gdb_continue_to_breakpoint "break-here" ".*break-here.*"
2696 +gdb_test "p c40pt(1)" " = '0-hello.*"
2697 +gdb_test "p c40pt(2)" " = '1-hello.*"
2698 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dwarf-stride.f90
2699 ===================================================================
2700 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2701 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dwarf-stride.f90     2017-02-26 19:15:36.603882359 +0100
2702 @@ -0,0 +1,40 @@
2703 +! Copyright 2009 Free Software Foundation, Inc.
2704 +!
2705 +! This program is free software; you can redistribute it and/or modify
2706 +! it under the terms of the GNU General Public License as published by
2707 +! the Free Software Foundation; either version 2 of the License, or
2708 +! (at your option) any later version.
2709 +!
2710 +! This program is distributed in the hope that it will be useful,
2711 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
2712 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2713 +! GNU General Public License for more details.
2714 +!
2715 +! You should have received a copy of the GNU General Public License
2716 +! along with this program; if not, write to the Free Software
2717 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2718 +!
2719 +! File written by Alan Matsuoka.
2720 +
2721 +program repro
2722 +
2723 +  type small_stride
2724 +     character*40 long_string
2725 +     integer      small_pad
2726 +  end type small_stride
2727 +
2728 +  type(small_stride), dimension (20), target :: unpleasant
2729 +  character*40, pointer, dimension(:):: c40pt
2730 +
2731 +  integer i
2732 +
2733 +  do i = 0,19
2734 +     unpleasant(i+1)%small_pad = i+1
2735 +     unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
2736 +  end do
2737 +
2738 +  c40pt => unpleasant%long_string
2739 +
2740 +  print *, c40pt  ! break-here
2741 +
2742 +end program repro
2743 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dynamic.exp
2744 ===================================================================
2745 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2746 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dynamic.exp  2017-02-26 19:15:36.603882359 +0100
2747 @@ -0,0 +1,154 @@
2748 +# Copyright 2007 Free Software Foundation, Inc.
2749 +
2750 +# This program is free software; you can redistribute it and/or modify
2751 +# it under the terms of the GNU General Public License as published by
2752 +# the Free Software Foundation; either version 2 of the License, or
2753 +# (at your option) any later version.
2754 +# 
2755 +# This program is distributed in the hope that it will be useful,
2756 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2757 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2758 +# GNU General Public License for more details.
2759 +# 
2760 +# You should have received a copy of the GNU General Public License
2761 +# along with this program; if not, write to the Free Software
2762 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
2763 +
2764 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
2765 +
2766 +# This file is part of the gdb testsuite.  It contains tests for dynamically
2767 +# allocated Fortran arrays.
2768 +# It depends on the GCC dynamic Fortran arrays DWARF support:
2769 +#      http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
2770 +
2771 +set testfile "dynamic"
2772 +set srcfile ${testfile}.f90
2773 +set binfile [standard_output_file ${testfile}]
2774 +
2775 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
2776 +    untested "Couldn't compile ${srcfile}"
2777 +    return -1
2778 +}
2779 +
2780 +gdb_exit
2781 +gdb_start
2782 +gdb_reinitialize_dir $srcdir/$subdir
2783 +gdb_load ${binfile}
2784 +
2785 +if ![runto MAIN__] then {
2786 +    perror "couldn't run to breakpoint MAIN__"
2787 +    continue
2788 +}
2789 +
2790 +gdb_breakpoint [gdb_get_line_number "varx-init"]
2791 +gdb_continue_to_breakpoint "varx-init"
2792 +
2793 +# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
2794 +# Do not: gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx unallocated"
2795 +# Do not: gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx unallocated"
2796 +# Do not: gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) unallocated"
2797 +# Do not: gdb_test "p varx(1,5,17)=1" {no such vector element \(vector not allocated\)} "p varx(1,5,17)=1 unallocated"
2798 +# Do not: gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) unallocated"
2799 +
2800 +gdb_breakpoint [gdb_get_line_number "varx-allocated"]
2801 +gdb_continue_to_breakpoint "varx-allocated"
2802 +# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
2803 +gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
2804 +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
2805 +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
2806 +
2807 +gdb_breakpoint [gdb_get_line_number "varx-filled"]
2808 +gdb_continue_to_breakpoint "varx-filled"
2809 +gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
2810 +gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
2811 +gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
2812 +gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
2813 +# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
2814 +# Do not: gdb_test "p varv" "\\$\[0-9\]* = <not associated>" "p varv unassociated"
2815 +# Do not: gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv unassociated"
2816 +
2817 +set test "output varx"
2818 +gdb_test_multiple $test $test {
2819 +    -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
2820 +       pass $test
2821 +    }
2822 +}
2823 +
2824 +gdb_breakpoint [gdb_get_line_number "varv-associated"]
2825 +gdb_continue_to_breakpoint "varv-associated"
2826 +gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
2827 +gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
2828 +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
2829 +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
2830 +gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
2831 +# Intel Fortran Compiler 10.1.008 uses the pointer type.
2832 +gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
2833 +
2834 +gdb_breakpoint [gdb_get_line_number "varv-filled"]
2835 +gdb_continue_to_breakpoint "varv-filled"
2836 +gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
2837 +gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
2838 +
2839 +gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
2840 +gdb_continue_to_breakpoint "varv-deassociated"
2841 +# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
2842 +gdb_test "p varv" "\\$\[0-9\]* = (<not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated"
2843 +gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv deassociated"
2844 +gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
2845 +gdb_test "p varv(1,5,17)" {no such vector element \(vector not associated\)}
2846 +gdb_test "ptype varv(1,5,17)" {no such vector element \(vector not associated\)}
2847 +
2848 +gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
2849 +gdb_continue_to_breakpoint "varx-deallocated"
2850 +gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
2851 +gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx deallocated"
2852 +gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
2853 +gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated"
2854 +gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated"
2855 +
2856 +gdb_breakpoint [gdb_get_line_number "vary-passed"]
2857 +gdb_continue_to_breakpoint "vary-passed"
2858 +# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
2859 +gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
2860 +
2861 +gdb_breakpoint [gdb_get_line_number "vary-filled"]
2862 +gdb_continue_to_breakpoint "vary-filled"
2863 +gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
2864 +gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
2865 +gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
2866 +gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
2867 +# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
2868 +gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
2869 +
2870 +gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
2871 +gdb_continue_to_breakpoint "varw-almostfilled"
2872 +gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
2873 +gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
2874 +# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
2875 +gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
2876 +# "up" works with GCC but other Fortran compilers may copy the values into the
2877 +# outer function only on the exit of the inner function.
2878 +# We need both variants as depending on the arch we optionally may still be
2879 +# executing the caller line or not after `finish'.
2880 +gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
2881 +gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
2882 +gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
2883 +gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
2884 +gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
2885 +
2886 +gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
2887 +gdb_continue_to_breakpoint "varz-almostfilled"
2888 +# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
2889 +gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
2890 +# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
2891 +# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
2892 +gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
2893 +gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
2894 +gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
2895 +gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
2896 +# maps to foo::vary(1,1)
2897 +gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
2898 +# maps to foo::vary(2,2)
2899 +gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
2900 +# maps to foo::vary(1,3)
2901 +gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
2902 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dynamic.f90
2903 ===================================================================
2904 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2905 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/dynamic.f90  2017-02-26 19:15:36.603882359 +0100
2906 @@ -0,0 +1,98 @@
2907 +! Copyright 2007 Free Software Foundation, Inc.
2908 +!
2909 +! This program is free software; you can redistribute it and/or modify
2910 +! it under the terms of the GNU General Public License as published by
2911 +! the Free Software Foundation; either version 2 of the License, or
2912 +! (at your option) any later version.
2913 +!
2914 +! This program is distributed in the hope that it will be useful,
2915 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
2916 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2917 +! GNU General Public License for more details.
2918 +!
2919 +! You should have received a copy of the GNU General Public License
2920 +! along with this program; if not, write to the Free Software
2921 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2922 +!
2923 +! Ihis file is the Fortran source file for dynamic.exp.
2924 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
2925 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
2926 +
2927 +subroutine baz
2928 +  real, target, allocatable :: varx (:, :, :)
2929 +  real, pointer :: varv (:, :, :)
2930 +  real, target :: varu (1, 2, 3)
2931 +  logical :: l
2932 +  allocate (varx (1:6, 5:15, 17:28))            ! varx-init
2933 +  l = allocated (varx)
2934 +  varx(:, :, :) = 6                             ! varx-allocated
2935 +  varx(1, 5, 17) = 7
2936 +  varx(2, 6, 18) = 8
2937 +  varx(6, 15, 28) = 9
2938 +  varv => varx                                  ! varx-filled
2939 +  l = associated (varv)
2940 +  varv(3, 7, 19) = 10                           ! varv-associated
2941 +  varv => null ()                               ! varv-filled
2942 +  l = associated (varv)
2943 +  deallocate (varx)                             ! varv-deassociated
2944 +  l = allocated (varx)
2945 +  varu(:, :, :) = 10                            ! varx-deallocated
2946 +  allocate (varv (1:6, 5:15, 17:28))
2947 +  l = associated (varv)
2948 +  varv(:, :, :) = 6
2949 +  varv(1, 5, 17) = 7
2950 +  varv(2, 6, 18) = 8
2951 +  varv(6, 15, 28) = 9
2952 +  deallocate (varv)
2953 +  l = associated (varv)
2954 +  varv => varu
2955 +  varv(1, 1, 1) = 6
2956 +  varv(1, 2, 3) = 7
2957 +  l = associated (varv)
2958 +end subroutine baz
2959 +subroutine foo (vary, varw)
2960 +  real :: vary (:, :)
2961 +  real :: varw (:, :, :)
2962 +  vary(:, :) = 4                                ! vary-passed
2963 +  vary(1, 1) = 8
2964 +  vary(2, 2) = 9
2965 +  vary(1, 3) = 10
2966 +  varw(:, :, :) = 5                             ! vary-filled
2967 +  varw(1, 1, 1) = 6
2968 +  varw(2, 2, 2) = 7                             ! varw-almostfilled
2969 +end subroutine foo
2970 +subroutine bar (varz, vart)
2971 +  real :: varz (*)
2972 +  real :: vart (2:11, 7:*)
2973 +  varz(1:3) = 4
2974 +  varz(2) = 5                                   ! varz-almostfilled
2975 +  vart(2,7) = vart(2,7)
2976 +end subroutine bar
2977 +program test
2978 +  interface
2979 +    subroutine foo (vary, varw)
2980 +    real :: vary (:, :)
2981 +    real :: varw (:, :, :)
2982 +    end subroutine
2983 +  end interface
2984 +  interface
2985 +    subroutine bar (varz, vart)
2986 +    real :: varz (*)
2987 +    real :: vart (2:11, 7:*)
2988 +    end subroutine
2989 +  end interface
2990 +  real :: x (10, 10), y (5), z(8, 8, 8)
2991 +  x(:,:) = 1
2992 +  y(:) = 2
2993 +  z(:,:,:) = 3
2994 +  call baz
2995 +  call foo (x, z(2:6, 4:7, 6:8))
2996 +  call bar (y, x)
2997 +  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
2998 +  if (x (1, 3) .ne. 10) call abort
2999 +  if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
3000 +  if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
3001 +  call foo (transpose (x), z)
3002 +  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
3003 +  if (x (3, 1) .ne. 10) call abort
3004 +end
3005 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/string.exp
3006 ===================================================================
3007 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3008 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/string.exp   2017-02-26 19:15:36.604882366 +0100
3009 @@ -0,0 +1,59 @@
3010 +# Copyright 2008 Free Software Foundation, Inc.
3011 +
3012 +# This program is free software; you can redistribute it and/or modify
3013 +# it under the terms of the GNU General Public License as published by
3014 +# the Free Software Foundation; either version 2 of the License, or
3015 +# (at your option) any later version.
3016 +# 
3017 +# This program is distributed in the hope that it will be useful,
3018 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3019 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3020 +# GNU General Public License for more details.
3021 +# 
3022 +# You should have received a copy of the GNU General Public License
3023 +# along with this program; if not, write to the Free Software
3024 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
3025 +
3026 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
3027 +
3028 +# This file is part of the gdb testsuite.  It contains tests for Fortran
3029 +# strings with dynamic length.
3030 +
3031 +set testfile "string"
3032 +set srcfile ${testfile}.f90
3033 +set binfile [standard_output_file ${testfile}]
3034 +
3035 +if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
3036 +    untested "Couldn't compile ${srcfile}"
3037 +    return -1
3038 +}
3039 +
3040 +gdb_exit
3041 +gdb_start
3042 +gdb_reinitialize_dir $srcdir/$subdir
3043 +gdb_load ${binfile}
3044 +
3045 +if ![runto MAIN__] then {
3046 +    perror "couldn't run to breakpoint MAIN__"
3047 +    continue
3048 +}
3049 +
3050 +gdb_breakpoint [gdb_get_line_number "var-init"]
3051 +gdb_continue_to_breakpoint "var-init"
3052 +gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
3053 +gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
3054 +gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
3055 +gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
3056 +gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
3057 +gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
3058 +gdb_test "p c" "\\$\[0-9\]* = 'c'"
3059 +gdb_test "p d" "\\$\[0-9\]* = 'd       '"
3060 +gdb_test "p e" "\\$\[0-9\]* = 'g   '"
3061 +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\)"
3062 +gdb_test "p *e" "Attempt to take contents of a non-pointer value."
3063 +gdb_test "p *f" "Attempt to take contents of a non-pointer value."
3064 +
3065 +gdb_breakpoint [gdb_get_line_number "var-finish"]
3066 +gdb_continue_to_breakpoint "var-finish"
3067 +gdb_test "p e" "\\$\[0-9\]* = 'e   '" "p e re-set"
3068 +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f2  ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\)" "p *f re-set"
3069 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/string.f90
3070 ===================================================================
3071 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3072 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/string.f90   2017-02-26 19:15:36.604882366 +0100
3073 @@ -0,0 +1,37 @@
3074 +! Copyright 2008 Free Software Foundation, Inc.
3075 +!
3076 +! This program is free software; you can redistribute it and/or modify
3077 +! it under the terms of the GNU General Public License as published by
3078 +! the Free Software Foundation; either version 2 of the License, or
3079 +! (at your option) any later version.
3080 +!
3081 +! This program is distributed in the hope that it will be useful,
3082 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
3083 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3084 +! GNU General Public License for more details.
3085 +!
3086 +! You should have received a copy of the GNU General Public License
3087 +! along with this program; if not, write to the Free Software
3088 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3089 +!
3090 +! Ihis file is the Fortran source file for dynamic.exp.
3091 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
3092 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
3093 +
3094 +subroutine foo (e, f)
3095 +  character (len=1) :: c
3096 +  character (len=8) :: d
3097 +  character (len=*) :: e
3098 +  character (len=*) :: f (1:7, 8:10)
3099 +  c = 'c'
3100 +  d = 'd'
3101 +  e = 'e'                                       ! var-init
3102 +  f = 'f'
3103 +  f(1,9) = 'f2'
3104 +  c = 'c'                                       ! var-finish
3105 +end subroutine foo
3106 +  character (len=4) :: g, h (1:7, 8:10)
3107 +  g = 'g'
3108 +  h = 'h'
3109 +  call foo (g, h)
3110 +end
3111 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/subrange.exp
3112 ===================================================================
3113 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3114 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/subrange.exp 2017-02-26 19:15:36.604882366 +0100
3115 @@ -0,0 +1,72 @@
3116 +# Copyright 2011 Free Software Foundation, Inc.
3117 +
3118 +# This program is free software; you can redistribute it and/or modify
3119 +# it under the terms of the GNU General Public License as published by
3120 +# the Free Software Foundation; either version 3 of the License, or
3121 +# (at your option) any later version.
3122 +#
3123 +# This program is distributed in the hope that it will be useful,
3124 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3125 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3126 +# GNU General Public License for more details.
3127 +#
3128 +# You should have received a copy of the GNU General Public License
3129 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
3130 +
3131 +if { [skip_fortran_tests] } { return -1 }
3132 +
3133 +set testfile "subrange"
3134 +set srcfile ${testfile}.f90
3135 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
3136 +    return -1
3137 +}
3138 +
3139 +if ![runto MAIN__] {
3140 +    perror "Couldn't run to MAIN__"
3141 +    continue
3142 +}
3143 +
3144 +# Depending on the compiler version being used, the name of the 4-byte integer
3145 +# and real types can be printed differently.  For instance, gfortran-4.1 uses
3146 +# "int4" whereas gfortran-4.3 uses "int(kind=4)".
3147 +set int4 "(int4|integer\\(kind=4\\))"
3148 +
3149 +gdb_breakpoint [gdb_get_line_number "break-static"]
3150 +gdb_continue_to_breakpoint "break-static" ".*break-static.*"
3151 +
3152 +foreach var {a alloc ptr} {
3153 +    global pf_prefix
3154 +    set old_prefix $pf_prefix
3155 +    lappend pf_prefix "$var:"
3156 +
3157 +    setup_kfail "*-*-*" "vlaregression/9999"
3158 +    gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
3159 +    setup_kfail "*-*-*" "vlaregression/9999"
3160 +    gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
3161 +    setup_kfail "*-*-*" "vlaregression/9999"
3162 +    gdb_test "p $var (1, 2:)" { = \(21, 31\)}
3163 +    setup_kfail "*-*-*" "vlaregression/9999"
3164 +    gdb_test "p $var (2, :2)" { = \(12, 22\)}
3165 +    setup_kfail "*-*-*" "vlaregression/9999"
3166 +    gdb_test "p $var (3, 2:2)" { = \(23\)}
3167 +    setup_kfail "*-*-*" "vlaregression/9999"
3168 +    gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
3169 +    setup_kfail "*-*-*" "vlaregression/9999"
3170 +    gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
3171 +    setup_kfail "*-*-*" "vlaregression/9999"
3172 +    gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
3173 +    setup_kfail "*-*-*" "vlaregression/9999"
3174 +    gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
3175 +    setup_kfail "*-*-*" "vlaregression/9999"
3176 +    gdb_test "p $var (:)" "Wrong number of subscripts"
3177 +    setup_kfail "*-*-*" "vlaregression/9999"
3178 +    gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
3179 +
3180 +    set pf_prefix $old_prefix
3181 +}
3182 +
3183 +gdb_test_no_output {set $a=a}
3184 +delete_breakpoints
3185 +gdb_unload
3186 +setup_kfail "*-*-*" "vlaregression/9999"
3187 +gdb_test {p $a (3, 2:2)} { = \(23\)}
3188 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/subrange.f90
3189 ===================================================================
3190 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3191 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.fortran/subrange.f90 2017-02-26 19:15:36.604882366 +0100
3192 @@ -0,0 +1,28 @@
3193 +! Copyright 2011 Free Software Foundation, Inc.
3194 +!
3195 +! This program is free software; you can redistribute it and/or modify
3196 +! it under the terms of the GNU General Public License as published by
3197 +! the Free Software Foundation; either version 3 of the License, or
3198 +! (at your option) any later version.
3199 +! 
3200 +! This program is distributed in the hope that it will be useful,
3201 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
3202 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3203 +! GNU General Public License for more details.
3204 +! 
3205 +! You should have received a copy of the GNU General Public License
3206 +! along with this program.  If not, see <http://www.gnu.org/licenses/>.
3207 +
3208 +program test
3209 +  integer, target :: a (4, 3)
3210 +  integer, allocatable :: alloc (:, :)
3211 +  integer, pointer :: ptr (:, :)
3212 +  do 1 i = 1, 4
3213 +  do 1 j = 1, 3
3214 +    a (i, j) = j * 10 + i
3215 +1 continue
3216 +  allocate (alloc (4, 3))
3217 +  alloc = a
3218 +  ptr => a
3219 +  write (*,*) a                 ! break-static
3220 +end
3221 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
3222 ===================================================================
3223 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3224 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.mi/mi2-var-stale-type.c      2017-02-26 19:15:36.604882366 +0100
3225 @@ -0,0 +1,26 @@
3226 +/* Copyright 2011 Free Software Foundation, Inc.
3227 +
3228 +   This file is part of GDB.
3229 +
3230 +   This program is free software; you can redistribute it and/or modify
3231 +   it under the terms of the GNU General Public License as published by
3232 +   the Free Software Foundation; either version 3 of the License, or
3233 +   (at your option) any later version.
3234 +
3235 +   This program is distributed in the hope that it will be useful,
3236 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3237 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3238 +   GNU General Public License for more details.
3239 +
3240 +   You should have received a copy of the GNU General Public License
3241 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
3242 +
3243 +int
3244 +main (int argc, char **argv)
3245 +{
3246 +  char vla[argc];
3247 +
3248 +  vla[0] = 0;  /* break-here */
3249 +
3250 +  return 0;
3251 +}
3252 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
3253 ===================================================================
3254 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3255 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp    2017-02-26 19:15:36.604882366 +0100
3256 @@ -0,0 +1,57 @@
3257 +# Copyright 2011 Free Software Foundation, Inc.
3258 +#
3259 +# This program is free software; you can redistribute it and/or modify
3260 +# it under the terms of the GNU General Public License as published by
3261 +# the Free Software Foundation; either version 3 of the License, or
3262 +# (at your option) any later version.
3263 +#
3264 +# This program is distributed in the hope that it will be useful,
3265 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3266 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3267 +# GNU General Public License for more details.
3268 +#
3269 +# You should have received a copy of the GNU General Public License
3270 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
3271 +
3272 +load_lib mi-support.exp
3273 +set MIFLAGS "-i=mi2"
3274 +
3275 +gdb_exit
3276 +if [mi_gdb_start] {
3277 +    continue
3278 +}
3279 +
3280 +set testfile "mi2-var-stale-type"
3281 +set srcfile ${testfile}.c
3282 +set binfile [standard_output_file ${testfile}]
3283 +if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
3284 +    return -1
3285 +}
3286 +
3287 +mi_delete_breakpoints
3288 +mi_gdb_reinitialize_dir $srcdir/$subdir
3289 +mi_gdb_load ${binfile}
3290 +
3291 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
3292 +  {\^done} \
3293 +  "maintenance set internal-error quit yes"
3294 +
3295 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
3296 +  {\^done} \
3297 +  "maintenance set internal-error corefile yes"
3298 +
3299 +set line [gdb_get_line_number "break-here"]
3300 +set func "main"
3301 +
3302 +mi_gdb_test "-break-insert -t $srcfile:$line" \
3303 +  "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \
3304 +  "breakpoint at $func"
3305 +
3306 +if { [mi_run_cmd] < 0 } {
3307 +    return -1
3308 +}
3309 +mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
3310 +
3311 +mi_create_varobj "vla" "vla" "create local variable vla"
3312 +
3313 +mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
3314 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register-func.c
3315 ===================================================================
3316 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3317 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register-func.c       2017-02-26 19:15:36.604882366 +0100
3318 @@ -0,0 +1,22 @@
3319 +/* This file is part of GDB, the GNU debugger.
3320 +
3321 +   Copyright 2009 Free Software Foundation, Inc.
3322 +
3323 +   This program is free software; you can redistribute it and/or modify
3324 +   it under the terms of the GNU General Public License as published by
3325 +   the Free Software Foundation; either version 3 of the License, or
3326 +   (at your option) any later version.
3327 +
3328 +   This program is distributed in the hope that it will be useful,
3329 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3330 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3331 +   GNU General Public License for more details.
3332 +
3333 +   You should have received a copy of the GNU General Public License
3334 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
3335 +
3336 +int
3337 +func (int *arr)
3338 +{
3339 +  return arr[0];
3340 +}
3341 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register.c
3342 ===================================================================
3343 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3344 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register.c    2017-02-26 19:15:36.605882373 +0100
3345 @@ -0,0 +1,28 @@
3346 +/* This file is part of GDB, the GNU debugger.
3347 +
3348 +   Copyright 2009 Free Software Foundation, Inc.
3349 +
3350 +   This program is free software; you can redistribute it and/or modify
3351 +   it under the terms of the GNU General Public License as published by
3352 +   the Free Software Foundation; either version 3 of the License, or
3353 +   (at your option) any later version.
3354 +
3355 +   This program is distributed in the hope that it will be useful,
3356 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3357 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3358 +   GNU General Public License for more details.
3359 +
3360 +   You should have received a copy of the GNU General Public License
3361 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
3362 +
3363 +extern int func (int *arr);
3364 +
3365 +int
3366 +main (void)
3367 +{
3368 +  int arr[] = { 42 };
3369 +
3370 +  func (arr);
3371 +
3372 +  return 0;
3373 +}
3374 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register.exp
3375 ===================================================================
3376 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3377 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/array-from-register.exp  2017-02-26 19:15:36.605882373 +0100
3378 @@ -0,0 +1,33 @@
3379 +# Copyright 2009 Free Software Foundation, Inc.
3380 +#
3381 +# This program is free software; you can redistribute it and/or modify
3382 +# it under the terms of the GNU General Public License as published by
3383 +# the Free Software Foundation; either version 2 of the License, or
3384 +# (at your option) any later version.
3385 +#
3386 +# This program is distributed in the hope that it will be useful,
3387 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3388 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3389 +# GNU General Public License for more details.
3390 +#
3391 +# You should have received a copy of the GNU General Public License
3392 +# along with this program; if not, write to the Free Software
3393 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3394 +#
3395 +# This file is part of the gdb testsuite.
3396 +
3397 +if { [prepare_for_testing array-from-register.exp "array-from-register"      \
3398 +                         {array-from-register.c array-from-register-func.c} \
3399 +                         {debug optimize=-O2}] } {
3400 +    return -1
3401 +}
3402 +
3403 +if ![runto func] then {
3404 +    return -1
3405 +}
3406 +
3407 +gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
3408 +
3409 +# Seen regression:
3410 +# Address requested for identifier "arr" which is in register $rdi
3411 +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
3412 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/fortran-string.exp
3413 ===================================================================
3414 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3415 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/fortran-string.exp       2017-02-26 19:15:36.605882373 +0100
3416 @@ -0,0 +1,39 @@
3417 +# Copyright 2009 Free Software Foundation, Inc.
3418 +
3419 +# This program is free software; you can redistribute it and/or modify
3420 +# it under the terms of the GNU General Public License as published by
3421 +# the Free Software Foundation; either version 2 of the License, or
3422 +# (at your option) any later version.
3423 +# 
3424 +# This program is distributed in the hope that it will be useful,
3425 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3426 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3427 +# GNU General Public License for more details.
3428 +# 
3429 +# You should have received a copy of the GNU General Public License
3430 +# along with this program; if not, write to the Free Software
3431 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
3432 +
3433 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
3434 +
3435 +# Test GDB can cope with Fortran strings having their length present in a CPU
3436 +# register.  With -O0 the string length is passed on the stack.  To make this
3437 +# test meaningful the follow assertion should pass.  It is not being checked
3438 +# here as the "_s" symbol is compiler dependent:
3439 +#   (gdb) info address _s
3440 +#   Symbol "_s" is a variable in register XX.
3441 +
3442 +set test fortran-string
3443 +set srcfile ${test}.f90
3444 +if { [prepare_for_testing ${test}.exp ${test} ${srcfile} {debug f90 additional_flags=-O2}] } {
3445 +    return -1
3446 +}
3447 +
3448 +if ![runto $srcfile:[gdb_get_line_number "s = s"]] then {
3449 +    perror "couldn't run to breakpoint MAIN__"
3450 +    continue
3451 +}
3452 +
3453 +gdb_test "frame" ".*s='foo'.*"
3454 +gdb_test "ptype s" "type = character\\*3"
3455 +gdb_test "p s" "\\$\[0-9\]* = 'foo'"
3456 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/fortran-string.f90
3457 ===================================================================
3458 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3459 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.opt/fortran-string.f90       2017-02-26 19:15:36.605882373 +0100
3460 @@ -0,0 +1,28 @@
3461 +! Copyright 2009 Free Software Foundation, Inc.
3462 +!
3463 +! This program is free software; you can redistribute it and/or modify
3464 +! it under the terms of the GNU General Public License as published by
3465 +! the Free Software Foundation; either version 2 of the License, or
3466 +! (at your option) any later version.
3467 +!
3468 +! This program is distributed in the hope that it will be useful,
3469 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
3470 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3471 +! GNU General Public License for more details.
3472 +!
3473 +! You should have received a copy of the GNU General Public License
3474 +! along with this program; if not, write to the Free Software
3475 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3476 +!
3477 +! Ihis file is the Fortran source file for dynamic.exp.
3478 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
3479 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
3480 +
3481 +  subroutine f(s)
3482 +  character*(*) s
3483 +  s = s
3484 +  end
3485 +
3486 +  program main
3487 +  call f ('foo')
3488 +  end
3489 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.pascal/arrays.exp
3490 ===================================================================
3491 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3492 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.pascal/arrays.exp    2017-02-26 19:15:36.605882373 +0100
3493 @@ -0,0 +1,104 @@
3494 +# Copyright 2008, 2009 Free Software Foundation, Inc.
3495 +#
3496 +# This program is free software; you can redistribute it and/or modify
3497 +# it under the terms of the GNU General Public License as published by
3498 +# the Free Software Foundation; either version 3 of the License, or
3499 +# (at your option) any later version.
3500 +#
3501 +# This program is distributed in the hope that it will be useful,
3502 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
3503 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3504 +# GNU General Public License for more details.
3505 +#
3506 +# You should have received a copy of the GNU General Public License
3507 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
3508 +
3509 +if $tracelevel then {
3510 +    strace $tracelevel
3511 +}
3512 +
3513 +load_lib "pascal.exp"
3514 +
3515 +set testfile "arrays"
3516 +set srcfile ${testfile}.pas
3517 +set binfile [standard_output_file ${testfile}$EXEEXT]
3518 +
3519 +# These tests only work with fpc, using the -gw3 compile-option
3520 +pascal_init
3521 +if { $pascal_compiler_is_fpc != 1 } {
3522 +  return -1
3523 +}
3524 +
3525 +# Detect if the fpc version is below 2.3.0
3526 +set fpc_generates_dwarf_for_dynamic_arrays 1
3527 +if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))}  {
3528 +  set fpc_generates_dwarf_for_dynamic_arrays 0
3529 +}
3530 +
3531 +
3532 +if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
3533 +  return -1
3534 +}
3535 +
3536 +gdb_exit
3537 +gdb_start
3538 +gdb_reinitialize_dir $srcdir/$subdir
3539 +gdb_load ${binfile}
3540 +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
3541 +set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
3542 +
3543 +
3544 +if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
3545 +    pass "setting breakpoint 1"
3546 +}
3547 +if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
3548 +    pass "setting breakpoint 2"
3549 +}
3550 +
3551 +# Verify that "start" lands inside the right procedure.
3552 +if { [gdb_start_cmd] < 0 } {
3553 +    untested start
3554 +    return -1
3555 +}
3556 +
3557 +gdb_test "" ".* at .*${srcfile}.*" "start"
3558 +
3559 +gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
3560 +
3561 +gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
3562 +gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
3563 +
3564 +gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
3565 +
3566 +gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
3567 +gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer"
3568 +
3569 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3570 +  setup_xfail "*-*-*"
3571 +}
3572 +gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
3573 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3574 +  setup_xfail "*-*-*"
3575 +}
3576 +gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
3577 +
3578 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3579 +  setup_xfail "*-*-*"
3580 +}
3581 +gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
3582 +
3583 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3584 +  setup_xfail "*-*-*"
3585 +}
3586 +gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
3587 +
3588 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3589 +  setup_xfail "*-*-*"
3590 +}
3591 +gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
3592 +
3593 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
3594 +  setup_xfail "*-*-*"
3595 +}
3596 +gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
3597 +
3598 Index: gdb-7.12.50.20170207/gdb/testsuite/gdb.pascal/arrays.pas
3599 ===================================================================
3600 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3601 +++ gdb-7.12.50.20170207/gdb/testsuite/gdb.pascal/arrays.pas    2017-02-26 19:15:36.605882373 +0100
3602 @@ -0,0 +1,82 @@
3603 +{
3604 + Copyright 2008, 2009 Free Software Foundation, Inc.
3605 +
3606 + This program is free software; you can redistribute it and/or modify
3607 + it under the terms of the GNU General Public License as published by
3608 + the Free Software Foundation; either version 3 of the License, or
3609 + (at your option) any later version.
3610 +
3611 + This program is distributed in the hope that it will be useful,
3612 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3613 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3614 + GNU General Public License for more details.
3615 +
3616 + You should have received a copy of the GNU General Public License
3617 + along with this program.  If not, see <http://www.gnu.org/licenses/>.
3618 +}
3619 +
3620 +program arrays;
3621 +
3622 +{$mode objfpc}{$h+}
3623 +
3624 +uses sysutils;
3625 +
3626 +type TStatArrInt= array[0..11] of integer;
3627 +     TDynArrInt= array of integer;
3628 +     TStatArrStr= array[0..12] of string;
3629 +     TDynArrStr= array of string;
3630 +     TDynArrChar = array of char;
3631 +     TStatArrChar = array [0..11] of char;
3632 +
3633 +     TStat2dArrInt = array[0..11,0..4] of integer;
3634 +
3635 +var StatArrInt: TStatArrInt;
3636 +    StatArrInt_: Array[0..11] of integer;
3637 +    DynArrInt:  TDynArrInt;
3638 +    DynArrInt_: Array of integer;
3639 +    StatArrStr: TStatArrStr;
3640 +    DynArrStr: TDynArrStr;
3641 +    StatArrChar: TStatArrChar;
3642 +    DynArrChar: TDynArrChar;
3643 +
3644 +    Stat2dArrInt: TStat2dArrInt;
3645 +
3646 +    s: string;
3647 +       
3648 +    i,j : integer;
3649 +
3650 +begin
3651 +  for i := 0 to 11 do
3652 +    begin
3653 +    StatArrInt[i]:= i+50;
3654 +    StatArrInt_[i]:= i+50;
3655 +    StatArrChar[i]:= chr(ord('a')+i);
3656 +    for j := 0 to 4 do
3657 +      Stat2dArrInt[i,j]:=i+j;
3658 +    end;
3659 +  writeln(StatArrInt_[0]);
3660 +  writeln(StatArrInt[0]); { set breakpoint 1 here }
3661 +  writeln(StatArrChar[0]);
3662 +  writeln(Stat2dArrInt[0,0]);
3663 +
3664 +  setlength(DynArrInt,13);
3665 +  setlength(DynArrInt_,13);
3666 +  setlength(DynArrStr,13);
3667 +  setlength(DynArrChar,13);
3668 +  for i := 0 to 12 do
3669 +    begin
3670 +    DynArrInt[i]:= i+50;
3671 +    DynArrInt_[i]:= i+50;
3672 +    DynArrChar[i]:= chr(ord('a')+i);
3673 +    StatArrStr[i]:='str'+inttostr(i);
3674 +    DynArrStr[i]:='dstr'+inttostr(i);
3675 +    end;
3676 +  writeln(DynArrInt_[1]);
3677 +  writeln(DynArrInt[1]); 
3678 +  writeln(DynArrStr[1]); 
3679 +  writeln(StatArrStr[1]);
3680 +  writeln(DynArrChar[1]);
3681 +
3682 +  s := 'test'#0'string';
3683 +  writeln(s); { set breakpoint 2 here }
3684 +end.
3685 Index: gdb-7.12.50.20170207/gdb/testsuite/lib/gdb.exp
3686 ===================================================================
3687 --- gdb-7.12.50.20170207.orig/gdb/testsuite/lib/gdb.exp 2017-02-26 19:15:28.564824836 +0100
3688 +++ gdb-7.12.50.20170207/gdb/testsuite/lib/gdb.exp      2017-02-26 19:15:36.607882387 +0100
3689 @@ -178,6 +178,11 @@
3690             send_gdb "y\n"
3691             exp_continue
3692         }
3693 +       -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
3694 +           { send_gdb "y\n"
3695 +               verbose "\t\tUnloading symbols for program being debugged"
3696 +           exp_continue
3697 +       }
3698         -re "Discard symbol table from .*y or n.*$" {
3699             send_gdb "y\n"
3700             exp_continue
3701 Index: gdb-7.12.50.20170207/gdb/testsuite/lib/pascal.exp
3702 ===================================================================
3703 --- gdb-7.12.50.20170207.orig/gdb/testsuite/lib/pascal.exp      2017-02-26 19:15:28.565824844 +0100
3704 +++ gdb-7.12.50.20170207/gdb/testsuite/lib/pascal.exp   2017-02-26 19:15:36.607882387 +0100
3705 @@ -37,6 +37,9 @@
3706      global pascal_compiler_is_fpc
3707      global gpc_compiler
3708      global fpc_compiler
3709 +    global fpcversion_major
3710 +    global fpcversion_minor
3711 +    global fpcversion_release
3712      global env
3713   
3714      if { $pascal_init_done == 1 } {
3715 @@ -64,6 +67,20 @@
3716             set pascal_compiler_is_fpc 1
3717             verbose -log "Free Pascal compiler found"
3718         }
3719 +
3720 +       # Detect the fpc-version
3721 +       if { $pascal_compiler_is_fpc == 1 } {
3722 +           set fpcversion_major 1
3723 +           set fpcversion_minor 0
3724 +           set fpcversion_release 0
3725 +           set fpcversion [ remote_exec host $fpc_compiler "-iV" ] 
3726 +           if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] {
3727 +              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major
3728 +              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor
3729 +              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release
3730 +           }
3731 +            verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release"
3732 +       }
3733      }
3734      set pascal_init_done 1
3735  }   
This page took 0.402968 seconds and 3 git commands to generate.