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

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