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

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