Blame SOURCES/gdb-archer-vla-tests.patch

99f0af
Index: gdb-7.12/gdb/testsuite/gdb.ada/packed_array.exp
7a6771
===================================================================
99f0af
--- gdb-7.12.orig/gdb/testsuite/gdb.ada/packed_array.exp	2016-08-01 17:50:21.000000000 +0200
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.ada/packed_array.exp	2016-10-22 09:45:15.849013467 +0200
7a6771
@@ -56,5 +56,11 @@
7a6771
         # are.  Observed with (FSF GNU Ada 4.5.3 20110124).
7a6771
         xfail $test
7a6771
     }
7a6771
+    -re "= \\(\\)\[\r\n\]+$gdb_prompt $" {
7a6771
+	# archer-jankratochvil-vla resolves it as a dynamic type resolved as an
7a6771
+	# empty array [0..-1].
7a6771
+	# DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref)
7a6771
+        xfail $test
7a6771
+    }
7a6771
 }
7a6771
 
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S	2016-10-22 09:50:38.510393903 +0200
99f0af
@@ -0,0 +1,358 @@
99f0af
+	.file	"x86_64-vla-pointer.c"
99f0af
+	.text
99f0af
+.Ltext0:
99f0af
+	.globl	foo
99f0af
+	.type	foo, @function
99f0af
+foo:
99f0af
+.LFB0:
99f0af
+	.file 1 "gdb.arch/x86_64-vla-pointer.c"
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:22
99f0af
+	.loc 1 22 0
99f0af
+	.cfi_startproc
99f0af
+# BLOCK 2 seq:0
99f0af
+# PRED: ENTRY (FALLTHRU)
99f0af
+	pushq	%rbp
99f0af
+	.cfi_def_cfa_offset 16
99f0af
+	.cfi_offset 6, -16
99f0af
+	movq	%rsp, %rbp
99f0af
+	.cfi_def_cfa_register 6
99f0af
+	pushq	%rbx
99f0af
+	subq	$56, %rsp
99f0af
+	.cfi_offset 3, -24
99f0af
+	movl	%edi, -52(%rbp)
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:22
99f0af
+	.loc 1 22 0
99f0af
+	movq	%rsp, %rax
99f0af
+	movq	%rax, %rsi
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:23
99f0af
+	.loc 1 23 0
99f0af
+	movl	-52(%rbp), %eax
99f0af
+	movslq	%eax, %rdx
99f0af
+	subq	$1, %rdx
99f0af
+	movq	%rdx, -32(%rbp)
99f0af
+	movslq	%eax, %rdx
99f0af
+	movq	%rdx, %r8
99f0af
+	movl	$0, %r9d
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:24
99f0af
+	.loc 1 24 0
99f0af
+	movslq	%eax, %rdx
99f0af
+	movq	%rdx, %rcx
99f0af
+	movl	$0, %ebx
99f0af
+	cltq
99f0af
+	movl	$16, %edx
99f0af
+	subq	$1, %rdx
99f0af
+	addq	%rdx, %rax
99f0af
+	movl	$16, %ebx
99f0af
+	movl	$0, %edx
99f0af
+	divq	%rbx
99f0af
+	imulq	$16, %rax, %rax
99f0af
+	subq	%rax, %rsp
99f0af
+	movq	%rsp, %rax
99f0af
+	addq	$0, %rax
99f0af
+	movq	%rax, -40(%rbp)
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:27
99f0af
+	.loc 1 27 0
99f0af
+	movl	$0, -20(%rbp)
99f0af
+# SUCC: 4 [100.0%] 
99f0af
+	jmp	.L2
99f0af
+# BLOCK 3 seq:1
99f0af
+# PRED: 4
99f0af
+.L3:
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:28
99f0af
+	.loc 1 28 0 discriminator 3
99f0af
+	movl	-20(%rbp), %eax
99f0af
+	movl	%eax, %ecx
99f0af
+	movq	-40(%rbp), %rdx
99f0af
+	movl	-20(%rbp), %eax
99f0af
+	cltq
99f0af
+	movb	%cl, (%rdx,%rax)
99f0af
+# SUCC: 4 (FALLTHRU,DFS_BACK)
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:27
99f0af
+	.loc 1 27 0 discriminator 3
99f0af
+	addl	$1, -20(%rbp)
99f0af
+# BLOCK 4 seq:2
99f0af
+# PRED: 3 (FALLTHRU,DFS_BACK) 2 [100.0%] 
99f0af
+.L2:
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:27
99f0af
+	.loc 1 27 0 is_stmt 0 discriminator 1
99f0af
+	movl	-20(%rbp), %eax
99f0af
+	cmpl	-52(%rbp), %eax
99f0af
+# SUCC: 3 5 (FALLTHRU)
99f0af
+	jl	.L3
99f0af
+# BLOCK 5 seq:3
99f0af
+# PRED: 4 (FALLTHRU)
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:30
99f0af
+	.loc 1 30 0 is_stmt 1
99f0af
+	movq	-40(%rbp), %rax
99f0af
+	movb	$0, (%rax)
99f0af
+	movq	%rsi, %rsp
99f0af
+	# gdb.arch/x86_64-vla-pointer.c:31
99f0af
+	.loc 1 31 0
99f0af
+	nop
99f0af
+	movq	-8(%rbp), %rbx
99f0af
+	leave
99f0af
+	.cfi_def_cfa 7, 8
99f0af
+# SUCC: EXIT [100.0%] 
99f0af
+	ret
99f0af
+	.cfi_endproc
99f0af
+.LFE0:
99f0af
+	.size	foo, .-foo
99f0af
+.Letext0:
99f0af
+	.section	.debug_info,"",@progbits
99f0af
+.Ldebug_info0:
99f0af
+	.long	0xa5	# Length of Compilation Unit Info
99f0af
+	.value	0x4	# DWARF version number
99f0af
+	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
99f0af
+	.byte	0x8	# Pointer Size (in bytes)
99f0af
+	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
99f0af
+	.long	.LASF3	# DW_AT_producer: "GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g"
99f0af
+	.byte	0xc	# DW_AT_language
99f0af
+	.long	.LASF4	# DW_AT_name: "gdb.arch/x86_64-vla-pointer.c"
99f0af
+	.long	.LASF5	# DW_AT_comp_dir: "/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite"
99f0af
+	.quad	.Ltext0	# DW_AT_low_pc
99f0af
+	.quad	.Letext0-.Ltext0	# DW_AT_high_pc
99f0af
+	.long	.Ldebug_line0	# DW_AT_stmt_list
99f0af
+	.uleb128 0x2	# (DIE (0x2d) DW_TAG_subprogram)
99f0af
+			# DW_AT_external
99f0af
+	.ascii "foo\0"	# DW_AT_name
99f0af
+	.byte	0x1	# DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
99f0af
+	.byte	0x15	# DW_AT_decl_line
99f0af
+			# DW_AT_prototyped
99f0af
+	.quad	.LFB0	# DW_AT_low_pc
99f0af
+	.quad	.LFE0-.LFB0	# DW_AT_high_pc
99f0af
+	.uleb128 0x1	# DW_AT_frame_base
99f0af
+	.byte	0x9c	# DW_OP_call_frame_cfa
99f0af
+			# DW_AT_GNU_all_call_sites
99f0af
+	.long	0x80	# DW_AT_sibling
99f0af
+	.uleb128 0x3	# (DIE (0x4a) DW_TAG_formal_parameter)
99f0af
+	.long	.LASF6	# DW_AT_name: "size"
99f0af
+	.byte	0x1	# DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
99f0af
+	.byte	0x15	# DW_AT_decl_line
99f0af
+	.long	0x80	# DW_AT_type
99f0af
+	.uleb128 0x3	# DW_AT_location
99f0af
+	.byte	0x91	# DW_OP_fbreg
99f0af
+	.sleb128 -68
99f0af
+	.uleb128 0x4	# (DIE (0x59) DW_TAG_typedef)
99f0af
+	.long	.LASF7	# DW_AT_name: "array_t"
99f0af
+	.byte	0x1	# DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
99f0af
+	.byte	0x17	# DW_AT_decl_line
99f0af
+	.long	0x87	# DW_AT_type
99f0af
+	.uleb128 0x5	# (DIE (0x64) DW_TAG_variable)
99f0af
+	.long	.LASF0	# DW_AT_name: "array"
99f0af
+	.byte	0x1	# DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
99f0af
+	.byte	0x18	# DW_AT_decl_line
99f0af
+	.long	0x59	# DW_AT_type
99f0af
+	.uleb128 0x3	# DW_AT_location
99f0af
+	.byte	0x91	# DW_OP_fbreg
99f0af
+	.sleb128 -56
99f0af
+	.byte	0x6	# DW_OP_deref
99f0af
+	.uleb128 0x6	# (DIE (0x73) DW_TAG_variable)
99f0af
+	.ascii "i\0"	# DW_AT_name
99f0af
+	.byte	0x1	# DW_AT_decl_file (gdb.arch/x86_64-vla-pointer.c)
99f0af
+	.byte	0x19	# DW_AT_decl_line
99f0af
+	.long	0x80	# DW_AT_type
99f0af
+	.uleb128 0x2	# DW_AT_location
99f0af
+	.byte	0x91	# DW_OP_fbreg
99f0af
+	.sleb128 -36
99f0af
+	.byte	0	# end of children of DIE 0x2d
99f0af
+	.uleb128 0x7	# (DIE (0x80) DW_TAG_base_type)
99f0af
+	.byte	0x4	# DW_AT_byte_size
99f0af
+	.byte	0x5	# DW_AT_encoding
99f0af
+	.ascii "int\0"	# DW_AT_name
99f0af
+	.uleb128 0x8	# (DIE (0x87) DW_TAG_array_type)
99f0af
+	.long	0xa1	# DW_AT_type
99f0af
+	.long	0x9a	# DW_AT_sibling
99f0af
+	.uleb128 0x9	# (DIE (0x90) DW_TAG_subrange_type)
99f0af
+	.long	0x9a	# DW_AT_type
99f0af
+	.uleb128 0x3	# DW_AT_upper_bound
99f0af
+	.byte	0x91	# DW_OP_fbreg
99f0af
+	.sleb128 -48
99f0af
+	.byte	0x6	# DW_OP_deref
99f0af
+	.byte	0	# end of children of DIE 0x87
99f0af
+	.uleb128 0xa	# (DIE (0x9a) DW_TAG_base_type)
99f0af
+	.byte	0x8	# DW_AT_byte_size
99f0af
+	.byte	0x7	# DW_AT_encoding
99f0af
+	.long	.LASF1	# DW_AT_name: "sizetype"
99f0af
+	.uleb128 0xa	# (DIE (0xa1) DW_TAG_base_type)
99f0af
+	.byte	0x1	# DW_AT_byte_size
99f0af
+	.byte	0x6	# DW_AT_encoding
99f0af
+	.long	.LASF2	# DW_AT_name: "char"
99f0af
+	.byte	0	# end of children of DIE 0xb
99f0af
+	.section	.debug_abbrev,"",@progbits
99f0af
+.Ldebug_abbrev0:
99f0af
+	.uleb128 0x1	# (abbrev code)
99f0af
+	.uleb128 0x11	# (TAG: DW_TAG_compile_unit)
99f0af
+	.byte	0x1	# DW_children_yes
99f0af
+	.uleb128 0x25	# (DW_AT_producer)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x13	# (DW_AT_language)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x1b	# (DW_AT_comp_dir)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x11	# (DW_AT_low_pc)
99f0af
+	.uleb128 0x1	# (DW_FORM_addr)
99f0af
+	.uleb128 0x12	# (DW_AT_high_pc)
99f0af
+	.uleb128 0x7	# (DW_FORM_data8)
99f0af
+	.uleb128 0x10	# (DW_AT_stmt_list)
99f0af
+	.uleb128 0x17	# (DW_FORM_sec_offset)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x2	# (abbrev code)
99f0af
+	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
99f0af
+	.byte	0x1	# DW_children_yes
99f0af
+	.uleb128 0x3f	# (DW_AT_external)
99f0af
+	.uleb128 0x19	# (DW_FORM_flag_present)
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0x8	# (DW_FORM_string)
99f0af
+	.uleb128 0x3a	# (DW_AT_decl_file)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3b	# (DW_AT_decl_line)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x27	# (DW_AT_prototyped)
99f0af
+	.uleb128 0x19	# (DW_FORM_flag_present)
99f0af
+	.uleb128 0x11	# (DW_AT_low_pc)
99f0af
+	.uleb128 0x1	# (DW_FORM_addr)
99f0af
+	.uleb128 0x12	# (DW_AT_high_pc)
99f0af
+	.uleb128 0x7	# (DW_FORM_data8)
99f0af
+	.uleb128 0x40	# (DW_AT_frame_base)
99f0af
+	.uleb128 0x18	# (DW_FORM_exprloc)
99f0af
+	.uleb128 0x2117	# (DW_AT_GNU_all_call_sites)
99f0af
+	.uleb128 0x19	# (DW_FORM_flag_present)
99f0af
+	.uleb128 0x1	# (DW_AT_sibling)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x3	# (abbrev code)
99f0af
+	.uleb128 0x5	# (TAG: DW_TAG_formal_parameter)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x3a	# (DW_AT_decl_file)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3b	# (DW_AT_decl_line)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.uleb128 0x2	# (DW_AT_location)
99f0af
+	.uleb128 0x18	# (DW_FORM_exprloc)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x4	# (abbrev code)
99f0af
+	.uleb128 0x16	# (TAG: DW_TAG_typedef)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x3a	# (DW_AT_decl_file)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3b	# (DW_AT_decl_line)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x5	# (abbrev code)
99f0af
+	.uleb128 0x34	# (TAG: DW_TAG_variable)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.uleb128 0x3a	# (DW_AT_decl_file)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3b	# (DW_AT_decl_line)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.uleb128 0x2	# (DW_AT_location)
99f0af
+	.uleb128 0x18	# (DW_FORM_exprloc)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x6	# (abbrev code)
99f0af
+	.uleb128 0x34	# (TAG: DW_TAG_variable)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0x8	# (DW_FORM_string)
99f0af
+	.uleb128 0x3a	# (DW_AT_decl_file)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3b	# (DW_AT_decl_line)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.uleb128 0x2	# (DW_AT_location)
99f0af
+	.uleb128 0x18	# (DW_FORM_exprloc)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x7	# (abbrev code)
99f0af
+	.uleb128 0x24	# (TAG: DW_TAG_base_type)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0xb	# (DW_AT_byte_size)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3e	# (DW_AT_encoding)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0x8	# (DW_FORM_string)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x8	# (abbrev code)
99f0af
+	.uleb128 0x1	# (TAG: DW_TAG_array_type)
99f0af
+	.byte	0x1	# DW_children_yes
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.uleb128 0x1	# (DW_AT_sibling)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0x9	# (abbrev code)
99f0af
+	.uleb128 0x21	# (TAG: DW_TAG_subrange_type)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0x49	# (DW_AT_type)
99f0af
+	.uleb128 0x13	# (DW_FORM_ref4)
99f0af
+	.uleb128 0x2f	# (DW_AT_upper_bound)
99f0af
+	.uleb128 0x18	# (DW_FORM_exprloc)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.uleb128 0xa	# (abbrev code)
99f0af
+	.uleb128 0x24	# (TAG: DW_TAG_base_type)
99f0af
+	.byte	0	# DW_children_no
99f0af
+	.uleb128 0xb	# (DW_AT_byte_size)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3e	# (DW_AT_encoding)
99f0af
+	.uleb128 0xb	# (DW_FORM_data1)
99f0af
+	.uleb128 0x3	# (DW_AT_name)
99f0af
+	.uleb128 0xe	# (DW_FORM_strp)
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.byte	0
99f0af
+	.section	.debug_aranges,"",@progbits
99f0af
+	.long	0x2c	# Length of Address Ranges Info
99f0af
+	.value	0x2	# DWARF Version
99f0af
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
99f0af
+	.byte	0x8	# Size of Address
99f0af
+	.byte	0	# Size of Segment Descriptor
99f0af
+	.value	0	# Pad to 16 byte boundary
99f0af
+	.value	0
99f0af
+	.quad	.Ltext0	# Address
99f0af
+	.quad	.Letext0-.Ltext0	# Length
99f0af
+	.quad	0
99f0af
+	.quad	0
99f0af
+	.section	.debug_line,"",@progbits
99f0af
+.Ldebug_line0:
99f0af
+	.section	.debug_str,"MS",@progbits,1
99f0af
+.LASF4:
99f0af
+	.string	"gdb.arch/x86_64-vla-pointer.c"
99f0af
+.LASF7:
99f0af
+	.string	"array_t"
99f0af
+.LASF3:
99f0af
+	.string	"GNU C11 6.2.1 20160916 (Red Hat 6.2.1-2) -mtune=generic -march=x86-64 -g"
99f0af
+.LASF2:
99f0af
+	.string	"char"
99f0af
+.LASF1:
99f0af
+	.string	"sizetype"
99f0af
+.LASF5:
99f0af
+	.string	"/home/jkratoch/redhat/fedora/gdb/master/gdb-7.12/gdb/testsuite"
99f0af
+.LASF6:
99f0af
+	.string	"size"
99f0af
+.LASF0:
99f0af
+	.string	"array"
99f0af
+	.ident	"GCC: (GNU) 6.2.1 20160916 (Red Hat 6.2.1-2)"
99f0af
+	.section	.note.GNU-stack,"",@progbits
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c	2016-10-22 09:50:40.335407367 +0200
99f0af
@@ -0,0 +1,45 @@
99f0af
+/* This testcase is part of GDB, the GNU debugger.
99f0af
+
99f0af
+   Copyright 2009 Free Software Foundation, Inc.
99f0af
+
99f0af
+   This program is free software; you can redistribute it and/or modify
99f0af
+   it under the terms of the GNU General Public License as published by
99f0af
+   the Free Software Foundation; either version 3 of the License, or
99f0af
+   (at your option) any later version.
99f0af
+
99f0af
+   This program is distributed in the hope that it will be useful,
99f0af
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+   GNU General Public License for more details.
99f0af
+
99f0af
+   You should have received a copy of the GNU General Public License
99f0af
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
99f0af
+
99f0af
+#if 0
99f0af
+
99f0af
+void
99f0af
+foo (int size)
99f0af
+{
99f0af
+  typedef char array_t[size];
99f0af
+  array_t array;
99f0af
+  int i;
99f0af
+
99f0af
+  for (i = 0; i < size; i++)
99f0af
+    array[i] = i;
99f0af
+
99f0af
+  array[0] = 0;	/* break-here */
99f0af
+}
99f0af
+
99f0af
+#else
99f0af
+
99f0af
+void foo (int size);
99f0af
+
99f0af
+int
99f0af
+main (void)
99f0af
+{
99f0af
+  foo (26);
99f0af
+  foo (78);
99f0af
+  return 0;
99f0af
+}
99f0af
+
99f0af
+#endif
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp	2016-10-22 21:10:56.210413346 +0200
99f0af
@@ -0,0 +1,65 @@
99f0af
+# Copyright 2009 Free Software Foundation, Inc.
99f0af
+
99f0af
+# This program is free software; you can redistribute it and/or modify
99f0af
+# it under the terms of the GNU General Public License as published by
99f0af
+# the Free Software Foundation; either version 3 of the License, or
99f0af
+# (at your option) any later version.
99f0af
+#
99f0af
+# This program is distributed in the hope that it will be useful,
99f0af
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+# GNU General Public License for more details.
99f0af
+#
99f0af
+# You should have received a copy of the GNU General Public License
99f0af
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
99f0af
+
99f0af
+if ![istarget "x86_64-*-*"] then {
99f0af
+    verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64."
99f0af
+    return
99f0af
+}
99f0af
+
99f0af
+set testfile x86_64-vla-pointer
99f0af
+set srcasmfile ${testfile}-foo.S
99f0af
+set srcfile ${testfile}.c
99f0af
+set binfile [standard_output_file ${testfile}]
99f0af
+set binobjfile [standard_output_file ${testfile}-foo.o]
99f0af
+if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
99f0af
+    untested "Couldn't compile test program"
99f0af
+    return -1
99f0af
+}
99f0af
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {}] != "" } {
99f0af
+    untested "Couldn't compile test program"
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+gdb_exit
99f0af
+gdb_start
99f0af
+gdb_reinitialize_dir $srcdir/$subdir
99f0af
+gdb_load ${binfile}
99f0af
+
99f0af
+if ![runto_main] {
99f0af
+    untested x86_64-vla-pointer
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"]
99f0af
+
99f0af
+gdb_continue_to_breakpoint "break-here"
99f0af
+
99f0af
+gdb_test "whatis array" "type = array_t" "first: whatis array"
99f0af
+gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "first: whatis array_t"
99f0af
+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
99f0af
+
99f0af
+gdb_test "whatis *array" "type = char" "first: whatis *array"
99f0af
+gdb_test "ptype *array" "type = char" "first: ptype *array"
99f0af
+
99f0af
+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
99f0af
+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
99f0af
+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
99f0af
+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
99f0af
+
99f0af
+gdb_continue_to_breakpoint "break_here"
99f0af
+
99f0af
+gdb_test "whatis array" "type = array_t" "second: whatis array"
99f0af
+gdb_test "whatis array_t" "type = char \\\[variable length\\\]" "second: whatis array_t"
99f0af
+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S	2016-10-22 09:45:15.851013482 +0200
7a6771
@@ -0,0 +1,455 @@
7a6771
+	.file	"x86_64-vla-typedef.c"
7a6771
+	.section	.debug_abbrev,"",@progbits
7a6771
+.Ldebug_abbrev0:
7a6771
+	.section	.debug_info,"",@progbits
7a6771
+.Ldebug_info0:
7a6771
+	.section	.debug_line,"",@progbits
7a6771
+.Ldebug_line0:
7a6771
+	.text
7a6771
+.Ltext0:
7a6771
+.globl foo
7a6771
+	.type	foo, @function
7a6771
+foo:
7a6771
+.LFB2:
7a6771
+	.file 1 "x86_64-vla-typedef.c"
7a6771
+	.loc 1 22 0
7a6771
+	pushq	%rbp
7a6771
+.LCFI0:
7a6771
+	movq	%rsp, %rbp
7a6771
+.LCFI1:
7a6771
+	subq	$64, %rsp
7a6771
+.LCFI2:
7a6771
+	movl	%edi, -36(%rbp)
7a6771
+	.loc 1 22 0
7a6771
+	movq	%rsp, %rax
7a6771
+	movq	%rax, -48(%rbp)
7a6771
+	.loc 1 23 0
7a6771
+	movl	-36(%rbp), %edx
7a6771
+	movslq	%edx,%rax
7a6771
+	subq	$1, %rax
7a6771
+	movq	%rax, -24(%rbp)
7a6771
+	.loc 1 24 0
7a6771
+	movslq	%edx,%rax
7a6771
+	addq	$15, %rax
7a6771
+	addq	$15, %rax
7a6771
+	shrq	$4, %rax
7a6771
+	salq	$4, %rax
7a6771
+	subq	%rax, %rsp
7a6771
+	movq	%rsp, -56(%rbp)
7a6771
+	movq	-56(%rbp), %rax
7a6771
+	addq	$15, %rax
7a6771
+	shrq	$4, %rax
7a6771
+	salq	$4, %rax
7a6771
+	movq	%rax, -56(%rbp)
7a6771
+	movq	-56(%rbp), %rax
7a6771
+	movq	%rax, -16(%rbp)
7a6771
+	.loc 1 27 0
7a6771
+	movl	$0, -4(%rbp)
7a6771
+	jmp	.L2
7a6771
+.L3:
7a6771
+	.loc 1 28 0
7a6771
+	movl	-4(%rbp), %esi
7a6771
+	movl	-4(%rbp), %eax
7a6771
+	movl	%eax, %ecx
7a6771
+	movq	-16(%rbp), %rdx
7a6771
+	movslq	%esi,%rax
7a6771
+	movb	%cl, (%rdx,%rax)
7a6771
+	.loc 1 27 0
7a6771
+	addl	$1, -4(%rbp)
7a6771
+.L2:
7a6771
+	movl	-4(%rbp), %eax
7a6771
+	cmpl	-36(%rbp), %eax
7a6771
+	jl	.L3
7a6771
+	.loc 1 30 0
7a6771
+	.globl	break_here
7a6771
+break_here:
7a6771
+	movq	-16(%rbp), %rax
7a6771
+	movb	$0, (%rax)
7a6771
+	movq	-48(%rbp), %rsp
7a6771
+	.loc 1 31 0
7a6771
+	leave
7a6771
+	ret
7a6771
+.LFE2:
7a6771
+	.size	foo, .-foo
7a6771
+	.section	.debug_frame,"",@progbits
7a6771
+.Lframe0:
7a6771
+	.long	.LECIE0-.LSCIE0
7a6771
+.LSCIE0:
7a6771
+	.long	0xffffffff
7a6771
+	.byte	0x1
7a6771
+	.string	""
7a6771
+	.uleb128 0x1
7a6771
+	.sleb128 -8
7a6771
+	.byte	0x10
7a6771
+	.byte	0xc
7a6771
+	.uleb128 0x7
7a6771
+	.uleb128 0x8
7a6771
+	.byte	0x90
7a6771
+	.uleb128 0x1
7a6771
+	.align 8
7a6771
+.LECIE0:
7a6771
+.LSFDE0:
7a6771
+	.long	.LEFDE0-.LASFDE0
7a6771
+.LASFDE0:
7a6771
+	.long	.Lframe0
7a6771
+	.quad	.LFB2
7a6771
+	.quad	.LFE2-.LFB2
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI0-.LFB2
7a6771
+	.byte	0xe
7a6771
+	.uleb128 0x10
7a6771
+	.byte	0x86
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI1-.LCFI0
7a6771
+	.byte	0xd
7a6771
+	.uleb128 0x6
7a6771
+	.align 8
7a6771
+.LEFDE0:
7a6771
+	.section	.eh_frame,"a",@progbits
7a6771
+.Lframe1:
7a6771
+	.long	.LECIE1-.LSCIE1
7a6771
+.LSCIE1:
7a6771
+	.long	0x0
7a6771
+	.byte	0x1
7a6771
+	.string	"zR"
7a6771
+	.uleb128 0x1
7a6771
+	.sleb128 -8
7a6771
+	.byte	0x10
7a6771
+	.uleb128 0x1
7a6771
+	.byte	0x3
7a6771
+	.byte	0xc
7a6771
+	.uleb128 0x7
7a6771
+	.uleb128 0x8
7a6771
+	.byte	0x90
7a6771
+	.uleb128 0x1
7a6771
+	.align 8
7a6771
+.LECIE1:
7a6771
+.LSFDE1:
7a6771
+	.long	.LEFDE1-.LASFDE1
7a6771
+.LASFDE1:
7a6771
+	.long	.LASFDE1-.Lframe1
7a6771
+	.long	.LFB2
7a6771
+	.long	.LFE2-.LFB2
7a6771
+	.uleb128 0x0
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI0-.LFB2
7a6771
+	.byte	0xe
7a6771
+	.uleb128 0x10
7a6771
+	.byte	0x86
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x4
7a6771
+	.long	.LCFI1-.LCFI0
7a6771
+	.byte	0xd
7a6771
+	.uleb128 0x6
7a6771
+	.align 8
7a6771
+.LEFDE1:
7a6771
+	.text
7a6771
+.Letext0:
7a6771
+	.section	.debug_loc,"",@progbits
7a6771
+.Ldebug_loc0:
7a6771
+.LLST0:
7a6771
+	.quad	.LFB2-.Ltext0
7a6771
+	.quad	.LCFI0-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x77
7a6771
+	.sleb128 8
7a6771
+	.quad	.LCFI0-.Ltext0
7a6771
+	.quad	.LCFI1-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x77
7a6771
+	.sleb128 16
7a6771
+	.quad	.LCFI1-.Ltext0
7a6771
+	.quad	.LFE2-.Ltext0
7a6771
+	.value	0x2
7a6771
+	.byte	0x76
7a6771
+	.sleb128 16
7a6771
+	.quad	0x0
7a6771
+	.quad	0x0
7a6771
+	.section	.debug_info
7a6771
+	.long	.Ldebug_end - .Ldebug_start
7a6771
+.Ldebug_start:
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_abbrev0
7a6771
+	.byte	0x8
7a6771
+	.uleb128 0x1
7a6771
+	.long	.LASF2
7a6771
+	.byte	0x1
7a6771
+	.long	.LASF3
7a6771
+	.long	.LASF4
7a6771
+	.quad	.Ltext0
7a6771
+	.quad	.Letext0
7a6771
+	.long	.Ldebug_line0
7a6771
+	.uleb128 0x2
7a6771
+	.byte	0x1
7a6771
+	.string	"foo"
7a6771
+	.byte	0x1
7a6771
+	.byte	0x16
7a6771
+	.byte	0x1
7a6771
+	.quad	.LFB2
7a6771
+	.quad	.LFE2
7a6771
+	.long	.LLST0
7a6771
+	.long	0x83
7a6771
+	.uleb128 0x3
7a6771
+	.long	.LASF5
7a6771
+	.byte	0x1
7a6771
+	.byte	0x15
7a6771
+	.long	0x83
7a6771
+	.byte	0x2
7a6771
+	.byte	0x91
7a6771
+	.sleb128 -52
7a6771
+.Ltag_typedef:
7a6771
+	.uleb128 0x4
7a6771
+	.long	.LASF6
7a6771
+	.byte	0x1
7a6771
+	.byte	0x17
7a6771
+	.long	.Ltag_array_type - .debug_info
7a6771
+	.uleb128 0x5	/* Abbrev Number: 5 (DW_TAG_variable) */
7a6771
+	.long	.LASF0
7a6771
+	.byte	0x1
7a6771
+	.byte	0x18
7a6771
+#if 1
7a6771
+	.long	.Ltag_typedef - .debug_info
7a6771
+#else
7a6771
+	/* Debugging only: Skip the typedef indirection.  */
7a6771
+	.long	.Ltag_array_type - .debug_info
7a6771
+#endif
7a6771
+	/* DW_AT_location: DW_FORM_block1: start */
7a6771
+	.byte	0x3
7a6771
+	.byte	0x91
7a6771
+	.sleb128 -32
7a6771
+#if 0
7a6771
+	.byte	0x6	/* DW_OP_deref */
7a6771
+#else
7a6771
+	.byte	0x96	/* DW_OP_nop */
7a6771
+#endif
7a6771
+	/* DW_AT_location: DW_FORM_block1: end */
7a6771
+	.uleb128 0x6
7a6771
+	.string	"i"
7a6771
+	.byte	0x1
7a6771
+	.byte	0x19
7a6771
+	.long	0x83
7a6771
+	.byte	0x2
7a6771
+	.byte	0x91
7a6771
+	.sleb128 -20
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x7
7a6771
+	.byte	0x4
7a6771
+	.byte	0x5
7a6771
+	.string	"int"
7a6771
+.Ltag_array_type:
7a6771
+	.uleb128 0x8	/* Abbrev Number: 8 (DW_TAG_array_type) */
7a6771
+	.long	0xa0 + (2f - 1f)	/* DW_AT_type: DW_FORM_ref4 */
7a6771
+	.long	0x9d + (2f - 1f)	/* DW_AT_sibling: DW_FORM_ref4 */
7a6771
+1:	/* DW_AT_data_location: DW_FORM_block1: start */
7a6771
+	.byte	2f - 3f	/* length */
7a6771
+3:
7a6771
+	.byte	0x97	/* DW_OP_push_object_address */
7a6771
+	.byte	0x6	/* DW_OP_deref */
7a6771
+2:	/* DW_AT_data_location: DW_FORM_block1: end */
7a6771
+	.uleb128 0x9
7a6771
+	.long	0x9d + (2b - 1b)	/* DW_AT_type: DW_FORM_ref4 */
7a6771
+	.byte	0x3
7a6771
+	.byte	0x91
7a6771
+	.sleb128 -40
7a6771
+	.byte	0x6
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x8
7a6771
+	.byte	0x7
7a6771
+	.uleb128 0xb
7a6771
+	.byte	0x1
7a6771
+	.byte	0x6
7a6771
+	.long	.LASF1
7a6771
+	.byte	0x0
7a6771
+.Ldebug_end:
7a6771
+	.section	.debug_abbrev
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x11
7a6771
+	.byte	0x1
7a6771
+	.uleb128 0x25
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x1b
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x11
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x12
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x10
7a6771
+	.uleb128 0x6
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0x2e
7a6771
+	.byte	0x1
7a6771
+	.uleb128 0x3f
7a6771
+	.uleb128 0xc
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x8
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x27
7a6771
+	.uleb128 0xc
7a6771
+	.uleb128 0x11
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x12
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x40
7a6771
+	.uleb128 0x6
7a6771
+	.uleb128 0x1
7a6771
+	.uleb128 0x13
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x5
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x49
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x4
7a6771
+	.uleb128 0x16
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x49
7a6771
+	.uleb128 0x13
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x5
7a6771
+	.uleb128 0x34
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x49
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x6
7a6771
+	.uleb128 0x34
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x8
7a6771
+	.uleb128 0x3a
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3b
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x49
7a6771
+	.uleb128 0x13
7a6771
+	.uleb128 0x2
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x7
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0x8
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x8	/* Abbrev Number: 8 (DW_TAG_array_type) */
7a6771
+	.uleb128 0x1
7a6771
+	.byte	0x1
7a6771
+	.uleb128 0x49	/* DW_AT_type */
7a6771
+	.uleb128 0x13	/* DW_FORM_ref4 */
7a6771
+	.uleb128 0x1	/* DW_AT_sibling */
7a6771
+	.uleb128 0x13	/* DW_FORM_ref4 */
7a6771
+	.uleb128 0x50	/* DW_AT_data_location */
7a6771
+	.uleb128 0xa	/* DW_FORM_block1 */
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x9
7a6771
+	.uleb128 0x21
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0x49	/* DW_AT_type */
7a6771
+	.uleb128 0x13	/* DW_FORM_ref4 */
7a6771
+	.uleb128 0x2f
7a6771
+	.uleb128 0xa
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xa
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x24
7a6771
+	.byte	0x0
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3e
7a6771
+	.uleb128 0xb
7a6771
+	.uleb128 0x3
7a6771
+	.uleb128 0xe
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.byte	0x0
7a6771
+	.section	.debug_pubnames,"",@progbits
7a6771
+	.long	0x16
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_info0
7a6771
+	.long	0xa8
7a6771
+	.long	0x2d
7a6771
+	.string	"foo"
7a6771
+	.long	0x0
7a6771
+	.section	.debug_aranges,"",@progbits
7a6771
+	.long	0x2c
7a6771
+	.value	0x2
7a6771
+	.long	.Ldebug_info0
7a6771
+	.byte	0x8
7a6771
+	.byte	0x0
7a6771
+	.value	0x0
7a6771
+	.value	0x0
7a6771
+	.quad	.Ltext0
7a6771
+	.quad	.Letext0-.Ltext0
7a6771
+	.quad	0x0
7a6771
+	.quad	0x0
7a6771
+	.section	.debug_str,"MS",@progbits,1
7a6771
+.LASF0:
7a6771
+	.string	"array"
7a6771
+.LASF5:
7a6771
+	.string	"size"
7a6771
+.LASF3:
7a6771
+	.string	"x86_64-vla-typedef.c"
7a6771
+.LASF6:
7a6771
+	.string	"array_t"
7a6771
+.LASF1:
7a6771
+	.string	"char"
7a6771
+.LASF4:
7a6771
+	.string	"gdb.arch"
7a6771
+.LASF2:
7a6771
+	.string	"GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
7a6771
+	.ident	"GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
7a6771
+	.section	.note.GNU-stack,"",@progbits
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c	2016-10-22 09:45:15.851013482 +0200
7a6771
@@ -0,0 +1,45 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+#if 0
7a6771
+
7a6771
+void
7a6771
+foo (int size)
7a6771
+{
7a6771
+  typedef char array_t[size];
7a6771
+  array_t array;
7a6771
+  int i;
7a6771
+
7a6771
+  for (i = 0; i < size; i++)
7a6771
+    array[i] = i;
7a6771
+
7a6771
+  array[0] = 0;	/* break-here */
7a6771
+}
7a6771
+
7a6771
+#else
7a6771
+
7a6771
+void foo (int size);
7a6771
+
7a6771
+int
7a6771
+main (void)
7a6771
+{
7a6771
+  foo (26);
7a6771
+  foo (78);
7a6771
+  return 0;
7a6771
+}
7a6771
+
7a6771
+#endif
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp	2016-10-22 09:45:15.851013482 +0200
7a6771
@@ -0,0 +1,64 @@
7a6771
+# Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
7a6771
+
7a6771
+if ![istarget "x86_64-*-*"] then {
7a6771
+    verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
7a6771
+    return
7a6771
+}
7a6771
+
7a6771
+set testfile x86_64-vla-typedef
7a6771
+set srcasmfile ${testfile}-foo.S
7a6771
+set srcfile ${testfile}.c
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+set binobjfile [standard_output_file ${testfile}-foo.o]
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
7a6771
+    untested "Couldn't compile test program"
7a6771
+    return -1
7a6771
+}
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
7a6771
+    untested "Couldn't compile test program"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+if ![runto_main] {
7a6771
+    untested x86_64-vla-typedef
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint "break_here"
7a6771
+
7a6771
+gdb_continue_to_breakpoint "break_here"
7a6771
+
7a6771
+gdb_test "whatis array" "type = array_t" "first: whatis array"
7a6771
+
7a6771
+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
7a6771
+
7a6771
+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
7a6771
+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
7a6771
+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
7a6771
+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
7a6771
+
7a6771
+gdb_continue_to_breakpoint "break_here"
7a6771
+
7a6771
+gdb_test "whatis array" "type = array_t" "second: whatis array"
7a6771
+
7a6771
+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/arrayidx.c
7a6771
===================================================================
99f0af
--- gdb-7.12.orig/gdb/testsuite/gdb.base/arrayidx.c	2016-08-01 17:50:21.000000000 +0200
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/arrayidx.c	2016-10-22 09:45:15.851013482 +0200
7a6771
@@ -17,6 +17,13 @@
7a6771
 
7a6771
 int array[] = {1, 2, 3, 4};
7a6771
 
7a6771
+#ifdef __GNUC__
7a6771
+struct
7a6771
+  {
7a6771
+    int a[0];
7a6771
+  } unbound;
7a6771
+#endif
7a6771
+
7a6771
 int
7a6771
 main (void)
7a6771
 {
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/arrayidx.exp
7a6771
===================================================================
99f0af
--- gdb-7.12.orig/gdb/testsuite/gdb.base/arrayidx.exp	2016-08-01 17:50:21.000000000 +0200
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/arrayidx.exp	2016-10-22 09:45:15.851013482 +0200
7a6771
@@ -49,4 +49,12 @@
7a6771
          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
7a6771
          "Print array with array-indexes on"
7a6771
 
7a6771
-
7a6771
+set test "p unbound.a == &unbound.a\[0\]"
7a6771
+gdb_test_multiple $test $test {
7a6771
+    -re " = 1\r\n$gdb_prompt $" {
7a6771
+	pass $test
7a6771
+    }
7a6771
+    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
7a6771
+	unsupported "$test (no GCC)"
7a6771
+    }
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/internal-var-field-address.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/internal-var-field-address.c	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,20 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+struct {
7a6771
+  int field;
7a6771
+} staticstruct = { 1 };
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/internal-var-field-address.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/internal-var-field-address.exp	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,26 @@
7a6771
+# Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+set test internal-var-field-address
7a6771
+set binfile ${test}.x
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } {
7a6771
+    untested "Couldn't compile test program"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+clean_restart $binfile
7a6771
+
7a6771
+gdb_test {set $varstruct = staticstruct}
7a6771
+gdb_test {p $varstruct.field} " = 1"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla-frame.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla-frame.c	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,31 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2011 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+#include <string.h>
7a6771
+
7a6771
+int
7a6771
+main (int argc, char **argv)
7a6771
+{
7a6771
+  char s[2 + argc];
7a6771
+  void (*f) (char *) = 0;
7a6771
+
7a6771
+  memset (s, 0, sizeof (s));
7a6771
+  s[0] = 'X';
7a6771
+
7a6771
+  f (s);
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla-frame.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla-frame.exp	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,38 @@
7a6771
+# Copyright 2011 Free Software Foundation, Inc.
7a6771
+#
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+set testfile vla-frame
7a6771
+set executable ${testfile}
7a6771
+
7a6771
+if { [prepare_for_testing ${testfile}.exp ${executable}] } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if ![runto_main] {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+set test "continue"
7a6771
+gdb_test_multiple $test $test {
7a6771
+    -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
7a6771
+	pass $test
7a6771
+    }
7a6771
+    -re "\r\n$gdb_prompt $" {
7a6771
+	untested ${testfile}.exp
7a6771
+	return
7a6771
+    }
7a6771
+}
7a6771
+
7a6771
+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla-overflow.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla-overflow.c	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,30 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+#include <stdlib.h>
7a6771
+
7a6771
+int
7a6771
+main (int argc, char **argv)
7a6771
+{
7a6771
+  int array[argc];
7a6771
+
7a6771
+  array[0] = array[0];
7a6771
+
7a6771
+  abort ();
7a6771
+
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla-overflow.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla-overflow.exp	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,109 @@
7a6771
+# Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+# We could crash in:
7a6771
+# #0  block_linkage_function (bl=0x0) at ../../gdb/block.c:69
7a6771
+# #1  in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
7a6771
+#   97	  framefunc = block_linkage_function (get_frame_block (frame, NULL));
7a6771
+# #2  in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
7a6771
+# #3  in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
7a6771
+# #4  dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
7a6771
+# #5  in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
7a6771
+# #6  in create_array_type (...) at ../../gdb/gdbtypes.c:840
7a6771
+# ...
7a6771
+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
7a6771
+# ...
7a6771
+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
7a6771
+
7a6771
+set testfile vla-overflow
7a6771
+set shfile [standard_output_file ${testfile}-gdb.sh]
7a6771
+set srcfile ${testfile}.c
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
7a6771
+    untested "Couldn't compile test program"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+set f [open "|getconf PAGESIZE" "r"]
7a6771
+gets $f pagesize
7a6771
+close $f
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
7a6771
+
7a6771
+if { [runto_main] < 0 } {
7a6771
+    untested vla-overflow
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+# Get the GDB memory size when we stay at main.
7a6771
+
7a6771
+proc memory_v_pages_get {} {
7a6771
+    global pid_of_gdb pagesize
7a6771
+    set fd [open "/proc/$pid_of_gdb/statm"]
7a6771
+    gets $fd line
7a6771
+    close $fd
7a6771
+    # number of pages of virtual memory
7a6771
+    scan $line "%d" drs
7a6771
+    return $drs
7a6771
+}
7a6771
+
7a6771
+set pages_found [memory_v_pages_get]
7a6771
+
7a6771
+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
7a6771
+set mb_reserve 40
7a6771
+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
7a6771
+set kb_found [expr $pages_found * $pagesize / 1024]
7a6771
+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
7a6771
+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
7a6771
+
7a6771
+# Create the ulimit wrapper.
7a6771
+set f [open $shfile "w"]
7a6771
+puts $f "#! /bin/sh"
7a6771
+puts $f "ulimit -v $kb_permit"
7a6771
+puts $f "exec $GDB \"\$@\""
7a6771
+close $f
7a6771
+remote_exec host "chmod +x $shfile"
7a6771
+
7a6771
+gdb_exit
7a6771
+set GDBold $GDB
7a6771
+set GDB "$shfile"
7a6771
+gdb_start
7a6771
+set GDB $GDBold
7a6771
+
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
7a6771
+
7a6771
+# Check the size again after the second run.
7a6771
+# We must not stop in main as it would cache `array' and never crash later.
7a6771
+
7a6771
+gdb_run_cmd
7a6771
+
7a6771
+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
7a6771
+
7a6771
+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
7a6771
+
7a6771
+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
7a6771
+
7a6771
+# `abort' can get expressed as `*__GI_abort'.
7a6771
+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
7a6771
+
7a6771
+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla.c	2016-10-22 09:45:15.852013490 +0200
7a6771
@@ -0,0 +1,55 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+#include <string.h>
7a6771
+
7a6771
+void
7a6771
+marker (void)
7a6771
+{
7a6771
+}
7a6771
+
7a6771
+void
7a6771
+bar (char *a, char *b, char *c, int size)
7a6771
+{
7a6771
+  memset (a, '1', size);
7a6771
+  memset (b, '2', size);
7a6771
+  memset (c, '3', 48);
7a6771
+}
7a6771
+
7a6771
+void
7a6771
+foo (int size)
7a6771
+{
7a6771
+  char temp1[size];
7a6771
+  char temp3[48];
7a6771
+
7a6771
+  temp1[size - 1] = '\0';
7a6771
+  {
7a6771
+    char temp2[size];
7a6771
+
7a6771
+    bar (temp1, temp2, temp3, size);
7a6771
+
7a6771
+    marker ();	/* break-here */
7a6771
+  }
7a6771
+}
7a6771
+
7a6771
+int
7a6771
+main (void)
7a6771
+{
7a6771
+  foo (26);
7a6771
+  foo (78);
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.base/vla.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.base/vla.exp	2016-10-22 09:45:15.853013497 +0200
7a6771
@@ -0,0 +1,62 @@
7a6771
+# Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+set testfile vla
7a6771
+set srcfile ${testfile}.c
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
7a6771
+    untested "Couldn't compile test program"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+if ![runto_main] {
7a6771
+    untested vla
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "break-here"]
7a6771
+
7a6771
+gdb_continue_to_breakpoint "break-here"
7a6771
+
7a6771
+gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1"
7a6771
+gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2"
7a6771
+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
7a6771
+
7a6771
+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
7a6771
+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
7a6771
+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
7a6771
+
7a6771
+gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
7a6771
+gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
7a6771
+gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
7a6771
+
7a6771
+gdb_continue_to_breakpoint "break-here"
7a6771
+
7a6771
+gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1"
7a6771
+gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2"
7a6771
+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
7a6771
+
7a6771
+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
7a6771
+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
7a6771
+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
7a6771
+
7a6771
+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
7a6771
+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
7a6771
+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.cp/gdb9593.cc
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.cp/gdb9593.cc	2016-10-22 09:45:15.853013497 +0200
99f0af
@@ -0,0 +1,180 @@
99f0af
+/* This testcase is part of GDB, the GNU debugger.
99f0af
+
99f0af
+   Copyright 2008, 2009 Free Software Foundation, Inc.
99f0af
+
99f0af
+   This program is free software; you can redistribute it and/or modify
99f0af
+   it under the terms of the GNU General Public License as published by
99f0af
+   the Free Software Foundation; either version 3 of the License, or
99f0af
+   (at your option) any later version.
99f0af
+
99f0af
+   This program is distributed in the hope that it will be useful,
99f0af
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+   GNU General Public License for more details.
99f0af
+
99f0af
+   You should have received a copy of the GNU General Public License
99f0af
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
99f0af
+   */
99f0af
+#include <iostream>
99f0af
+
99f0af
+using namespace std;
99f0af
+
99f0af
+class NextOverThrowDerivates
99f0af
+{
99f0af
+
99f0af
+public:
99f0af
+
99f0af
+
99f0af
+  // Single throw an exception in this function.
99f0af
+  void function1() 
99f0af
+  {
99f0af
+    throw 20;
99f0af
+  }
99f0af
+
99f0af
+  // Throw an exception in another function.
99f0af
+  void function2() 
99f0af
+  {
99f0af
+    function1();
99f0af
+  }
99f0af
+
99f0af
+  // Throw an exception in another function, but handle it
99f0af
+  // locally.
99f0af
+  void function3 () 
99f0af
+  {
99f0af
+    {
99f0af
+      try
99f0af
+	{
99f0af
+	  function1 ();
99f0af
+	}
99f0af
+      catch (...) 
99f0af
+	{
99f0af
+	  cout << "Caught and handled function1 exception" << endl;
99f0af
+	}
99f0af
+    }
99f0af
+  }
99f0af
+
99f0af
+  void rethrow ()
99f0af
+  {
99f0af
+    try
99f0af
+      {
99f0af
+	function1 ();
99f0af
+      }
99f0af
+    catch (...)
99f0af
+      {
99f0af
+	throw;
99f0af
+      }
99f0af
+  }
99f0af
+
99f0af
+  void finish ()
99f0af
+  {
99f0af
+    // We use this to test that a "finish" here does not end up in
99f0af
+    // this frame, but in the one above.
99f0af
+    try
99f0af
+      {
99f0af
+	function1 ();
99f0af
+      }
99f0af
+    catch (int x)
99f0af
+      {
99f0af
+      }
99f0af
+    function1 ();		// marker for until
99f0af
+  }
99f0af
+
99f0af
+  void until ()
99f0af
+  {
99f0af
+    function1 ();
99f0af
+    function1 ();		// until here
99f0af
+  }
99f0af
+
99f0af
+};
99f0af
+NextOverThrowDerivates next_cases;
99f0af
+
99f0af
+
99f0af
+int main () 
99f0af
+{ 
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.function1 ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+      // Discard
99f0af
+    }
99f0af
+
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.function2 ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+      // Discard
99f0af
+    }
99f0af
+
99f0af
+  try
99f0af
+    {
99f0af
+      // This is duplicated so we can next over one but step into
99f0af
+      // another.
99f0af
+      next_cases.function2 ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+      // Discard
99f0af
+    }
99f0af
+
99f0af
+  next_cases.function3 ();
99f0af
+
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.rethrow ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+      // Discard
99f0af
+    }
99f0af
+
99f0af
+  try
99f0af
+    {
99f0af
+      // Another duplicate so we can test "finish".
99f0af
+      next_cases.function2 ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+      // Discard
99f0af
+    }
99f0af
+
99f0af
+  // Another test for "finish".
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.finish ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+    }
99f0af
+
99f0af
+  // Test of "until".
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.finish ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+    }
99f0af
+
99f0af
+  // Test of "until" with an argument.
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.until ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+    }
99f0af
+
99f0af
+  // Test of "advance".
99f0af
+  try
99f0af
+    {
99f0af
+      next_cases.until ();
99f0af
+    }
99f0af
+  catch (...)
99f0af
+    {
99f0af
+    }
99f0af
+}
99f0af
+
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.cp/gdb9593.exp
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.cp/gdb9593.exp	2016-10-22 09:45:15.853013497 +0200
99f0af
@@ -0,0 +1,182 @@
99f0af
+# Copyright 2008, 2009 Free Software Foundation, Inc.
99f0af
+
99f0af
+# This program is free software; you can redistribute it and/or modify
99f0af
+# it under the terms of the GNU General Public License as published by
99f0af
+# the Free Software Foundation; either version 3 of the License, or
99f0af
+# (at your option) any later version.
99f0af
+#
99f0af
+# This program is distributed in the hope that it will be useful,
99f0af
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+# GNU General Public License for more details.
99f0af
+#
99f0af
+# You should have received a copy of the GNU General Public License
99f0af
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
99f0af
+
99f0af
+
99f0af
+if $tracelevel then {
99f0af
+    strace $tracelevel
99f0af
+}
99f0af
+
99f0af
+if { [skip_cplus_tests] } { continue }
99f0af
+
99f0af
+set testfile "gdb9593"
99f0af
+set srcfile ${testfile}.cc
99f0af
+set binfile [standard_output_file $testfile]
99f0af
+
99f0af
+# Create and source the file that provides information about the compiler
99f0af
+# used to compile the test case.
99f0af
+if [get_compiler_info "c++"] {
99f0af
+    untested gdb9593.exp
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
99f0af
+    untested gdb9593.exp
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+# Some targets can't do function calls, so don't even bother with this
99f0af
+# test.
99f0af
+if [target_info exists gdb,cannot_call_functions] {
99f0af
+    setup_xfail "*-*-*" 9593
99f0af
+    fail "This target can not call functions"
99f0af
+    continue
99f0af
+}
99f0af
+
99f0af
+gdb_exit
99f0af
+gdb_start
99f0af
+gdb_reinitialize_dir $srcdir/$subdir
99f0af
+gdb_load ${binfile}
99f0af
+
99f0af
+if ![runto_main] then {
99f0af
+    perror "couldn't run to main"
99f0af
+    continue
99f0af
+} 
99f0af
+
99f0af
+# See whether we have the needed unwinder hooks.
99f0af
+set ok 1
99f0af
+gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" {
99f0af
+    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
99f0af
+	pass "check for unwinder hook"
99f0af
+    }
99f0af
+    -re "No symbol .* in current context.\r\n$gdb_prompt $" {
99f0af
+	# Pass the test so we don't get bogus fails in the results.
99f0af
+	pass "check for unwinder hook"
99f0af
+	set ok 0
99f0af
+    }
99f0af
+}
99f0af
+if {!$ok} {
99f0af
+    untested gdb9593.exp
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+    ".*catch (...).*" \
99f0af
+    "next over a throw 1"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.function2.*" \
99f0af
+  "next past catch 1"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+    ".*catch (...).*" \
99f0af
+    "next over a throw 2"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.function2.*" \
99f0af
+  "next past catch 2"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1().*" \
99f0af
+  "step into function2 1"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+    ".*catch (...).*" \
99f0af
+    "next over a throw 3"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.function3.*" \
99f0af
+  "next past catch 3"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.rethrow.*" \
99f0af
+    "next over a throw 4"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "next over a rethrow"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.function2.*" \
99f0af
+  "next after a rethrow"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1().*" \
99f0af
+  "step into function2 2"
99f0af
+
99f0af
+gdb_test "finish" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "finish 1"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.finish ().*" \
99f0af
+  "next past catch 4"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "step into finish method"
99f0af
+
99f0af
+gdb_test "finish" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "finish 2"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.finish ().*" \
99f0af
+  "next past catch 5"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "step into finish, for until"
99f0af
+
99f0af
+gdb_test "until" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "until with no argument 1"
99f0af
+
99f0af
+set line [gdb_get_line_number "marker for until" $testfile.cc]
99f0af
+
99f0af
+gdb_test "until $line" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "next past catch 6"
99f0af
+
99f0af
+gdb_test "until" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "until with no argument 2"
99f0af
+
99f0af
+set line [gdb_get_line_number "until here" $testfile.cc]
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.until ().*" \
99f0af
+  "next past catch 6"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "step into until"
99f0af
+
99f0af
+gdb_test "until $line" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "until-over-throw"
99f0af
+
99f0af
+gdb_test "next" \
99f0af
+  ".*next_cases.until ().*" \
99f0af
+  "next past catch 7"
99f0af
+
99f0af
+gdb_test "step" \
99f0af
+  ".*function1 ().*" \
99f0af
+  "step into until, for advance"
99f0af
+
99f0af
+gdb_test "advance $line" \
99f0af
+  ".*catch (...).*" \
99f0af
+  "advance-over-throw"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S	2016-10-22 09:45:15.853013497 +0200
7a6771
@@ -0,0 +1,246 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2010 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+/* Debug information */
7a6771
+
7a6771
+/* We will `break *main' at the very first instruction.  */
7a6771
+#define main_length 1
7a6771
+
7a6771
+	.section	.data
7a6771
+vardata:
7a6771
+	/* See DW_OP_lit3 + 1 (0-based).  */
7a6771
+	.string		"seennotseen"
7a6771
+
7a6771
+	.section	.debug_info
7a6771
+.Lcu1_begin:
7a6771
+	.4byte		.Lcu1_end - .Lcu1_start	/* Length of Compilation Unit */
7a6771
+.Lcu1_start:
7a6771
+	.2byte		2			/* DWARF version number */
7a6771
+	.4byte		.Ldebug_abbrev0		/* Offset Into Abbrev. Section */
7a6771
+	.byte		4			/* Pointer Size (in bytes) */
7a6771
+
7a6771
+	/* CU die */
7a6771
+	.uleb128	1			/* Abbrev: DW_TAG_compile_unit */
7a6771
+	.4byte		.Lproducer		/* DW_AT_producer */
7a6771
+	/* Use C++ to exploit a bug in parsing DW_AT_name "".  */
7a6771
+	.byte		4			/* DW_AT_language (C++) -  */
7a6771
+	.4byte		main			/* DW_AT_low_pc */
7a6771
+	.byte		main_length		/* DW_AT_high_pc */
7a6771
+
7a6771
+.Larray_type:
7a6771
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
7a6771
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+
7a6771
+	.uleb128	3			/* Abbrev: DW_TAG_subrange_type */
7a6771
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+	.byte		0			/* DW_AT_lower_bound */
7a6771
+	.4byte		.Llen_var-.Lcu1_begin	/* DW_AT_upper_bound */
7a6771
+	.byte		0			/* End of children of die */
7a6771
+
7a6771
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
7a6771
+.Larrayb_type:
7a6771
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
7a6771
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+
7a6771
+	.uleb128	3			/* Abbrev: DW_TAG_subrange_type */
7a6771
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+	.byte		0			/* DW_AT_lower_bound */
7a6771
+	.4byte		.Llenb_var-.Lcu1_begin	/* DW_AT_upper_bound */
7a6771
+	.byte		0			/* End of children of die */
7a6771
+
7a6771
+	/* DW_AT_upper_bound is referencing register.  */
7a6771
+.Larrayreg_type:
7a6771
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
7a6771
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+
7a6771
+	.uleb128	8			/* Abbrev: DW_TAG_subrange_type with block */
7a6771
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+	.byte		0			/* DW_AT_lower_bound */
7a6771
+	.byte		2f - 1f			/* DW_AT_upper_bound */
7a6771
+1:	.byte		0x50			/* DW_OP_reg0 */
7a6771
+2:
7a6771
+	.byte		0			/* End of children of die */
7a6771
+
7a6771
+.Luint_type:
7a6771
+	.uleb128	4			/* Abbrev: DW_TAG_base_type */
7a6771
+	.4byte		.Luint_str		/* DW_AT_name */
7a6771
+	.byte		4			/* DW_AT_byte_size */
7a6771
+	.byte		7			/* DW_AT_encoding */
7a6771
+
7a6771
+.Lchar_type:
7a6771
+	.uleb128	4			/* Abbrev: DW_TAG_base_type */
7a6771
+	.4byte		.Lchar_str		/* DW_AT_name */
7a6771
+	.byte		1			/* DW_AT_byte_size */
7a6771
+	.byte		6			/* DW_AT_encoding */
7a6771
+
7a6771
+.Llen_var:
7a6771
+	.uleb128	5			/* Abbrev: DW_TAG_variable artificial */
7a6771
+	.byte		1			/* DW_AT_artificial */
7a6771
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+	.4byte		.Llen_loclist-.Lloclist	/* DW_AT_location */
7a6771
+
7a6771
+	/* optimized-out variable for b_string.  */
7a6771
+.Llenb_var:
7a6771
+	.uleb128	7			/* Abbrev: DW_TAG_variable artificial no DW_AT_location */
7a6771
+	.byte		1			/* DW_AT_artificial */
7a6771
+	.4byte		.Luint_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+
7a6771
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
7a6771
+	.string		"a_string"		/* DW_AT_name */
7a6771
+	.4byte		.Larray_type-.Lcu1_begin /* DW_AT_type */
7a6771
+	.byte		2f - 1f			/* DW_AT_location */
7a6771
+1:	.byte		3			/*   DW_OP_addr */
7a6771
+	.4byte		vardata			/*   <addr> */
7a6771
+2:
7a6771
+
7a6771
+	/* DW_AT_upper_bound is referencing an optimized-out variable.  */
7a6771
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
7a6771
+	.string		"b_string"		/* DW_AT_name */
7a6771
+	.4byte		.Larrayb_type-.Lcu1_begin /* DW_AT_type */
7a6771
+	.byte		2f - 1f			/* DW_AT_location */
7a6771
+1:	.byte		3			/*   DW_OP_addr */
7a6771
+	.4byte		vardata			/*   <addr> */
7a6771
+2:
7a6771
+
7a6771
+	/* DW_AT_upper_bound is referencing register.  */
7a6771
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
7a6771
+	.string		"reg_string"		/* DW_AT_name */
7a6771
+	.4byte		.Larrayreg_type-.Lcu1_begin /* DW_AT_type */
7a6771
+	.byte		2f - 1f			/* DW_AT_location */
7a6771
+1:	.byte		3			/*   DW_OP_addr */
7a6771
+	.4byte		vardata			/*   <addr> */
7a6771
+2:
7a6771
+
7a6771
+	.byte		0			/* End of children of CU */
7a6771
+.Lcu1_end:
7a6771
+
7a6771
+	.section	.debug_loc
7a6771
+.Lloclist:
7a6771
+.Llen_loclist:
7a6771
+	.4byte	0			# Location list begin address
7a6771
+	.4byte	main_length		# Location list end address
7a6771
+	.value	2f-1f	# Location expression size
7a6771
+1:	.byte	0x33	# DW_OP_lit3
7a6771
+	.byte	0x9f	# DW_OP_stack_value
7a6771
+2:
7a6771
+	.quad	0x0	# Location list terminator begin (*.LLST2)
7a6771
+	.quad	0x0	# Location list terminator end (*.LLST2)
7a6771
+
7a6771
+	.section .debug_abbrev
7a6771
+.Ldebug_abbrev0:
7a6771
+	.uleb128	1			/* Abbrev code */
7a6771
+	.uleb128	0x11			/* DW_TAG_compile_unit */
7a6771
+	.byte		0x1			/* has_children */
7a6771
+	.uleb128	0x25			/* DW_AT_producer */
7a6771
+	.uleb128	0xe			/* DW_FORM_strp */
7a6771
+	.uleb128	0x13			/* DW_AT_language */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x11			/* DW_AT_low_pc */
7a6771
+	.uleb128	0x1			/* DW_FORM_addr */
7a6771
+	.uleb128	0x12			/* DW_AT_high_pc */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	2			/* Abbrev code */
7a6771
+	.uleb128	0x1			/* TAG: DW_TAG_array_type */
7a6771
+	.byte		0x1			/* DW_children_yes */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	3			/* Abbrev code */
7a6771
+	.uleb128	0x21			/* DW_TAG_subrange_type */
7a6771
+	.byte		0x0			/* no children */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.uleb128	0x22			/* DW_AT_lower_bound */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x2f			/* DW_AT_upper_bound */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	4			/* Abbrev code */
7a6771
+	.uleb128	0x24			/* DW_TAG_base_type */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0xe			/* DW_FORM_strp */
7a6771
+	.uleb128	0xb			/* DW_AT_byte_size */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x3e			/* DW_AT_encoding */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	5			/* Abbrev code */
7a6771
+	.uleb128	0x34			/* DW_TAG_variable */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x34			/* DW_AT_artificial */
7a6771
+	.uleb128	0x0c			/* DW_FORM_flag */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.uleb128	0x02			/* DW_AT_location */
7a6771
+	.uleb128	0x06			/* DW_FORM_data4 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	6			/* Abbrev code */
7a6771
+	.uleb128	0x34			/* DW_TAG_variable */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.uleb128	0x2			/* DW_AT_location */
7a6771
+	.uleb128	0xa			/* DW_FORM_block1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	7			/* Abbrev code */
7a6771
+	.uleb128	0x34			/* DW_TAG_variable */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x34			/* DW_AT_artificial */
7a6771
+	.uleb128	0x0c			/* DW_FORM_flag */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	8			/* Abbrev code */
7a6771
+	.uleb128	0x21			/* DW_TAG_subrange_type with block */
7a6771
+	.byte		0x0			/* no children */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.uleb128	0x22			/* DW_AT_lower_bound */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x2f			/* DW_AT_upper_bound */
7a6771
+	.uleb128	0xa			/* DW_FORM_block1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+/* String table */
7a6771
+	.section .debug_str
7a6771
+.Lproducer:
7a6771
+	.string		"GNU C 3.3.3"
7a6771
+.Lchar_str:
7a6771
+	.string		"char"
7a6771
+.Luint_str:
7a6771
+	.string		"unsigned int"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,66 @@
7a6771
+# Copyright 2010 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+# Test printing variable with dynamic bounds which reference a different
7a6771
+# (artificial in the GCC case) variable containing loclist as its location.
7a6771
+# This testcase uses value (not address) of the referenced variable:
7a6771
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
7a6771
+
7a6771
+# This test can only be run on targets which support DWARF-2 and use gas.
7a6771
+# For now pick a sampling of likely targets.
7a6771
+if {![istarget *-*-linux*]
7a6771
+    && ![istarget *-*-gnu*]
7a6771
+    && ![istarget *-*-elf*]
7a6771
+    && ![istarget *-*-openbsd*]
7a6771
+    && ![istarget arm-*-eabi*]
7a6771
+    && ![istarget powerpc-*-eabi*]} {
7a6771
+    return 0
7a6771
+}
7a6771
+
7a6771
+set testfile dw2-bound-loclist
7a6771
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+# Verify it behaves at least as an unbound array without inferior.
7a6771
+
7a6771
+# FIXME: FSF GDB crashes due to !has_stack_frames ().
7a6771
+# But in practice that should not happen.
7a6771
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
7a6771
+#set test "p a_string"
7a6771
+#gdb_test_multiple $test $test {
7a6771
+#    -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" {
7a6771
+#	pass $test
7a6771
+#    }
7a6771
+#    -re "No registers\\.\r\n$gdb_prompt $" {
7a6771
+#	kfail "vlaregression" $test
7a6771
+#    }
7a6771
+#}
7a6771
+#
7a6771
+#gdb_test "ptype a_string" {type = char \[variable length\]}
7a6771
+
7a6771
+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
7a6771
+if ![runto "*main"] {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_test "p a_string" { = "seen"}
7a6771
+gdb_test "ptype a_string" {type = char \[4\]}
7a6771
+
7a6771
+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
7a6771
+gdb_test "ptype b_string" {type = char \[\]}
7a6771
+
7a6771
+# The register contains unpredictable value - the array size.
7a6771
+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-stripped.c	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,42 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2004 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 2 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+ 
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program; if not, write to the Free Software
7a6771
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
7a6771
+   USA.  */
7a6771
+
7a6771
+
7a6771
+/* The function `func1' traced into must have debug info on offset > 0;
7a6771
+   (DW_UNSND (attr)).  This is the reason of `func0' existence.  */
7a6771
+
7a6771
+void
7a6771
+func0(int a, int b)
7a6771
+{
7a6771
+}
7a6771
+
7a6771
+/* `func1' being traced into must have some arguments to dump.  */
7a6771
+
7a6771
+void
7a6771
+func1(int a, int b)
7a6771
+{
7a6771
+  func0 (a,b);
7a6771
+}
7a6771
+
7a6771
+int
7a6771
+main(void)
7a6771
+{
7a6771
+  func1 (1, 2);
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,79 @@
7a6771
+# Copyright 2006 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+
7a6771
+# Minimal DWARF-2 unit test
7a6771
+
7a6771
+# This test can only be run on targets which support DWARF-2.
7a6771
+# For now pick a sampling of likely targets.
7a6771
+if {![istarget *-*-linux*]
7a6771
+    && ![istarget *-*-gnu*]
7a6771
+    && ![istarget *-*-elf*]
7a6771
+    && ![istarget *-*-openbsd*]
7a6771
+    && ![istarget arm-*-eabi*]
7a6771
+    && ![istarget powerpc-*-eabi*]} {
7a6771
+    return 0  
7a6771
+}
7a6771
+
7a6771
+set testfile "dw2-stripped"
7a6771
+set srcfile ${testfile}.c
99f0af
+set binfile [standard_output_file ${testfile}.x]
7a6771
+
7a6771
+remote_exec build "rm -f ${binfile}"
7a6771
+
7a6771
+# get the value of gcc_compiled
7a6771
+if [get_compiler_info ${binfile}] {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+# This test can only be run on gcc as we use additional_flags=FIXME
7a6771
+if {$gcc_compiled == 0} {
7a6771
+    return 0
7a6771
+}
7a6771
+
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+remote_exec build "objcopy -R .debug_loc ${binfile}"
7a6771
+set strip_output [remote_exec build "objdump -h ${binfile}"]
7a6771
+
7a6771
+set test "stripping test file preservation"
7a6771
+if [ regexp ".debug_info " $strip_output]  {
7a6771
+    pass "$test (.debug_info preserved)"
7a6771
+} else {
7a6771
+    fail "$test (.debug_info got also stripped)"
7a6771
+}
7a6771
+
7a6771
+set test "stripping test file functionality"
7a6771
+if [ regexp ".debug_loc " $strip_output]  {
7a6771
+    fail "$test (.debug_loc still present)"
7a6771
+} else {
7a6771
+    pass "$test (.debug_loc stripped)"
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+# For C programs, "start" should stop in main().
7a6771
+
7a6771
+gdb_test "start" \
7a6771
+         ".*main \\(\\) at .*" \
7a6771
+         "start"
7a6771
+gdb_test "step" \
7a6771
+         "func.* \\(.*\\) at .*" \
7a6771
+         "step"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,83 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+/* Debug information */
7a6771
+
7a6771
+	.section .debug_info
7a6771
+.Lcu1_begin:
7a6771
+	/* CU header */
7a6771
+	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
7a6771
+.Lcu1_start:
7a6771
+	.2byte	2				/* DWARF Version */
7a6771
+	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
7a6771
+	.byte	4				/* Pointer size */
7a6771
+
7a6771
+	/* CU die */
7a6771
+	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
7a6771
+	.ascii	"dw2-struct-member-data-location.c\0"	/* DW_AT_name */
7a6771
+	.ascii	"GNU C 4.3.2\0"			/* DW_AT_producer */
7a6771
+	.byte	1				/* DW_AT_language (C) */
7a6771
+
7a6771
+.Ltype_uchar:
7a6771
+	.uleb128	2			/* Abbrev: DW_TAG_structure_type */
7a6771
+	.ascii		"some_struct\0"		/* DW_AT_name */
7a6771
+
7a6771
+	.uleb128	3			/* Abbrev: DW_TAG_member */
7a6771
+	.ascii		"field\0"		/* DW_AT_name */
7a6771
+	.byte		0			/* DW_AT_data_member_location */
7a6771
+
7a6771
+	.byte		0			/* End of children of some_struct */
7a6771
+
7a6771
+	.byte		0			/* End of children of CU */
7a6771
+
7a6771
+.Lcu1_end:
7a6771
+
7a6771
+/* Abbrev table */
7a6771
+	.section .debug_abbrev
7a6771
+.Labbrev1_begin:
7a6771
+	.uleb128	1			/* Abbrev code */
7a6771
+	.uleb128	0x11			/* DW_TAG_compile_unit */
7a6771
+	.byte		1			/* has_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x25			/* DW_AT_producer */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x13			/* DW_AT_language */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	2			/* Abbrev code */
7a6771
+	.uleb128	0x13			/* DW_TAG_structure_type */
7a6771
+	.byte		1			/* has_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	3			/* Abbrev code */
7a6771
+	.uleb128	0x0d			/* DW_TAG_member */
7a6771
+	.byte		0			/* has_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x38			/* DW_AT_data_member_location */
7a6771
+	.uleb128	0x0b			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,37 @@
7a6771
+# Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+# This test can only be run on targets which support DWARF-2 and use gas.
7a6771
+# For now pick a sampling of likely targets.
7a6771
+if {![istarget *-*-linux*]
7a6771
+    && ![istarget *-*-gnu*]
7a6771
+    && ![istarget *-*-elf*]
7a6771
+    && ![istarget *-*-openbsd*]
7a6771
+    && ![istarget arm-*-eabi*]
7a6771
+    && ![istarget powerpc-*-eabi*]} {
7a6771
+    return 0  
7a6771
+}
7a6771
+
7a6771
+set testfile "dw2-struct-member-data-location"
7a6771
+set srcfile ${testfile}.S
7a6771
+set binfile ${testfile}.x
7a6771
+
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+clean_restart $binfile
7a6771
+
7a6771
+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S	2016-10-22 09:45:15.854013504 +0200
7a6771
@@ -0,0 +1,121 @@
7a6771
+/* This testcase is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2012 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+/* Debug information */
7a6771
+
7a6771
+	.section	.data
7a6771
+vardata:
7a6771
+	.rept		129
7a6771
+	.ascii		"x"
7a6771
+	.endr
7a6771
+	.ascii		"UNSEEN\0"
7a6771
+
7a6771
+	.section	.debug_info
7a6771
+.Lcu1_begin:
7a6771
+	.4byte		.Lcu1_end - .Lcu1_start	/* Length of Compilation Unit */
7a6771
+.Lcu1_start:
7a6771
+	.2byte		2			/* DWARF version number */
7a6771
+	.4byte		.Ldebug_abbrev0		/* Offset Into Abbrev. Section */
7a6771
+	.byte		4			/* Pointer Size (in bytes) */
7a6771
+
7a6771
+	/* CU die */
7a6771
+	.uleb128	1			/* Abbrev: DW_TAG_compile_unit */
7a6771
+	.ascii		"GNU C 3.3.3\0"		/* DW_AT_producer */
7a6771
+	.byte		2			/* DW_AT_language (C) -  */
7a6771
+
7a6771
+.Larray_type:
7a6771
+	.uleb128	2			/* Abbrev: DW_TAG_array_type */
7a6771
+	.4byte		.Lchar_type-.Lcu1_begin	/* DW_AT_type */
7a6771
+
7a6771
+	.uleb128	8			/* Abbrev: DW_TAG_subrange_type without DW_AT_type */
7a6771
+	.byte		0			/* DW_AT_lower_bound */
7a6771
+	.byte		128			/* DW_AT_upper_bound */
7a6771
+
7a6771
+	.byte		0			/* End of children of die */
7a6771
+
7a6771
+.Lchar_type:
7a6771
+	.uleb128	4			/* Abbrev: DW_TAG_base_type */
7a6771
+	.ascii		"char\0"		/* DW_AT_name */
7a6771
+	.byte		1			/* DW_AT_byte_size */
7a6771
+	.byte		6			/* DW_AT_encoding */
7a6771
+
7a6771
+	.uleb128	6			/* Abbrev: DW_TAG_variable DW_FORM_string */
7a6771
+	.ascii		"notype_string\0"	/* DW_AT_name */
7a6771
+	.4byte		.Larray_type-.Lcu1_begin /* DW_AT_type */
7a6771
+	.byte		2f - 1f			/* DW_AT_location */
7a6771
+1:	.byte		3			/*   DW_OP_addr */
7a6771
+	.4byte		vardata			/*   <addr> */
7a6771
+2:
7a6771
+
7a6771
+	.byte		0			/* End of children of CU */
7a6771
+.Lcu1_end:
7a6771
+
7a6771
+	.section .debug_abbrev
7a6771
+.Ldebug_abbrev0:
7a6771
+	.uleb128	1			/* Abbrev code */
7a6771
+	.uleb128	0x11			/* DW_TAG_compile_unit */
7a6771
+	.byte		0x1			/* has_children */
7a6771
+	.uleb128	0x25			/* DW_AT_producer */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x13			/* DW_AT_language */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	2			/* Abbrev code */
7a6771
+	.uleb128	0x1			/* TAG: DW_TAG_array_type */
7a6771
+	.byte		0x1			/* DW_children_yes */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	4			/* Abbrev code */
7a6771
+	.uleb128	0x24			/* DW_TAG_base_type */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0xb			/* DW_AT_byte_size */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x3e			/* DW_AT_encoding */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	6			/* Abbrev code */
7a6771
+	.uleb128	0x34			/* DW_TAG_variable */
7a6771
+	.byte		0x0			/* no_children */
7a6771
+	.uleb128	0x3			/* DW_AT_name */
7a6771
+	.uleb128	0x8			/* DW_FORM_string */
7a6771
+	.uleb128	0x49			/* DW_AT_type */
7a6771
+	.uleb128	0x13			/* DW_FORM_ref4 */
7a6771
+	.uleb128	0x2			/* DW_AT_location */
7a6771
+	.uleb128	0xa			/* DW_FORM_block1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.uleb128	8			/* Abbrev code */
7a6771
+	.uleb128	0x21			/* DW_TAG_subrange_type without DW_AT_type */
7a6771
+	.byte		0x0			/* no children */
7a6771
+	.uleb128	0x22			/* DW_AT_lower_bound */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.uleb128	0x2f			/* DW_AT_upper_bound */
7a6771
+	.uleb128	0xb			/* DW_FORM_data1 */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+	.byte		0x0			/* Terminator */
7a6771
+
7a6771
+	.byte		0x0			/* Terminator */
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,39 @@
7a6771
+# Copyright 2012 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+load_lib dwarf.exp
7a6771
+
7a6771
+# https://bugzilla.redhat.com/show_bug.cgi?id=806920
7a6771
+# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
7a6771
+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
7a6771
+# specified DW_AT_type, present only in XLF produced code.
7a6771
+
7a6771
+# This test can only be run on targets which support DWARF-2 and use gas.
7a6771
+if {![dwarf2_support]} {
7a6771
+    return 0  
7a6771
+}
7a6771
+
7a6771
+set testfile dw2-subrange-no-type
7a6771
+set srcfile ${testfile}.S
7a6771
+set executable ${testfile}.x
7a6771
+set binfile [standard_output_file ${executable}]
7a6771
+
7a6771
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+clean_restart $executable
7a6771
+
7a6771
+gdb_test "ptype notype_string" {type = char \[129\]}
7a6771
+gdb_test "p notype_string" " = 'x' <repeats 129 times>"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/dwarf-stride.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/dwarf-stride.exp	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,42 @@
7a6771
+# Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a6771
+
7a6771
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+# This file is part of the gdb testsuite.  Array element stride must not be
7a6771
+# specified in the number of elements but in a number of bytes instead.
7a6771
+# Original problem:
7a6771
+# (gdb) p c40pt(1)
7a6771
+# $1 = '0-hello', ' ' <repeats 33 times>
7a6771
+# (gdb) p c40pt(2)
7a6771
+# warning: Fortran array stride not divisible by the element size
7a6771
+
7a6771
+set testfile dwarf-stride
7a6771
+set srcfile ${testfile}.f90
7a6771
+
7a6771
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if ![runto MAIN__] then {
7a6771
+    perror "couldn't run to breakpoint MAIN__"
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "break-here"]
7a6771
+gdb_continue_to_breakpoint "break-here" ".*break-here.*"
7a6771
+gdb_test "p c40pt(1)" " = '0-hello.*"
7a6771
+gdb_test "p c40pt(2)" " = '1-hello.*"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/dwarf-stride.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/dwarf-stride.f90	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,40 @@
7a6771
+! Copyright 2009 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 2 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+!
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+!
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program; if not, write to the Free Software
7a6771
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+!
7a6771
+! File written by Alan Matsuoka.
7a6771
+
7a6771
+program repro
7a6771
+
7a6771
+  type small_stride
7a6771
+     character*40 long_string
7a6771
+     integer      small_pad
7a6771
+  end type small_stride
7a6771
+
7a6771
+  type(small_stride), dimension (20), target :: unpleasant
7a6771
+  character*40, pointer, dimension(:):: c40pt
7a6771
+
7a6771
+  integer i
7a6771
+
7a6771
+  do i = 0,19
7a6771
+     unpleasant(i+1)%small_pad = i+1
7a6771
+     unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
7a6771
+  end do
7a6771
+
7a6771
+  c40pt => unpleasant%long_string
7a6771
+
7a6771
+  print *, c40pt  ! break-here
7a6771
+
7a6771
+end program repro
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/dynamic.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/dynamic.exp	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,154 @@
7a6771
+# Copyright 2007 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a6771
+
7a6771
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+# This file is part of the gdb testsuite.  It contains tests for dynamically
7a6771
+# allocated Fortran arrays.
7a6771
+# It depends on the GCC dynamic Fortran arrays DWARF support:
7a6771
+# 	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
7a6771
+
7a6771
+set testfile "dynamic"
7a6771
+set srcfile ${testfile}.f90
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
7a6771
+    untested "Couldn't compile ${srcfile}"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+if ![runto MAIN__] then {
7a6771
+    perror "couldn't run to breakpoint MAIN__"
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varx-init"]
7a6771
+gdb_continue_to_breakpoint "varx-init"
7a6771
+
7a6771
+# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
7a6771
+# Do not: gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx unallocated"
7a6771
+# Do not: gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx unallocated"
7a6771
+# Do not: gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) unallocated"
7a6771
+# Do not: gdb_test "p varx(1,5,17)=1" {no such vector element \(vector not allocated\)} "p varx(1,5,17)=1 unallocated"
7a6771
+# Do not: gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) unallocated"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varx-allocated"]
7a6771
+gdb_continue_to_breakpoint "varx-allocated"
7a6771
+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
7a6771
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
7a6771
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
7a6771
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varx-filled"]
7a6771
+gdb_continue_to_breakpoint "varx-filled"
7a6771
+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
7a6771
+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
7a6771
+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
7a6771
+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
7a6771
+# http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
7a6771
+# Do not: gdb_test "p varv" "\\$\[0-9\]* = <not associated>" "p varv unassociated"
7a6771
+# Do not: gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv unassociated"
7a6771
+
7a6771
+set test "output varx"
7a6771
+gdb_test_multiple $test $test {
7a6771
+    -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
7a6771
+	pass $test
7a6771
+    }
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varv-associated"]
7a6771
+gdb_continue_to_breakpoint "varv-associated"
7a6771
+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
7a6771
+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
7a6771
+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
7a6771
+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
7a6771
+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
7a6771
+# Intel Fortran Compiler 10.1.008 uses the pointer type.
7a6771
+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varv-filled"]
7a6771
+gdb_continue_to_breakpoint "varv-filled"
7a6771
+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
7a6771
+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
7a6771
+gdb_continue_to_breakpoint "varv-deassociated"
7a6771
+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
7a6771
+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"
7a6771
+gdb_test "ptype varv" {type = real\(kind=4\) \(:,:,:\)} "ptype varv deassociated"
7a6771
+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
7a6771
+gdb_test "p varv(1,5,17)" {no such vector element \(vector not associated\)}
7a6771
+gdb_test "ptype varv(1,5,17)" {no such vector element \(vector not associated\)}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
7a6771
+gdb_continue_to_breakpoint "varx-deallocated"
7a6771
+gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
7a6771
+gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx deallocated"
7a6771
+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
7a6771
+gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated"
7a6771
+gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "vary-passed"]
7a6771
+gdb_continue_to_breakpoint "vary-passed"
7a6771
+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
7a6771
+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "vary-filled"]
7a6771
+gdb_continue_to_breakpoint "vary-filled"
7a6771
+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
7a6771
+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
7a6771
+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
7a6771
+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
7a6771
+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
7a6771
+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
7a6771
+gdb_continue_to_breakpoint "varw-almostfilled"
7a6771
+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
7a6771
+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
7a6771
+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
7a6771
+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
7a6771
+# "up" works with GCC but other Fortran compilers may copy the values into the
7a6771
+# outer function only on the exit of the inner function.
7a6771
+# We need both variants as depending on the arch we optionally may still be
7a6771
+# executing the caller line or not after `finish'.
7a6771
+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
7a6771
+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
7a6771
+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
7a6771
+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
7a6771
+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
7a6771
+gdb_continue_to_breakpoint "varz-almostfilled"
7a6771
+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
7a6771
+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
7a6771
+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
7a6771
+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
7a6771
+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
7a6771
+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
7a6771
+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
7a6771
+gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
7a6771
+# maps to foo::vary(1,1)
7a6771
+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
7a6771
+# maps to foo::vary(2,2)
7a6771
+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
7a6771
+# maps to foo::vary(1,3)
7a6771
+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/dynamic.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/dynamic.f90	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,98 @@
7a6771
+! Copyright 2007 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 2 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+!
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+!
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program; if not, write to the Free Software
7a6771
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+!
7a6771
+! Ihis file is the Fortran source file for dynamic.exp.
7a6771
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
7a6771
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+subroutine baz
7a6771
+  real, target, allocatable :: varx (:, :, :)
7a6771
+  real, pointer :: varv (:, :, :)
7a6771
+  real, target :: varu (1, 2, 3)
7a6771
+  logical :: l
7a6771
+  allocate (varx (1:6, 5:15, 17:28))            ! varx-init
7a6771
+  l = allocated (varx)
7a6771
+  varx(:, :, :) = 6                             ! varx-allocated
7a6771
+  varx(1, 5, 17) = 7
7a6771
+  varx(2, 6, 18) = 8
7a6771
+  varx(6, 15, 28) = 9
7a6771
+  varv => varx                                  ! varx-filled
7a6771
+  l = associated (varv)
7a6771
+  varv(3, 7, 19) = 10                           ! varv-associated
7a6771
+  varv => null ()                               ! varv-filled
7a6771
+  l = associated (varv)
7a6771
+  deallocate (varx)                             ! varv-deassociated
7a6771
+  l = allocated (varx)
7a6771
+  varu(:, :, :) = 10                            ! varx-deallocated
7a6771
+  allocate (varv (1:6, 5:15, 17:28))
7a6771
+  l = associated (varv)
7a6771
+  varv(:, :, :) = 6
7a6771
+  varv(1, 5, 17) = 7
7a6771
+  varv(2, 6, 18) = 8
7a6771
+  varv(6, 15, 28) = 9
7a6771
+  deallocate (varv)
7a6771
+  l = associated (varv)
7a6771
+  varv => varu
7a6771
+  varv(1, 1, 1) = 6
7a6771
+  varv(1, 2, 3) = 7
7a6771
+  l = associated (varv)
7a6771
+end subroutine baz
7a6771
+subroutine foo (vary, varw)
7a6771
+  real :: vary (:, :)
7a6771
+  real :: varw (:, :, :)
7a6771
+  vary(:, :) = 4                                ! vary-passed
7a6771
+  vary(1, 1) = 8
7a6771
+  vary(2, 2) = 9
7a6771
+  vary(1, 3) = 10
7a6771
+  varw(:, :, :) = 5                             ! vary-filled
7a6771
+  varw(1, 1, 1) = 6
7a6771
+  varw(2, 2, 2) = 7                             ! varw-almostfilled
7a6771
+end subroutine foo
7a6771
+subroutine bar (varz, vart)
7a6771
+  real :: varz (*)
7a6771
+  real :: vart (2:11, 7:*)
7a6771
+  varz(1:3) = 4
7a6771
+  varz(2) = 5                                   ! varz-almostfilled
7a6771
+  vart(2,7) = vart(2,7)
7a6771
+end subroutine bar
7a6771
+program test
7a6771
+  interface
7a6771
+    subroutine foo (vary, varw)
7a6771
+    real :: vary (:, :)
7a6771
+    real :: varw (:, :, :)
7a6771
+    end subroutine
7a6771
+  end interface
7a6771
+  interface
7a6771
+    subroutine bar (varz, vart)
7a6771
+    real :: varz (*)
7a6771
+    real :: vart (2:11, 7:*)
7a6771
+    end subroutine
7a6771
+  end interface
7a6771
+  real :: x (10, 10), y (5), z(8, 8, 8)
7a6771
+  x(:,:) = 1
7a6771
+  y(:) = 2
7a6771
+  z(:,:,:) = 3
7a6771
+  call baz
7a6771
+  call foo (x, z(2:6, 4:7, 6:8))
7a6771
+  call bar (y, x)
7a6771
+  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
7a6771
+  if (x (1, 3) .ne. 10) call abort
7a6771
+  if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
7a6771
+  if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
7a6771
+  call foo (transpose (x), z)
7a6771
+  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
7a6771
+  if (x (3, 1) .ne. 10) call abort
7a6771
+end
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/string.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/string.exp	2016-10-22 09:45:15.855013512 +0200
7a6771
@@ -0,0 +1,59 @@
7a6771
+# Copyright 2008 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a6771
+
7a6771
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+# This file is part of the gdb testsuite.  It contains tests for Fortran
7a6771
+# strings with dynamic length.
7a6771
+
7a6771
+set testfile "string"
7a6771
+set srcfile ${testfile}.f90
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+
7a6771
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
7a6771
+    untested "Couldn't compile ${srcfile}"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+
7a6771
+if ![runto MAIN__] then {
7a6771
+    perror "couldn't run to breakpoint MAIN__"
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "var-init"]
7a6771
+gdb_continue_to_breakpoint "var-init"
7a6771
+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
7a6771
+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
7a6771
+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
7a6771
+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
7a6771
+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
7a6771
+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
7a6771
+gdb_test "p c" "\\$\[0-9\]* = 'c'"
7a6771
+gdb_test "p d" "\\$\[0-9\]* = 'd       '"
7a6771
+gdb_test "p e" "\\$\[0-9\]* = 'g   '"
7a6771
+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   '\\) \\)"
7a6771
+gdb_test "p *e" "Attempt to take contents of a non-pointer value."
7a6771
+gdb_test "p *f" "Attempt to take contents of a non-pointer value."
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "var-finish"]
7a6771
+gdb_continue_to_breakpoint "var-finish"
7a6771
+gdb_test "p e" "\\$\[0-9\]* = 'e   '" "p e re-set"
7a6771
+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"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/string.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/string.f90	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,37 @@
7a6771
+! Copyright 2008 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 2 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+!
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+!
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program; if not, write to the Free Software
7a6771
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+!
7a6771
+! Ihis file is the Fortran source file for dynamic.exp.
7a6771
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
7a6771
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+subroutine foo (e, f)
7a6771
+  character (len=1) :: c
7a6771
+  character (len=8) :: d
7a6771
+  character (len=*) :: e
7a6771
+  character (len=*) :: f (1:7, 8:10)
7a6771
+  c = 'c'
7a6771
+  d = 'd'
7a6771
+  e = 'e'                                       ! var-init
7a6771
+  f = 'f'
7a6771
+  f(1,9) = 'f2'
7a6771
+  c = 'c'                                       ! var-finish
7a6771
+end subroutine foo
7a6771
+  character (len=4) :: g, h (1:7, 8:10)
7a6771
+  g = 'g'
7a6771
+  h = 'h'
7a6771
+  call foo (g, h)
7a6771
+end
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/subrange.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/subrange.exp	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,72 @@
7a6771
+# Copyright 2011 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+if { [skip_fortran_tests] } { return -1 }
7a6771
+
7a6771
+set testfile "subrange"
7a6771
+set srcfile ${testfile}.f90
7a6771
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if ![runto MAIN__] {
7a6771
+    perror "Couldn't run to MAIN__"
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+# Depending on the compiler version being used, the name of the 4-byte integer
7a6771
+# and real types can be printed differently.  For instance, gfortran-4.1 uses
7a6771
+# "int4" whereas gfortran-4.3 uses "int(kind=4)".
7a6771
+set int4 "(int4|integer\\(kind=4\\))"
7a6771
+
7a6771
+gdb_breakpoint [gdb_get_line_number "break-static"]
7a6771
+gdb_continue_to_breakpoint "break-static" ".*break-static.*"
7a6771
+
7a6771
+foreach var {a alloc ptr} {
7a6771
+    global pf_prefix
7a6771
+    set old_prefix $pf_prefix
7a6771
+    lappend pf_prefix "$var:"
7a6771
+
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (1, 2:)" { = \(21, 31\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (2, :2)" { = \(12, 22\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (3, 2:2)" { = \(23\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (:)" "Wrong number of subscripts"
7a6771
+    setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+    gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
7a6771
+
7a6771
+    set pf_prefix $old_prefix
7a6771
+}
7a6771
+
7a6771
+gdb_test_no_output {set $a=a}
7a6771
+delete_breakpoints
7a6771
+gdb_unload
7a6771
+setup_kfail "*-*-*" "vlaregression/9999"
7a6771
+gdb_test {p $a (3, 2:2)} { = \(23\)}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.fortran/subrange.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.fortran/subrange.f90	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,28 @@
7a6771
+! Copyright 2011 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 3 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+! 
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+! 
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+program test
7a6771
+  integer, target :: a (4, 3)
7a6771
+  integer, allocatable :: alloc (:, :)
7a6771
+  integer, pointer :: ptr (:, :)
7a6771
+  do 1 i = 1, 4
7a6771
+  do 1 j = 1, 3
7a6771
+    a (i, j) = j * 10 + i
7a6771
+1 continue
7a6771
+  allocate (alloc (4, 3))
7a6771
+  alloc = a
7a6771
+  ptr => a
7a6771
+  write (*,*) a                 ! break-static
7a6771
+end
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.mi/mi2-var-stale-type.c	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,26 @@
7a6771
+/* Copyright 2011 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This file is part of GDB.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+int
7a6771
+main (int argc, char **argv)
7a6771
+{
7a6771
+  char vla[argc];
7a6771
+
7a6771
+  vla[0] = 0;	/* break-here */
7a6771
+
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,57 @@
7a6771
+# Copyright 2011 Free Software Foundation, Inc.
7a6771
+#
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+load_lib mi-support.exp
7a6771
+set MIFLAGS "-i=mi2"
7a6771
+
7a6771
+gdb_exit
7a6771
+if [mi_gdb_start] {
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+set testfile "mi2-var-stale-type"
7a6771
+set srcfile ${testfile}.c
7a6771
+set binfile [standard_output_file ${testfile}]
7a6771
+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+mi_delete_breakpoints
7a6771
+mi_gdb_reinitialize_dir $srcdir/$subdir
7a6771
+mi_gdb_load ${binfile}
7a6771
+
7a6771
+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
7a6771
+  {\^done} \
7a6771
+  "maintenance set internal-error quit yes"
7a6771
+
7a6771
+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
7a6771
+  {\^done} \
7a6771
+  "maintenance set internal-error corefile yes"
7a6771
+
7a6771
+set line [gdb_get_line_number "break-here"]
7a6771
+set func "main"
7a6771
+
7a6771
+mi_gdb_test "-break-insert -t $srcfile:$line" \
7a6771
+  "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \
7a6771
+  "breakpoint at $func"
7a6771
+
7a6771
+if { [mi_run_cmd] < 0 } {
7a6771
+    return -1
7a6771
+}
7a6771
+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
7a6771
+
7a6771
+mi_create_varobj "vla" "vla" "create local variable vla"
7a6771
+
7a6771
+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.opt/array-from-register-func.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.opt/array-from-register-func.c	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,22 @@
7a6771
+/* This file is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+int
7a6771
+func (int *arr)
7a6771
+{
7a6771
+  return arr[0];
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.opt/array-from-register.c
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.opt/array-from-register.c	2016-10-22 09:45:15.856013519 +0200
7a6771
@@ -0,0 +1,28 @@
7a6771
+/* This file is part of GDB, the GNU debugger.
7a6771
+
7a6771
+   Copyright 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+   This program is free software; you can redistribute it and/or modify
7a6771
+   it under the terms of the GNU General Public License as published by
7a6771
+   the Free Software Foundation; either version 3 of the License, or
7a6771
+   (at your option) any later version.
7a6771
+
7a6771
+   This program is distributed in the hope that it will be useful,
7a6771
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+   GNU General Public License for more details.
7a6771
+
7a6771
+   You should have received a copy of the GNU General Public License
7a6771
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
7a6771
+
7a6771
+extern int func (int *arr);
7a6771
+
7a6771
+int
7a6771
+main (void)
7a6771
+{
7a6771
+  int arr[] = { 42 };
7a6771
+
7a6771
+  func (arr);
7a6771
+
7a6771
+  return 0;
7a6771
+}
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.opt/array-from-register.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.opt/array-from-register.exp	2016-10-22 09:45:15.857013527 +0200
7a6771
@@ -0,0 +1,33 @@
7a6771
+# Copyright 2009 Free Software Foundation, Inc.
7a6771
+#
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+#
7a6771
+# This file is part of the gdb testsuite.
7a6771
+
7a6771
+if { [prepare_for_testing array-from-register.exp "array-from-register"      \
7a6771
+			  {array-from-register.c array-from-register-func.c} \
7a6771
+			  {debug optimize=-O2}] } {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+if ![runto func] then {
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
7a6771
+
7a6771
+# Seen regression:
7a6771
+# Address requested for identifier "arr" which is in register $rdi
7a6771
+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.opt/fortran-string.exp
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.opt/fortran-string.exp	2016-10-22 09:45:15.857013527 +0200
99f0af
@@ -0,0 +1,39 @@
99f0af
+# Copyright 2009 Free Software Foundation, Inc.
99f0af
+
99f0af
+# This program is free software; you can redistribute it and/or modify
99f0af
+# it under the terms of the GNU General Public License as published by
99f0af
+# the Free Software Foundation; either version 2 of the License, or
99f0af
+# (at your option) any later version.
99f0af
+# 
99f0af
+# This program is distributed in the hope that it will be useful,
99f0af
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+# GNU General Public License for more details.
99f0af
+# 
99f0af
+# You should have received a copy of the GNU General Public License
99f0af
+# along with this program; if not, write to the Free Software
99f0af
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
99f0af
+
99f0af
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
99f0af
+
99f0af
+# Test GDB can cope with Fortran strings having their length present in a CPU
99f0af
+# register.  With -O0 the string length is passed on the stack.  To make this
99f0af
+# test meaningful the follow assertion should pass.  It is not being checked
99f0af
+# here as the "_s" symbol is compiler dependent:
99f0af
+#   (gdb) info address _s
99f0af
+#   Symbol "_s" is a variable in register XX.
99f0af
+
99f0af
+set test fortran-string
99f0af
+set srcfile ${test}.f90
99f0af
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile} {debug f90 additional_flags=-O2}] } {
99f0af
+    return -1
99f0af
+}
99f0af
+
99f0af
+if ![runto $srcfile:[gdb_get_line_number "s = s"]] then {
99f0af
+    perror "couldn't run to breakpoint MAIN__"
99f0af
+    continue
99f0af
+}
99f0af
+
99f0af
+gdb_test "frame" ".*s='foo'.*"
99f0af
+gdb_test "ptype s" "type = character\\*3"
99f0af
+gdb_test "p s" "\\$\[0-9\]* = 'foo'"
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.opt/fortran-string.f90
99f0af
===================================================================
99f0af
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.opt/fortran-string.f90	2016-10-22 09:45:15.857013527 +0200
99f0af
@@ -0,0 +1,28 @@
99f0af
+! Copyright 2009 Free Software Foundation, Inc.
99f0af
+!
99f0af
+! This program is free software; you can redistribute it and/or modify
99f0af
+! it under the terms of the GNU General Public License as published by
99f0af
+! the Free Software Foundation; either version 2 of the License, or
99f0af
+! (at your option) any later version.
99f0af
+!
99f0af
+! This program is distributed in the hope that it will be useful,
99f0af
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
99f0af
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
99f0af
+! GNU General Public License for more details.
99f0af
+!
99f0af
+! You should have received a copy of the GNU General Public License
99f0af
+! along with this program; if not, write to the Free Software
99f0af
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
99f0af
+!
99f0af
+! Ihis file is the Fortran source file for dynamic.exp.
99f0af
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
99f0af
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
99f0af
+
99f0af
+  subroutine f(s)
99f0af
+  character*(*) s
99f0af
+  s = s
99f0af
+  end
99f0af
+
99f0af
+  program main
99f0af
+  call f ('foo')
99f0af
+  end
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.pascal/arrays.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.pascal/arrays.exp	2016-10-22 09:45:15.857013527 +0200
7a6771
@@ -0,0 +1,104 @@
7a6771
+# Copyright 2008, 2009 Free Software Foundation, Inc.
7a6771
+#
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 3 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+#
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+#
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+
7a6771
+if $tracelevel then {
7a6771
+    strace $tracelevel
7a6771
+}
7a6771
+
7a6771
+load_lib "pascal.exp"
7a6771
+
7a6771
+set testfile "arrays"
7a6771
+set srcfile ${testfile}.pas
7a6771
+set binfile [standard_output_file ${testfile}$EXEEXT]
7a6771
+
7a6771
+# These tests only work with fpc, using the -gw3 compile-option
7a6771
+pascal_init
7a6771
+if { $pascal_compiler_is_fpc != 1 } {
7a6771
+  return -1
7a6771
+}
7a6771
+
7a6771
+# Detect if the fpc version is below 2.3.0
7a6771
+set fpc_generates_dwarf_for_dynamic_arrays 1
7a6771
+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))}  {
7a6771
+  set fpc_generates_dwarf_for_dynamic_arrays 0
7a6771
+}
7a6771
+
7a6771
+
7a6771
+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
7a6771
+  return -1
7a6771
+}
7a6771
+
7a6771
+gdb_exit
7a6771
+gdb_start
7a6771
+gdb_reinitialize_dir $srcdir/$subdir
7a6771
+gdb_load ${binfile}
7a6771
+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
7a6771
+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
7a6771
+
7a6771
+
7a6771
+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
7a6771
+    pass "setting breakpoint 1"
7a6771
+}
7a6771
+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
7a6771
+    pass "setting breakpoint 2"
7a6771
+}
7a6771
+
7a6771
+# Verify that "start" lands inside the right procedure.
7a6771
+if { [gdb_start_cmd] < 0 } {
7a6771
+    untested start
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+gdb_test "" ".* at .*${srcfile}.*" "start"
7a6771
+
7a6771
+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
7a6771
+
7a6771
+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
7a6771
+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
7a6771
+
7a6771
+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
7a6771
+
7a6771
+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
7a6771
+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"
7a6771
+
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
7a6771
+
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
7a6771
+
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
7a6771
+
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
7a6771
+
7a6771
+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
7a6771
+  setup_xfail "*-*-*"
7a6771
+}
7a6771
+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
7a6771
+
99f0af
Index: gdb-7.12/gdb/testsuite/gdb.pascal/arrays.pas
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
99f0af
+++ gdb-7.12/gdb/testsuite/gdb.pascal/arrays.pas	2016-10-22 09:45:15.857013527 +0200
7a6771
@@ -0,0 +1,82 @@
7a6771
+{
7a6771
+ Copyright 2008, 2009 Free Software Foundation, Inc.
7a6771
+
7a6771
+ This program is free software; you can redistribute it and/or modify
7a6771
+ it under the terms of the GNU General Public License as published by
7a6771
+ the Free Software Foundation; either version 3 of the License, or
7a6771
+ (at your option) any later version.
7a6771
+
7a6771
+ This program is distributed in the hope that it will be useful,
7a6771
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+ GNU General Public License for more details.
7a6771
+
7a6771
+ You should have received a copy of the GNU General Public License
7a6771
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
7a6771
+}
7a6771
+
7a6771
+program arrays;
7a6771
+
7a6771
+{$mode objfpc}{$h+}
7a6771
+
7a6771
+uses sysutils;
7a6771
+
7a6771
+type TStatArrInt= array[0..11] of integer;
7a6771
+     TDynArrInt= array of integer;
7a6771
+     TStatArrStr= array[0..12] of string;
7a6771
+     TDynArrStr= array of string;
7a6771
+     TDynArrChar = array of char;
7a6771
+     TStatArrChar = array [0..11] of char;
7a6771
+
7a6771
+     TStat2dArrInt = array[0..11,0..4] of integer;
7a6771
+
7a6771
+var StatArrInt: TStatArrInt;
7a6771
+    StatArrInt_: Array[0..11] of integer;
7a6771
+    DynArrInt:  TDynArrInt;
7a6771
+    DynArrInt_: Array of integer;
7a6771
+    StatArrStr: TStatArrStr;
7a6771
+    DynArrStr: TDynArrStr;
7a6771
+    StatArrChar: TStatArrChar;
7a6771
+    DynArrChar: TDynArrChar;
7a6771
+
7a6771
+    Stat2dArrInt: TStat2dArrInt;
7a6771
+
7a6771
+    s: string;
7a6771
+	
7a6771
+    i,j : integer;
7a6771
+
7a6771
+begin
7a6771
+  for i := 0 to 11 do
7a6771
+    begin
7a6771
+    StatArrInt[i]:= i+50;
7a6771
+    StatArrInt_[i]:= i+50;
7a6771
+    StatArrChar[i]:= chr(ord('a')+i);
7a6771
+    for j := 0 to 4 do
7a6771
+      Stat2dArrInt[i,j]:=i+j;
7a6771
+    end;
7a6771
+  writeln(StatArrInt_[0]);
7a6771
+  writeln(StatArrInt[0]); { set breakpoint 1 here }
7a6771
+  writeln(StatArrChar[0]);
7a6771
+  writeln(Stat2dArrInt[0,0]);
7a6771
+
7a6771
+  setlength(DynArrInt,13);
7a6771
+  setlength(DynArrInt_,13);
7a6771
+  setlength(DynArrStr,13);
7a6771
+  setlength(DynArrChar,13);
7a6771
+  for i := 0 to 12 do
7a6771
+    begin
7a6771
+    DynArrInt[i]:= i+50;
7a6771
+    DynArrInt_[i]:= i+50;
7a6771
+    DynArrChar[i]:= chr(ord('a')+i);
7a6771
+    StatArrStr[i]:='str'+inttostr(i);
7a6771
+    DynArrStr[i]:='dstr'+inttostr(i);
7a6771
+    end;
7a6771
+  writeln(DynArrInt_[1]);
7a6771
+  writeln(DynArrInt[1]); 
7a6771
+  writeln(DynArrStr[1]); 
7a6771
+  writeln(StatArrStr[1]);
7a6771
+  writeln(DynArrChar[1]);
7a6771
+
7a6771
+  s := 'test'#0'string';
7a6771
+  writeln(s); { set breakpoint 2 here }
7a6771
+end.
99f0af
Index: gdb-7.12/gdb/testsuite/lib/gdb.exp
7a6771
===================================================================
99f0af
--- gdb-7.12.orig/gdb/testsuite/lib/gdb.exp	2016-10-22 09:45:15.106007986 +0200
99f0af
+++ gdb-7.12/gdb/testsuite/lib/gdb.exp	2016-10-22 09:45:15.858013534 +0200
7a6771
@@ -173,6 +173,11 @@
7a6771
 	    send_gdb "y\n"
7a6771
 	    exp_continue
7a6771
 	}
7a6771
+	-re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
7a6771
+	    { send_gdb "y\n"
7a6771
+		verbose "\t\tUnloading symbols for program being debugged"
7a6771
+	    exp_continue
7a6771
+	}
7a6771
 	-re "Discard symbol table from .*y or n.*$" {
7a6771
 	    send_gdb "y\n"
7a6771
 	    exp_continue
99f0af
Index: gdb-7.12/gdb/testsuite/lib/pascal.exp
7a6771
===================================================================
99f0af
--- gdb-7.12.orig/gdb/testsuite/lib/pascal.exp	2016-08-01 17:50:21.000000000 +0200
99f0af
+++ gdb-7.12/gdb/testsuite/lib/pascal.exp	2016-10-22 09:45:15.859013541 +0200
7a6771
@@ -37,6 +37,9 @@
7a6771
     global pascal_compiler_is_fpc
7a6771
     global gpc_compiler
7a6771
     global fpc_compiler
7a6771
+    global fpcversion_major
7a6771
+    global fpcversion_minor
7a6771
+    global fpcversion_release
7a6771
     global env
7a6771
  
7a6771
     if { $pascal_init_done == 1 } {
7a6771
@@ -64,6 +67,20 @@
7a6771
 	    set pascal_compiler_is_fpc 1
7a6771
 	    verbose -log "Free Pascal compiler found"
7a6771
 	}
7a6771
+
7a6771
+	# Detect the fpc-version
7a6771
+	if { $pascal_compiler_is_fpc == 1 } {
7a6771
+	    set fpcversion_major 1
7a6771
+	    set fpcversion_minor 0
7a6771
+	    set fpcversion_release 0
7a6771
+	    set fpcversion [ remote_exec host $fpc_compiler "-iV" ] 
7a6771
+	    if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] {
7a6771
+              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major
7a6771
+              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor
7a6771
+              regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release
7a6771
+	    }
7a6771
+            verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release"
7a6771
+	}
7a6771
     }
7a6771
     set pascal_init_done 1
7a6771
 }