]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-archer-vla-tests.patch
- updated to 7.10 and patches from fedora
[packages/gdb.git] / gdb-archer-vla-tests.patch
CommitLineData
aa964043
KK
1Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp
2===================================================================
3--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-13 03:59:37.000000000 +0200
4+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-16 23:30:30.107940483 +0200
5@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" {
6 # are. Observed with (FSF GNU Ada 4.5.3 20110124).
7 xfail $test
8 }
9+ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" {
10+ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an
11+ # empty array [0..-1].
12+ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref)
13+ xfail $test
14+ }
15 }
16
17Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
18===================================================================
19--- /dev/null 1970-01-01 00:00:00.000000000 +0000
20+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S 2014-06-16 23:30:30.108940484 +0200
21@@ -0,0 +1,455 @@
22+ .file "x86_64-vla-typedef.c"
23+ .section .debug_abbrev,"",@progbits
24+.Ldebug_abbrev0:
25+ .section .debug_info,"",@progbits
26+.Ldebug_info0:
27+ .section .debug_line,"",@progbits
28+.Ldebug_line0:
29+ .text
30+.Ltext0:
31+.globl foo
32+ .type foo, @function
33+foo:
34+.LFB2:
35+ .file 1 "x86_64-vla-typedef.c"
36+ .loc 1 22 0
37+ pushq %rbp
38+.LCFI0:
39+ movq %rsp, %rbp
40+.LCFI1:
41+ subq $64, %rsp
42+.LCFI2:
43+ movl %edi, -36(%rbp)
44+ .loc 1 22 0
45+ movq %rsp, %rax
46+ movq %rax, -48(%rbp)
47+ .loc 1 23 0
48+ movl -36(%rbp), %edx
49+ movslq %edx,%rax
50+ subq $1, %rax
51+ movq %rax, -24(%rbp)
52+ .loc 1 24 0
53+ movslq %edx,%rax
54+ addq $15, %rax
55+ addq $15, %rax
56+ shrq $4, %rax
57+ salq $4, %rax
58+ subq %rax, %rsp
59+ movq %rsp, -56(%rbp)
60+ movq -56(%rbp), %rax
61+ addq $15, %rax
62+ shrq $4, %rax
63+ salq $4, %rax
64+ movq %rax, -56(%rbp)
65+ movq -56(%rbp), %rax
66+ movq %rax, -16(%rbp)
67+ .loc 1 27 0
68+ movl $0, -4(%rbp)
69+ jmp .L2
70+.L3:
71+ .loc 1 28 0
72+ movl -4(%rbp), %esi
73+ movl -4(%rbp), %eax
74+ movl %eax, %ecx
75+ movq -16(%rbp), %rdx
76+ movslq %esi,%rax
77+ movb %cl, (%rdx,%rax)
78+ .loc 1 27 0
79+ addl $1, -4(%rbp)
80+.L2:
81+ movl -4(%rbp), %eax
82+ cmpl -36(%rbp), %eax
83+ jl .L3
84+ .loc 1 30 0
85+ .globl break_here
86+break_here:
87+ movq -16(%rbp), %rax
88+ movb $0, (%rax)
89+ movq -48(%rbp), %rsp
90+ .loc 1 31 0
91+ leave
92+ ret
93+.LFE2:
94+ .size foo, .-foo
95+ .section .debug_frame,"",@progbits
96+.Lframe0:
97+ .long .LECIE0-.LSCIE0
98+.LSCIE0:
99+ .long 0xffffffff
100+ .byte 0x1
101+ .string ""
102+ .uleb128 0x1
103+ .sleb128 -8
104+ .byte 0x10
105+ .byte 0xc
106+ .uleb128 0x7
107+ .uleb128 0x8
108+ .byte 0x90
109+ .uleb128 0x1
110+ .align 8
111+.LECIE0:
112+.LSFDE0:
113+ .long .LEFDE0-.LASFDE0
114+.LASFDE0:
115+ .long .Lframe0
116+ .quad .LFB2
117+ .quad .LFE2-.LFB2
118+ .byte 0x4
119+ .long .LCFI0-.LFB2
120+ .byte 0xe
121+ .uleb128 0x10
122+ .byte 0x86
123+ .uleb128 0x2
124+ .byte 0x4
125+ .long .LCFI1-.LCFI0
126+ .byte 0xd
127+ .uleb128 0x6
128+ .align 8
129+.LEFDE0:
130+ .section .eh_frame,"a",@progbits
131+.Lframe1:
132+ .long .LECIE1-.LSCIE1
133+.LSCIE1:
134+ .long 0x0
135+ .byte 0x1
136+ .string "zR"
137+ .uleb128 0x1
138+ .sleb128 -8
139+ .byte 0x10
140+ .uleb128 0x1
141+ .byte 0x3
142+ .byte 0xc
143+ .uleb128 0x7
144+ .uleb128 0x8
145+ .byte 0x90
146+ .uleb128 0x1
147+ .align 8
148+.LECIE1:
149+.LSFDE1:
150+ .long .LEFDE1-.LASFDE1
151+.LASFDE1:
152+ .long .LASFDE1-.Lframe1
153+ .long .LFB2
154+ .long .LFE2-.LFB2
155+ .uleb128 0x0
156+ .byte 0x4
157+ .long .LCFI0-.LFB2
158+ .byte 0xe
159+ .uleb128 0x10
160+ .byte 0x86
161+ .uleb128 0x2
162+ .byte 0x4
163+ .long .LCFI1-.LCFI0
164+ .byte 0xd
165+ .uleb128 0x6
166+ .align 8
167+.LEFDE1:
168+ .text
169+.Letext0:
170+ .section .debug_loc,"",@progbits
171+.Ldebug_loc0:
172+.LLST0:
173+ .quad .LFB2-.Ltext0
174+ .quad .LCFI0-.Ltext0
175+ .value 0x2
176+ .byte 0x77
177+ .sleb128 8
178+ .quad .LCFI0-.Ltext0
179+ .quad .LCFI1-.Ltext0
180+ .value 0x2
181+ .byte 0x77
182+ .sleb128 16
183+ .quad .LCFI1-.Ltext0
184+ .quad .LFE2-.Ltext0
185+ .value 0x2
186+ .byte 0x76
187+ .sleb128 16
188+ .quad 0x0
189+ .quad 0x0
190+ .section .debug_info
191+ .long .Ldebug_end - .Ldebug_start
192+.Ldebug_start:
193+ .value 0x2
194+ .long .Ldebug_abbrev0
195+ .byte 0x8
196+ .uleb128 0x1
197+ .long .LASF2
198+ .byte 0x1
199+ .long .LASF3
200+ .long .LASF4
201+ .quad .Ltext0
202+ .quad .Letext0
203+ .long .Ldebug_line0
204+ .uleb128 0x2
205+ .byte 0x1
206+ .string "foo"
207+ .byte 0x1
208+ .byte 0x16
209+ .byte 0x1
210+ .quad .LFB2
211+ .quad .LFE2
212+ .long .LLST0
213+ .long 0x83
214+ .uleb128 0x3
215+ .long .LASF5
216+ .byte 0x1
217+ .byte 0x15
218+ .long 0x83
219+ .byte 0x2
220+ .byte 0x91
221+ .sleb128 -52
222+.Ltag_typedef:
223+ .uleb128 0x4
224+ .long .LASF6
225+ .byte 0x1
226+ .byte 0x17
227+ .long .Ltag_array_type - .debug_info
228+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */
229+ .long .LASF0
230+ .byte 0x1
231+ .byte 0x18
232+#if 1
233+ .long .Ltag_typedef - .debug_info
234+#else
235+ /* Debugging only: Skip the typedef indirection. */
236+ .long .Ltag_array_type - .debug_info
237+#endif
238+ /* DW_AT_location: DW_FORM_block1: start */
239+ .byte 0x3
240+ .byte 0x91
241+ .sleb128 -32
242+#if 0
243+ .byte 0x6 /* DW_OP_deref */
244+#else
245+ .byte 0x96 /* DW_OP_nop */
246+#endif
247+ /* DW_AT_location: DW_FORM_block1: end */
248+ .uleb128 0x6
249+ .string "i"
250+ .byte 0x1
251+ .byte 0x19
252+ .long 0x83
253+ .byte 0x2
254+ .byte 0x91
255+ .sleb128 -20
256+ .byte 0x0
257+ .uleb128 0x7
258+ .byte 0x4
259+ .byte 0x5
260+ .string "int"
261+.Ltag_array_type:
262+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */
263+ .long 0xa0 + (2f - 1f) /* DW_AT_type: DW_FORM_ref4 */
264+ .long 0x9d + (2f - 1f) /* DW_AT_sibling: DW_FORM_ref4 */
265+1: /* DW_AT_data_location: DW_FORM_block1: start */
266+ .byte 2f - 3f /* length */
267+3:
268+ .byte 0x97 /* DW_OP_push_object_address */
269+ .byte 0x6 /* DW_OP_deref */
270+2: /* DW_AT_data_location: DW_FORM_block1: end */
271+ .uleb128 0x9
272+ .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */
273+ .byte 0x3
274+ .byte 0x91
275+ .sleb128 -40
276+ .byte 0x6
277+ .byte 0x0
278+ .uleb128 0xa
279+ .byte 0x8
280+ .byte 0x7
281+ .uleb128 0xb
282+ .byte 0x1
283+ .byte 0x6
284+ .long .LASF1
285+ .byte 0x0
286+.Ldebug_end:
287+ .section .debug_abbrev
288+ .uleb128 0x1
289+ .uleb128 0x11
290+ .byte 0x1
291+ .uleb128 0x25
292+ .uleb128 0xe
293+ .uleb128 0x13
294+ .uleb128 0xb
295+ .uleb128 0x3
296+ .uleb128 0xe
297+ .uleb128 0x1b
298+ .uleb128 0xe
299+ .uleb128 0x11
300+ .uleb128 0x1
301+ .uleb128 0x12
302+ .uleb128 0x1
303+ .uleb128 0x10
304+ .uleb128 0x6
305+ .byte 0x0
306+ .byte 0x0
307+ .uleb128 0x2
308+ .uleb128 0x2e
309+ .byte 0x1
310+ .uleb128 0x3f
311+ .uleb128 0xc
312+ .uleb128 0x3
313+ .uleb128 0x8
314+ .uleb128 0x3a
315+ .uleb128 0xb
316+ .uleb128 0x3b
317+ .uleb128 0xb
318+ .uleb128 0x27
319+ .uleb128 0xc
320+ .uleb128 0x11
321+ .uleb128 0x1
322+ .uleb128 0x12
323+ .uleb128 0x1
324+ .uleb128 0x40
325+ .uleb128 0x6
326+ .uleb128 0x1
327+ .uleb128 0x13
328+ .byte 0x0
329+ .byte 0x0
330+ .uleb128 0x3
331+ .uleb128 0x5
332+ .byte 0x0
333+ .uleb128 0x3
334+ .uleb128 0xe
335+ .uleb128 0x3a
336+ .uleb128 0xb
337+ .uleb128 0x3b
338+ .uleb128 0xb
339+ .uleb128 0x49
340+ .uleb128 0x13
341+ .uleb128 0x2
342+ .uleb128 0xa
343+ .byte 0x0
344+ .byte 0x0
345+ .uleb128 0x4
346+ .uleb128 0x16
347+ .byte 0x0
348+ .uleb128 0x3
349+ .uleb128 0xe
350+ .uleb128 0x3a
351+ .uleb128 0xb
352+ .uleb128 0x3b
353+ .uleb128 0xb
354+ .uleb128 0x49
355+ .uleb128 0x13
356+ .byte 0x0
357+ .byte 0x0
358+ .uleb128 0x5
359+ .uleb128 0x34
360+ .byte 0x0
361+ .uleb128 0x3
362+ .uleb128 0xe
363+ .uleb128 0x3a
364+ .uleb128 0xb
365+ .uleb128 0x3b
366+ .uleb128 0xb
367+ .uleb128 0x49
368+ .uleb128 0x13
369+ .uleb128 0x2
370+ .uleb128 0xa
371+ .byte 0x0
372+ .byte 0x0
373+ .uleb128 0x6
374+ .uleb128 0x34
375+ .byte 0x0
376+ .uleb128 0x3
377+ .uleb128 0x8
378+ .uleb128 0x3a
379+ .uleb128 0xb
380+ .uleb128 0x3b
381+ .uleb128 0xb
382+ .uleb128 0x49
383+ .uleb128 0x13
384+ .uleb128 0x2
385+ .uleb128 0xa
386+ .byte 0x0
387+ .byte 0x0
388+ .uleb128 0x7
389+ .uleb128 0x24
390+ .byte 0x0
391+ .uleb128 0xb
392+ .uleb128 0xb
393+ .uleb128 0x3e
394+ .uleb128 0xb
395+ .uleb128 0x3
396+ .uleb128 0x8
397+ .byte 0x0
398+ .byte 0x0
399+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */
400+ .uleb128 0x1
401+ .byte 0x1
402+ .uleb128 0x49 /* DW_AT_type */
403+ .uleb128 0x13 /* DW_FORM_ref4 */
404+ .uleb128 0x1 /* DW_AT_sibling */
405+ .uleb128 0x13 /* DW_FORM_ref4 */
406+ .uleb128 0x50 /* DW_AT_data_location */
407+ .uleb128 0xa /* DW_FORM_block1 */
408+ .byte 0x0
409+ .byte 0x0
410+ .uleb128 0x9
411+ .uleb128 0x21
412+ .byte 0x0
413+ .uleb128 0x49 /* DW_AT_type */
414+ .uleb128 0x13 /* DW_FORM_ref4 */
415+ .uleb128 0x2f
416+ .uleb128 0xa
417+ .byte 0x0
418+ .byte 0x0
419+ .uleb128 0xa
420+ .uleb128 0x24
421+ .byte 0x0
422+ .uleb128 0xb
423+ .uleb128 0xb
424+ .uleb128 0x3e
425+ .uleb128 0xb
426+ .byte 0x0
427+ .byte 0x0
428+ .uleb128 0xb
429+ .uleb128 0x24
430+ .byte 0x0
431+ .uleb128 0xb
432+ .uleb128 0xb
433+ .uleb128 0x3e
434+ .uleb128 0xb
435+ .uleb128 0x3
436+ .uleb128 0xe
437+ .byte 0x0
438+ .byte 0x0
439+ .byte 0x0
440+ .section .debug_pubnames,"",@progbits
441+ .long 0x16
442+ .value 0x2
443+ .long .Ldebug_info0
444+ .long 0xa8
445+ .long 0x2d
446+ .string "foo"
447+ .long 0x0
448+ .section .debug_aranges,"",@progbits
449+ .long 0x2c
450+ .value 0x2
451+ .long .Ldebug_info0
452+ .byte 0x8
453+ .byte 0x0
454+ .value 0x0
455+ .value 0x0
456+ .quad .Ltext0
457+ .quad .Letext0-.Ltext0
458+ .quad 0x0
459+ .quad 0x0
460+ .section .debug_str,"MS",@progbits,1
461+.LASF0:
462+ .string "array"
463+.LASF5:
464+ .string "size"
465+.LASF3:
466+ .string "x86_64-vla-typedef.c"
467+.LASF6:
468+ .string "array_t"
469+.LASF1:
470+ .string "char"
471+.LASF4:
472+ .string "gdb.arch"
473+.LASF2:
474+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
475+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
476+ .section .note.GNU-stack,"",@progbits
477Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
478===================================================================
479--- /dev/null 1970-01-01 00:00:00.000000000 +0000
480+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c 2014-06-16 23:30:30.109940484 +0200
481@@ -0,0 +1,43 @@
482+/* This testcase is part of GDB, the GNU debugger.
483+
484+ Copyright 2008 Free Software Foundation, Inc.
485+
486+ This program is free software; you can redistribute it and/or modify
487+ it under the terms of the GNU General Public License as published by
488+ the Free Software Foundation; either version 3 of the License, or
489+ (at your option) any later version.
490+
491+ This program is distributed in the hope that it will be useful,
492+ but WITHOUT ANY WARRANTY; without even the implied warranty of
493+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
494+ GNU General Public License for more details.
495+
496+ You should have received a copy of the GNU General Public License
497+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
498+
499+#if 0
500+
501+void
502+foo (int size)
503+{
504+ typedef char array_t[size];
505+ array_t array;
506+ int i;
507+
508+ for (i = 0; i < size; i++)
509+ array[i] = i;
510+
511+ array[0] = 0; /* break-here */
512+}
513+
514+#else
515+
516+int
517+main (void)
518+{
519+ foo (26);
520+ foo (78);
521+ return 0;
522+}
523+
524+#endif
525Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
526===================================================================
527--- /dev/null 1970-01-01 00:00:00.000000000 +0000
528+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp 2014-06-16 23:30:30.109940484 +0200
529@@ -0,0 +1,64 @@
530+# Copyright 2009 Free Software Foundation, Inc.
531+
532+# This program is free software; you can redistribute it and/or modify
533+# it under the terms of the GNU General Public License as published by
534+# the Free Software Foundation; either version 3 of the License, or
535+# (at your option) any later version.
536+#
537+# This program is distributed in the hope that it will be useful,
538+# but WITHOUT ANY WARRANTY; without even the implied warranty of
539+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
540+# GNU General Public License for more details.
541+#
542+# You should have received a copy of the GNU General Public License
543+# along with this program. If not, see <http://www.gnu.org/licenses/>.
544+
545+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
546+
547+if ![istarget "x86_64-*-*"] then {
548+ verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
549+ return
550+}
551+
552+set testfile x86_64-vla-typedef
553+set srcasmfile ${testfile}-foo.S
554+set srcfile ${testfile}.c
555+set binfile ${objdir}/${subdir}/${testfile}
556+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
557+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
558+ untested "Couldn't compile test program"
559+ return -1
560+}
561+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
562+ untested "Couldn't compile test program"
563+ return -1
564+}
565+
566+gdb_exit
567+gdb_start
568+gdb_reinitialize_dir $srcdir/$subdir
569+gdb_load ${binfile}
570+
571+if ![runto_main] {
572+ untested x86_64-vla-typedef
573+ return -1
574+}
575+
576+gdb_breakpoint "break_here"
577+
578+gdb_continue_to_breakpoint "break_here"
579+
580+gdb_test "whatis array" "type = array_t" "first: whatis array"
581+
582+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
583+
584+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
585+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
586+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
587+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
588+
589+gdb_continue_to_breakpoint "break_here"
590+
591+gdb_test "whatis array" "type = array_t" "second: whatis array"
592+
593+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
594Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c
595===================================================================
596--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.c 2014-06-13 03:59:37.000000000 +0200
597+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c 2014-06-16 23:30:30.109940484 +0200
598@@ -17,6 +17,13 @@
599
600 int array[] = {1, 2, 3, 4};
601
602+#ifdef __GNUC__
603+struct
604+ {
605+ int a[0];
606+ } unbound;
607+#endif
608+
609 int
610 main (void)
611 {
612Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp
613===================================================================
614--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-13 03:59:37.000000000 +0200
615+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-16 23:30:30.109940484 +0200
616@@ -49,4 +49,12 @@ gdb_test "print array" \
617 "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
618 "Print array with array-indexes on"
619
620-
621+set test "p unbound.a == &unbound.a\[0\]"
622+gdb_test_multiple $test $test {
623+ -re " = 1\r\n$gdb_prompt $" {
624+ pass $test
625+ }
626+ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
627+ unsupported "$test (no GCC)"
628+ }
629+}
630Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c
631===================================================================
632--- /dev/null 1970-01-01 00:00:00.000000000 +0000
633+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c 2014-06-16 23:30:30.109940484 +0200
634@@ -0,0 +1,20 @@
635+/* This testcase is part of GDB, the GNU debugger.
636+
637+ Copyright 2009 Free Software Foundation, Inc.
638+
639+ This program is free software; you can redistribute it and/or modify
640+ it under the terms of the GNU General Public License as published by
641+ the Free Software Foundation; either version 3 of the License, or
642+ (at your option) any later version.
643+
644+ This program is distributed in the hope that it will be useful,
645+ but WITHOUT ANY WARRANTY; without even the implied warranty of
646+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
647+ GNU General Public License for more details.
648+
649+ You should have received a copy of the GNU General Public License
650+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
651+
652+struct {
653+ int field;
654+} staticstruct = { 1 };
655Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp
656===================================================================
657--- /dev/null 1970-01-01 00:00:00.000000000 +0000
658+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp 2014-06-16 23:30:30.109940484 +0200
659@@ -0,0 +1,26 @@
660+# Copyright 2009 Free Software Foundation, Inc.
661+
662+# This program is free software; you can redistribute it and/or modify
663+# it under the terms of the GNU General Public License as published by
664+# the Free Software Foundation; either version 3 of the License, or
665+# (at your option) any later version.
666+#
667+# This program is distributed in the hope that it will be useful,
668+# but WITHOUT ANY WARRANTY; without even the implied warranty of
669+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
670+# GNU General Public License for more details.
671+#
672+# You should have received a copy of the GNU General Public License
673+# along with this program. If not, see <http://www.gnu.org/licenses/>.
674+
675+set test internal-var-field-address
676+set binfile ${test}.x
677+if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } {
678+ untested "Couldn't compile test program"
679+ return -1
680+}
681+
682+clean_restart $binfile
683+
684+gdb_test {set $varstruct = staticstruct}
685+gdb_test {p $varstruct.field} " = 1"
686Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c
687===================================================================
688--- /dev/null 1970-01-01 00:00:00.000000000 +0000
689+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c 2014-06-16 23:30:30.110940485 +0200
690@@ -0,0 +1,31 @@
691+/* This testcase is part of GDB, the GNU debugger.
692+
693+ Copyright 2011 Free Software Foundation, Inc.
694+
695+ This program is free software; you can redistribute it and/or modify
696+ it under the terms of the GNU General Public License as published by
697+ the Free Software Foundation; either version 3 of the License, or
698+ (at your option) any later version.
699+
700+ This program is distributed in the hope that it will be useful,
701+ but WITHOUT ANY WARRANTY; without even the implied warranty of
702+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
703+ GNU General Public License for more details.
704+
705+ You should have received a copy of the GNU General Public License
706+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
707+
708+#include <string.h>
709+
710+int
711+main (int argc, char **argv)
712+{
713+ char s[2 + argc];
714+ void (*f) (char *) = 0;
715+
716+ memset (s, 0, sizeof (s));
717+ s[0] = 'X';
718+
719+ f (s);
720+ return 0;
721+}
722Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp
723===================================================================
724--- /dev/null 1970-01-01 00:00:00.000000000 +0000
725+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp 2014-06-16 23:30:30.110940485 +0200
726@@ -0,0 +1,38 @@
727+# Copyright 2011 Free Software Foundation, Inc.
728+#
729+# This program is free software; you can redistribute it and/or modify
730+# it under the terms of the GNU General Public License as published by
731+# the Free Software Foundation; either version 3 of the License, or
732+# (at your option) any later version.
733+#
734+# This program is distributed in the hope that it will be useful,
735+# but WITHOUT ANY WARRANTY; without even the implied warranty of
736+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
737+# GNU General Public License for more details.
738+#
739+# You should have received a copy of the GNU General Public License
740+# along with this program. If not, see <http://www.gnu.org/licenses/>.
741+
742+set testfile vla-frame
743+set executable ${testfile}
744+
745+if { [prepare_for_testing ${testfile}.exp ${executable}] } {
746+ return -1
747+}
748+
749+if ![runto_main] {
750+ return -1
751+}
752+
753+set test "continue"
754+gdb_test_multiple $test $test {
755+ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
756+ pass $test
757+ }
758+ -re "\r\n$gdb_prompt $" {
759+ untested ${testfile}.exp
760+ return
761+ }
762+}
763+
764+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
765Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c
766===================================================================
767--- /dev/null 1970-01-01 00:00:00.000000000 +0000
768+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c 2014-06-16 23:30:30.110940485 +0200
769@@ -0,0 +1,30 @@
770+/* This testcase is part of GDB, the GNU debugger.
771+
772+ Copyright 2008 Free Software Foundation, Inc.
773+
774+ This program is free software; you can redistribute it and/or modify
775+ it under the terms of the GNU General Public License as published by
776+ the Free Software Foundation; either version 3 of the License, or
777+ (at your option) any later version.
778+
779+ This program is distributed in the hope that it will be useful,
780+ but WITHOUT ANY WARRANTY; without even the implied warranty of
781+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
782+ GNU General Public License for more details.
783+
784+ You should have received a copy of the GNU General Public License
785+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
786+
787+#include <stdlib.h>
788+
789+int
790+main (int argc, char **argv)
791+{
792+ int array[argc];
793+
794+ array[0] = array[0];
795+
796+ abort ();
797+
798+ return 0;
799+}
800Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp
801===================================================================
802--- /dev/null 1970-01-01 00:00:00.000000000 +0000
803+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp 2014-06-16 23:30:30.110940485 +0200
804@@ -0,0 +1,109 @@
805+# Copyright 2008 Free Software Foundation, Inc.
806+
807+# This program is free software; you can redistribute it and/or modify
808+# it under the terms of the GNU General Public License as published by
809+# the Free Software Foundation; either version 3 of the License, or
810+# (at your option) any later version.
811+#
812+# This program is distributed in the hope that it will be useful,
813+# but WITHOUT ANY WARRANTY; without even the implied warranty of
814+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
815+# GNU General Public License for more details.
816+#
817+# You should have received a copy of the GNU General Public License
818+# along with this program. If not, see <http://www.gnu.org/licenses/>.
819+
820+# We could crash in:
821+# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69
822+# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
823+# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL));
824+# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
825+# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
826+# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
827+# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
828+# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840
829+# ...
830+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
831+# ...
832+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
833+
834+set testfile vla-overflow
835+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
836+set srcfile ${testfile}.c
837+set binfile ${objdir}/${subdir}/${testfile}
838+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
839+ untested "Couldn't compile test program"
840+ return -1
841+}
842+
843+set f [open "|getconf PAGESIZE" "r"]
844+gets $f pagesize
845+close $f
846+
847+gdb_exit
848+gdb_start
849+gdb_reinitialize_dir $srcdir/$subdir
850+gdb_load ${binfile}
851+
852+set pid_of_gdb [exp_pid -i [board_info host fileid]]
853+
854+if { [runto_main] < 0 } {
855+ untested vla-overflow
856+ return -1
857+}
858+
859+# Get the GDB memory size when we stay at main.
860+
861+proc memory_v_pages_get {} {
862+ global pid_of_gdb pagesize
863+ set fd [open "/proc/$pid_of_gdb/statm"]
864+ gets $fd line
865+ close $fd
866+ # number of pages of virtual memory
867+ scan $line "%d" drs
868+ return $drs
869+}
870+
871+set pages_found [memory_v_pages_get]
872+
873+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
874+set mb_reserve 40
875+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
876+set kb_found [expr $pages_found * $pagesize / 1024]
877+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
878+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
879+
880+# Create the ulimit wrapper.
881+set f [open $shfile "w"]
882+puts $f "#! /bin/sh"
883+puts $f "ulimit -v $kb_permit"
884+puts $f "exec $GDB \"\$@\""
885+close $f
886+remote_exec host "chmod +x $shfile"
887+
888+gdb_exit
889+set GDBold $GDB
890+set GDB "$shfile"
891+gdb_start
892+set GDB $GDBold
893+
894+gdb_reinitialize_dir $srcdir/$subdir
895+gdb_load ${binfile}
896+
897+set pid_of_gdb [exp_pid -i [board_info host fileid]]
898+
899+# Check the size again after the second run.
900+# We must not stop in main as it would cache `array' and never crash later.
901+
902+gdb_run_cmd
903+
904+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
905+
906+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
907+
908+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
909+
910+# `abort' can get expressed as `*__GI_abort'.
911+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
912+
913+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
914Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c
915===================================================================
916--- /dev/null 1970-01-01 00:00:00.000000000 +0000
917+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c 2014-06-16 23:30:30.110940485 +0200
918@@ -0,0 +1,55 @@
919+/* This testcase is part of GDB, the GNU debugger.
920+
921+ Copyright 2008 Free Software Foundation, Inc.
922+
923+ This program is free software; you can redistribute it and/or modify
924+ it under the terms of the GNU General Public License as published by
925+ the Free Software Foundation; either version 3 of the License, or
926+ (at your option) any later version.
927+
928+ This program is distributed in the hope that it will be useful,
929+ but WITHOUT ANY WARRANTY; without even the implied warranty of
930+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
931+ GNU General Public License for more details.
932+
933+ You should have received a copy of the GNU General Public License
934+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
935+
936+#include <string.h>
937+
938+void
939+marker (void)
940+{
941+}
942+
943+void
944+bar (char *a, char *b, char *c, int size)
945+{
946+ memset (a, '1', size);
947+ memset (b, '2', size);
948+ memset (c, '3', 48);
949+}
950+
951+void
952+foo (int size)
953+{
954+ char temp1[size];
955+ char temp3[48];
956+
957+ temp1[size - 1] = '\0';
958+ {
959+ char temp2[size];
960+
961+ bar (temp1, temp2, temp3, size);
962+
963+ marker (); /* break-here */
964+ }
965+}
966+
967+int
968+main (void)
969+{
970+ foo (26);
971+ foo (78);
972+ return 0;
973+}
974Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp
975===================================================================
976--- /dev/null 1970-01-01 00:00:00.000000000 +0000
977+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp 2014-06-16 23:30:30.110940485 +0200
978@@ -0,0 +1,62 @@
979+# Copyright 2008 Free Software Foundation, Inc.
980+
981+# This program is free software; you can redistribute it and/or modify
982+# it under the terms of the GNU General Public License as published by
983+# the Free Software Foundation; either version 3 of the License, or
984+# (at your option) any later version.
985+#
986+# This program is distributed in the hope that it will be useful,
987+# but WITHOUT ANY WARRANTY; without even the implied warranty of
988+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
989+# GNU General Public License for more details.
990+#
991+# You should have received a copy of the GNU General Public License
992+# along with this program. If not, see <http://www.gnu.org/licenses/>.
993+
994+set testfile vla
995+set srcfile ${testfile}.c
996+set binfile ${objdir}/${subdir}/${testfile}
997+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
998+ untested "Couldn't compile test program"
999+ return -1
1000+}
1001+
1002+gdb_exit
1003+gdb_start
1004+gdb_reinitialize_dir $srcdir/$subdir
1005+gdb_load ${binfile}
1006+
1007+if ![runto_main] {
1008+ untested vla
1009+ return -1
1010+}
1011+
1012+gdb_breakpoint [gdb_get_line_number "break-here"]
1013+
1014+gdb_continue_to_breakpoint "break-here"
1015+
1016+gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1"
1017+gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2"
1018+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
1019+
1020+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
1021+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
1022+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
1023+
1024+gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
1025+gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
1026+gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
1027+
1028+gdb_continue_to_breakpoint "break-here"
1029+
1030+gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1"
1031+gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2"
1032+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
1033+
1034+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
1035+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
1036+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
1037+
1038+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
1039+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
1040+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
1041Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
1042===================================================================
1043--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1044+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S 2014-06-16 23:30:30.111940487 +0200
1045@@ -0,0 +1,246 @@
1046+/* This testcase is part of GDB, the GNU debugger.
1047+
1048+ Copyright 2010 Free Software Foundation, Inc.
1049+
1050+ This program is free software; you can redistribute it and/or modify
1051+ it under the terms of the GNU General Public License as published by
1052+ the Free Software Foundation; either version 3 of the License, or
1053+ (at your option) any later version.
1054+
1055+ This program is distributed in the hope that it will be useful,
1056+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1057+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1058+ GNU General Public License for more details.
1059+
1060+ You should have received a copy of the GNU General Public License
1061+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
1062+
1063+/* Debug information */
1064+
1065+/* We will `break *main' at the very first instruction. */
1066+#define main_length 1
1067+
1068+ .section .data
1069+vardata:
1070+ /* See DW_OP_lit3 + 1 (0-based). */
1071+ .string "seennotseen"
1072+
1073+ .section .debug_info
1074+.Lcu1_begin:
1075+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1076+.Lcu1_start:
1077+ .2byte 2 /* DWARF version number */
1078+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1079+ .byte 4 /* Pointer Size (in bytes) */
1080+
1081+ /* CU die */
1082+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1083+ .4byte .Lproducer /* DW_AT_producer */
1084+ /* Use C++ to exploit a bug in parsing DW_AT_name "". */
1085+ .byte 4 /* DW_AT_language (C++) - */
1086+ .4byte main /* DW_AT_low_pc */
1087+ .byte main_length /* DW_AT_high_pc */
1088+
1089+.Larray_type:
1090+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
1091+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1092+
1093+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
1094+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1095+ .byte 0 /* DW_AT_lower_bound */
1096+ .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */
1097+ .byte 0 /* End of children of die */
1098+
1099+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
1100+.Larrayb_type:
1101+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
1102+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1103+
1104+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
1105+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1106+ .byte 0 /* DW_AT_lower_bound */
1107+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */
1108+ .byte 0 /* End of children of die */
1109+
1110+ /* DW_AT_upper_bound is referencing register. */
1111+.Larrayreg_type:
1112+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
1113+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1114+
1115+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */
1116+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1117+ .byte 0 /* DW_AT_lower_bound */
1118+ .byte 2f - 1f /* DW_AT_upper_bound */
1119+1: .byte 0x50 /* DW_OP_reg0 */
1120+2:
1121+ .byte 0 /* End of children of die */
1122+
1123+.Luint_type:
1124+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
1125+ .4byte .Luint_str /* DW_AT_name */
1126+ .byte 4 /* DW_AT_byte_size */
1127+ .byte 7 /* DW_AT_encoding */
1128+
1129+.Lchar_type:
1130+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
1131+ .4byte .Lchar_str /* DW_AT_name */
1132+ .byte 1 /* DW_AT_byte_size */
1133+ .byte 6 /* DW_AT_encoding */
1134+
1135+.Llen_var:
1136+ .uleb128 5 /* Abbrev: DW_TAG_variable artificial */
1137+ .byte 1 /* DW_AT_artificial */
1138+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1139+ .4byte .Llen_loclist-.Lloclist /* DW_AT_location */
1140+
1141+ /* optimized-out variable for b_string. */
1142+.Llenb_var:
1143+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
1144+ .byte 1 /* DW_AT_artificial */
1145+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1146+
1147+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1148+ .string "a_string" /* DW_AT_name */
1149+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
1150+ .byte 2f - 1f /* DW_AT_location */
1151+1: .byte 3 /* DW_OP_addr */
1152+ .4byte vardata /* <addr> */
1153+2:
1154+
1155+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
1156+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1157+ .string "b_string" /* DW_AT_name */
1158+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */
1159+ .byte 2f - 1f /* DW_AT_location */
1160+1: .byte 3 /* DW_OP_addr */
1161+ .4byte vardata /* <addr> */
1162+2:
1163+
1164+ /* DW_AT_upper_bound is referencing register. */
1165+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1166+ .string "reg_string" /* DW_AT_name */
1167+ .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */
1168+ .byte 2f - 1f /* DW_AT_location */
1169+1: .byte 3 /* DW_OP_addr */
1170+ .4byte vardata /* <addr> */
1171+2:
1172+
1173+ .byte 0 /* End of children of CU */
1174+.Lcu1_end:
1175+
1176+ .section .debug_loc
1177+.Lloclist:
1178+.Llen_loclist:
1179+ .4byte 0 # Location list begin address
1180+ .4byte main_length # Location list end address
1181+ .value 2f-1f # Location expression size
1182+1: .byte 0x33 # DW_OP_lit3
1183+ .byte 0x9f # DW_OP_stack_value
1184+2:
1185+ .quad 0x0 # Location list terminator begin (*.LLST2)
1186+ .quad 0x0 # Location list terminator end (*.LLST2)
1187+
1188+ .section .debug_abbrev
1189+.Ldebug_abbrev0:
1190+ .uleb128 1 /* Abbrev code */
1191+ .uleb128 0x11 /* DW_TAG_compile_unit */
1192+ .byte 0x1 /* has_children */
1193+ .uleb128 0x25 /* DW_AT_producer */
1194+ .uleb128 0xe /* DW_FORM_strp */
1195+ .uleb128 0x13 /* DW_AT_language */
1196+ .uleb128 0xb /* DW_FORM_data1 */
1197+ .uleb128 0x11 /* DW_AT_low_pc */
1198+ .uleb128 0x1 /* DW_FORM_addr */
1199+ .uleb128 0x12 /* DW_AT_high_pc */
1200+ .uleb128 0xb /* DW_FORM_data1 */
1201+ .byte 0x0 /* Terminator */
1202+ .byte 0x0 /* Terminator */
1203+
1204+ .uleb128 2 /* Abbrev code */
1205+ .uleb128 0x1 /* TAG: DW_TAG_array_type */
1206+ .byte 0x1 /* DW_children_yes */
1207+ .uleb128 0x49 /* DW_AT_type */
1208+ .uleb128 0x13 /* DW_FORM_ref4 */
1209+ .byte 0x0 /* Terminator */
1210+ .byte 0x0 /* Terminator */
1211+
1212+ .uleb128 3 /* Abbrev code */
1213+ .uleb128 0x21 /* DW_TAG_subrange_type */
1214+ .byte 0x0 /* no children */
1215+ .uleb128 0x49 /* DW_AT_type */
1216+ .uleb128 0x13 /* DW_FORM_ref4 */
1217+ .uleb128 0x22 /* DW_AT_lower_bound */
1218+ .uleb128 0xb /* DW_FORM_data1 */
1219+ .uleb128 0x2f /* DW_AT_upper_bound */
1220+ .uleb128 0x13 /* DW_FORM_ref4 */
1221+ .byte 0x0 /* Terminator */
1222+ .byte 0x0 /* Terminator */
1223+
1224+ .uleb128 4 /* Abbrev code */
1225+ .uleb128 0x24 /* DW_TAG_base_type */
1226+ .byte 0x0 /* no_children */
1227+ .uleb128 0x3 /* DW_AT_name */
1228+ .uleb128 0xe /* DW_FORM_strp */
1229+ .uleb128 0xb /* DW_AT_byte_size */
1230+ .uleb128 0xb /* DW_FORM_data1 */
1231+ .uleb128 0x3e /* DW_AT_encoding */
1232+ .uleb128 0xb /* DW_FORM_data1 */
1233+ .byte 0x0 /* Terminator */
1234+ .byte 0x0 /* Terminator */
1235+
1236+ .uleb128 5 /* Abbrev code */
1237+ .uleb128 0x34 /* DW_TAG_variable */
1238+ .byte 0x0 /* no_children */
1239+ .uleb128 0x34 /* DW_AT_artificial */
1240+ .uleb128 0x0c /* DW_FORM_flag */
1241+ .uleb128 0x49 /* DW_AT_type */
1242+ .uleb128 0x13 /* DW_FORM_ref4 */
1243+ .uleb128 0x02 /* DW_AT_location */
1244+ .uleb128 0x06 /* DW_FORM_data4 */
1245+ .byte 0x0 /* Terminator */
1246+ .byte 0x0 /* Terminator */
1247+
1248+ .uleb128 6 /* Abbrev code */
1249+ .uleb128 0x34 /* DW_TAG_variable */
1250+ .byte 0x0 /* no_children */
1251+ .uleb128 0x3 /* DW_AT_name */
1252+ .uleb128 0x8 /* DW_FORM_string */
1253+ .uleb128 0x49 /* DW_AT_type */
1254+ .uleb128 0x13 /* DW_FORM_ref4 */
1255+ .uleb128 0x2 /* DW_AT_location */
1256+ .uleb128 0xa /* DW_FORM_block1 */
1257+ .byte 0x0 /* Terminator */
1258+ .byte 0x0 /* Terminator */
1259+
1260+ .uleb128 7 /* Abbrev code */
1261+ .uleb128 0x34 /* DW_TAG_variable */
1262+ .byte 0x0 /* no_children */
1263+ .uleb128 0x34 /* DW_AT_artificial */
1264+ .uleb128 0x0c /* DW_FORM_flag */
1265+ .uleb128 0x49 /* DW_AT_type */
1266+ .uleb128 0x13 /* DW_FORM_ref4 */
1267+ .byte 0x0 /* Terminator */
1268+ .byte 0x0 /* Terminator */
1269+
1270+ .uleb128 8 /* Abbrev code */
1271+ .uleb128 0x21 /* DW_TAG_subrange_type with block */
1272+ .byte 0x0 /* no children */
1273+ .uleb128 0x49 /* DW_AT_type */
1274+ .uleb128 0x13 /* DW_FORM_ref4 */
1275+ .uleb128 0x22 /* DW_AT_lower_bound */
1276+ .uleb128 0xb /* DW_FORM_data1 */
1277+ .uleb128 0x2f /* DW_AT_upper_bound */
1278+ .uleb128 0xa /* DW_FORM_block1 */
1279+ .byte 0x0 /* Terminator */
1280+ .byte 0x0 /* Terminator */
1281+
1282+ .byte 0x0 /* Terminator */
1283+
1284+/* String table */
1285+ .section .debug_str
1286+.Lproducer:
1287+ .string "GNU C 3.3.3"
1288+.Lchar_str:
1289+ .string "char"
1290+.Luint_str:
1291+ .string "unsigned int"
1292Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
1293===================================================================
1294--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1295+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2014-06-16 23:30:30.111940487 +0200
1296@@ -0,0 +1,63 @@
1297+# Copyright 2010 Free Software Foundation, Inc.
1298+
1299+# This program is free software; you can redistribute it and/or modify
1300+# it under the terms of the GNU General Public License as published by
1301+# the Free Software Foundation; either version 3 of the License, or
1302+# (at your option) any later version.
1303+#
1304+# This program is distributed in the hope that it will be useful,
1305+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1306+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1307+# GNU General Public License for more details.
1308+#
1309+# You should have received a copy of the GNU General Public License
1310+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1311+
1312+# Test printing variable with dynamic bounds which reference a different
1313+# (artificial in the GCC case) variable containing loclist as its location.
1314+# This testcase uses value (not address) of the referenced variable:
1315+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
1316+
1317+# This test can only be run on targets which support DWARF-2 and use gas.
1318+# For now pick a sampling of likely targets.
1319+if {![istarget *-*-linux*]
1320+ && ![istarget *-*-gnu*]
1321+ && ![istarget *-*-elf*]
1322+ && ![istarget *-*-openbsd*]
1323+ && ![istarget arm-*-eabi*]
1324+ && ![istarget powerpc-*-eabi*]} {
1325+ return 0
1326+}
1327+
1328+set testfile dw2-bound-loclist
1329+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
1330+ return -1
1331+}
1332+
1333+# Verify it behaves at least as an unbound array without inferior.
1334+
1335+set test "p a_string"
1336+gdb_test_multiple $test $test {
1337+ -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" {
1338+ pass $test
1339+ }
1340+ -re "No registers\\.\r\n$gdb_prompt $" {
1341+ kfail "vlaregression" $test
1342+ }
1343+}
1344+
1345+gdb_test "ptype a_string" {type = char \[variable length\]}
1346+
1347+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
1348+if ![runto "*main"] {
1349+ return -1
1350+}
1351+
1352+gdb_test "p a_string" { = "seen"}
1353+gdb_test "ptype a_string" {type = char \[4\]}
1354+
1355+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
1356+gdb_test "ptype b_string" {type = char \[\]}
1357+
1358+# The register contains unpredictable value - the array size.
1359+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
1360Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
1361===================================================================
1362--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1363+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2014-06-16 23:30:30.111940487 +0200
1364@@ -0,0 +1,42 @@
1365+/* This testcase is part of GDB, the GNU debugger.
1366+
1367+ Copyright 2004 Free Software Foundation, Inc.
1368+
1369+ This program is free software; you can redistribute it and/or modify
1370+ it under the terms of the GNU General Public License as published by
1371+ the Free Software Foundation; either version 2 of the License, or
1372+ (at your option) any later version.
1373+
1374+ This program is distributed in the hope that it will be useful,
1375+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1376+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1377+ GNU General Public License for more details.
1378+
1379+ You should have received a copy of the GNU General Public License
1380+ along with this program; if not, write to the Free Software
1381+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1382+ USA. */
1383+
1384+
1385+/* The function `func1' traced into must have debug info on offset > 0;
1386+ (DW_UNSND (attr)). This is the reason of `func0' existence. */
1387+
1388+void
1389+func0(int a, int b)
1390+{
1391+}
1392+
1393+/* `func1' being traced into must have some arguments to dump. */
1394+
1395+void
1396+func1(int a, int b)
1397+{
1398+ func0 (a,b);
1399+}
1400+
1401+int
1402+main(void)
1403+{
1404+ func1 (1, 2);
1405+ return 0;
1406+}
1407Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
1408===================================================================
1409--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1410+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2014-06-16 23:30:30.111940487 +0200
1411@@ -0,0 +1,79 @@
1412+# Copyright 2006 Free Software Foundation, Inc.
1413+
1414+# This program is free software; you can redistribute it and/or modify
1415+# it under the terms of the GNU General Public License as published by
1416+# the Free Software Foundation; either version 2 of the License, or
1417+# (at your option) any later version.
1418+#
1419+# This program is distributed in the hope that it will be useful,
1420+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1421+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1422+# GNU General Public License for more details.
1423+#
1424+# You should have received a copy of the GNU General Public License
1425+# along with this program; if not, write to the Free Software
1426+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1427+
1428+# Minimal DWARF-2 unit test
1429+
1430+# This test can only be run on targets which support DWARF-2.
1431+# For now pick a sampling of likely targets.
1432+if {![istarget *-*-linux*]
1433+ && ![istarget *-*-gnu*]
1434+ && ![istarget *-*-elf*]
1435+ && ![istarget *-*-openbsd*]
1436+ && ![istarget arm-*-eabi*]
1437+ && ![istarget powerpc-*-eabi*]} {
1438+ return 0
1439+}
1440+
1441+set testfile "dw2-stripped"
1442+set srcfile ${testfile}.c
1443+set binfile ${objdir}/${subdir}/${testfile}.x
1444+
1445+remote_exec build "rm -f ${binfile}"
1446+
1447+# get the value of gcc_compiled
1448+if [get_compiler_info ${binfile}] {
1449+ return -1
1450+}
1451+
1452+# This test can only be run on gcc as we use additional_flags=FIXME
1453+if {$gcc_compiled == 0} {
1454+ return 0
1455+}
1456+
1457+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
1458+ return -1
1459+}
1460+
1461+remote_exec build "objcopy -R .debug_loc ${binfile}"
1462+set strip_output [remote_exec build "objdump -h ${binfile}"]
1463+
1464+set test "stripping test file preservation"
1465+if [ regexp ".debug_info " $strip_output] {
1466+ pass "$test (.debug_info preserved)"
1467+} else {
1468+ fail "$test (.debug_info got also stripped)"
1469+}
1470+
1471+set test "stripping test file functionality"
1472+if [ regexp ".debug_loc " $strip_output] {
1473+ fail "$test (.debug_loc still present)"
1474+} else {
1475+ pass "$test (.debug_loc stripped)"
1476+}
1477+
1478+gdb_exit
1479+gdb_start
1480+gdb_reinitialize_dir $srcdir/$subdir
1481+gdb_load ${binfile}
1482+
1483+# For C programs, "start" should stop in main().
1484+
1485+gdb_test "start" \
1486+ ".*main \\(\\) at .*" \
1487+ "start"
1488+gdb_test "step" \
1489+ "func.* \\(.*\\) at .*" \
1490+ "step"
1491Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
1492===================================================================
1493--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1494+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S 2014-06-16 23:30:30.112940488 +0200
1495@@ -0,0 +1,83 @@
1496+/* This testcase is part of GDB, the GNU debugger.
1497+
1498+ Copyright 2009 Free Software Foundation, Inc.
1499+
1500+ This program is free software; you can redistribute it and/or modify
1501+ it under the terms of the GNU General Public License as published by
1502+ the Free Software Foundation; either version 3 of the License, or
1503+ (at your option) any later version.
1504+
1505+ This program is distributed in the hope that it will be useful,
1506+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1507+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1508+ GNU General Public License for more details.
1509+
1510+ You should have received a copy of the GNU General Public License
1511+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
1512+
1513+/* Debug information */
1514+
1515+ .section .debug_info
1516+.Lcu1_begin:
1517+ /* CU header */
1518+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1519+.Lcu1_start:
1520+ .2byte 2 /* DWARF Version */
1521+ .4byte .Labbrev1_begin /* Offset into abbrev section */
1522+ .byte 4 /* Pointer size */
1523+
1524+ /* CU die */
1525+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1526+ .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */
1527+ .ascii "GNU C 4.3.2\0" /* DW_AT_producer */
1528+ .byte 1 /* DW_AT_language (C) */
1529+
1530+.Ltype_uchar:
1531+ .uleb128 2 /* Abbrev: DW_TAG_structure_type */
1532+ .ascii "some_struct\0" /* DW_AT_name */
1533+
1534+ .uleb128 3 /* Abbrev: DW_TAG_member */
1535+ .ascii "field\0" /* DW_AT_name */
1536+ .byte 0 /* DW_AT_data_member_location */
1537+
1538+ .byte 0 /* End of children of some_struct */
1539+
1540+ .byte 0 /* End of children of CU */
1541+
1542+.Lcu1_end:
1543+
1544+/* Abbrev table */
1545+ .section .debug_abbrev
1546+.Labbrev1_begin:
1547+ .uleb128 1 /* Abbrev code */
1548+ .uleb128 0x11 /* DW_TAG_compile_unit */
1549+ .byte 1 /* has_children */
1550+ .uleb128 0x3 /* DW_AT_name */
1551+ .uleb128 0x8 /* DW_FORM_string */
1552+ .uleb128 0x25 /* DW_AT_producer */
1553+ .uleb128 0x8 /* DW_FORM_string */
1554+ .uleb128 0x13 /* DW_AT_language */
1555+ .uleb128 0xb /* DW_FORM_data1 */
1556+ .byte 0x0 /* Terminator */
1557+ .byte 0x0 /* Terminator */
1558+
1559+ .uleb128 2 /* Abbrev code */
1560+ .uleb128 0x13 /* DW_TAG_structure_type */
1561+ .byte 1 /* has_children */
1562+ .uleb128 0x3 /* DW_AT_name */
1563+ .uleb128 0x8 /* DW_FORM_string */
1564+ .byte 0x0 /* Terminator */
1565+ .byte 0x0 /* Terminator */
1566+
1567+ .uleb128 3 /* Abbrev code */
1568+ .uleb128 0x0d /* DW_TAG_member */
1569+ .byte 0 /* has_children */
1570+ .uleb128 0x3 /* DW_AT_name */
1571+ .uleb128 0x8 /* DW_FORM_string */
1572+ .uleb128 0x38 /* DW_AT_data_member_location */
1573+ .uleb128 0x0b /* DW_FORM_data1 */
1574+ .byte 0x0 /* Terminator */
1575+ .byte 0x0 /* Terminator */
1576+
1577+ .byte 0x0 /* Terminator */
1578+ .byte 0x0 /* Terminator */
1579Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
1580===================================================================
1581--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1582+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp 2014-06-16 23:30:30.112940488 +0200
1583@@ -0,0 +1,37 @@
1584+# Copyright 2009 Free Software Foundation, Inc.
1585+
1586+# This program is free software; you can redistribute it and/or modify
1587+# it under the terms of the GNU General Public License as published by
1588+# the Free Software Foundation; either version 3 of the License, or
1589+# (at your option) any later version.
1590+#
1591+# This program is distributed in the hope that it will be useful,
1592+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1593+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1594+# GNU General Public License for more details.
1595+#
1596+# You should have received a copy of the GNU General Public License
1597+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1598+
1599+# This test can only be run on targets which support DWARF-2 and use gas.
1600+# For now pick a sampling of likely targets.
1601+if {![istarget *-*-linux*]
1602+ && ![istarget *-*-gnu*]
1603+ && ![istarget *-*-elf*]
1604+ && ![istarget *-*-openbsd*]
1605+ && ![istarget arm-*-eabi*]
1606+ && ![istarget powerpc-*-eabi*]} {
1607+ return 0
1608+}
1609+
1610+set testfile "dw2-struct-member-data-location"
1611+set srcfile ${testfile}.S
1612+set binfile ${testfile}.x
1613+
1614+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } {
1615+ return -1
1616+}
1617+
1618+clean_restart $binfile
1619+
1620+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
1621Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
1622===================================================================
1623--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1624+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S 2014-06-16 23:30:30.112940488 +0200
1625@@ -0,0 +1,121 @@
1626+/* This testcase is part of GDB, the GNU debugger.
1627+
1628+ Copyright 2012 Free Software Foundation, Inc.
1629+
1630+ This program is free software; you can redistribute it and/or modify
1631+ it under the terms of the GNU General Public License as published by
1632+ the Free Software Foundation; either version 3 of the License, or
1633+ (at your option) any later version.
1634+
1635+ This program is distributed in the hope that it will be useful,
1636+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1637+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1638+ GNU General Public License for more details.
1639+
1640+ You should have received a copy of the GNU General Public License
1641+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
1642+
1643+/* Debug information */
1644+
1645+ .section .data
1646+vardata:
1647+ .rept 129
1648+ .ascii "x"
1649+ .endr
1650+ .ascii "UNSEEN\0"
1651+
1652+ .section .debug_info
1653+.Lcu1_begin:
1654+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1655+.Lcu1_start:
1656+ .2byte 2 /* DWARF version number */
1657+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1658+ .byte 4 /* Pointer Size (in bytes) */
1659+
1660+ /* CU die */
1661+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1662+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
1663+ .byte 2 /* DW_AT_language (C) - */
1664+
1665+.Larray_type:
1666+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
1667+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1668+
1669+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
1670+ .byte 0 /* DW_AT_lower_bound */
1671+ .byte 128 /* DW_AT_upper_bound */
1672+
1673+ .byte 0 /* End of children of die */
1674+
1675+.Lchar_type:
1676+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
1677+ .ascii "char\0" /* DW_AT_name */
1678+ .byte 1 /* DW_AT_byte_size */
1679+ .byte 6 /* DW_AT_encoding */
1680+
1681+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1682+ .ascii "notype_string\0" /* DW_AT_name */
1683+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
1684+ .byte 2f - 1f /* DW_AT_location */
1685+1: .byte 3 /* DW_OP_addr */
1686+ .4byte vardata /* <addr> */
1687+2:
1688+
1689+ .byte 0 /* End of children of CU */
1690+.Lcu1_end:
1691+
1692+ .section .debug_abbrev
1693+.Ldebug_abbrev0:
1694+ .uleb128 1 /* Abbrev code */
1695+ .uleb128 0x11 /* DW_TAG_compile_unit */
1696+ .byte 0x1 /* has_children */
1697+ .uleb128 0x25 /* DW_AT_producer */
1698+ .uleb128 0x8 /* DW_FORM_string */
1699+ .uleb128 0x13 /* DW_AT_language */
1700+ .uleb128 0xb /* DW_FORM_data1 */
1701+ .byte 0x0 /* Terminator */
1702+ .byte 0x0 /* Terminator */
1703+
1704+ .uleb128 2 /* Abbrev code */
1705+ .uleb128 0x1 /* TAG: DW_TAG_array_type */
1706+ .byte 0x1 /* DW_children_yes */
1707+ .uleb128 0x49 /* DW_AT_type */
1708+ .uleb128 0x13 /* DW_FORM_ref4 */
1709+ .byte 0x0 /* Terminator */
1710+ .byte 0x0 /* Terminator */
1711+
1712+ .uleb128 4 /* Abbrev code */
1713+ .uleb128 0x24 /* DW_TAG_base_type */
1714+ .byte 0x0 /* no_children */
1715+ .uleb128 0x3 /* DW_AT_name */
1716+ .uleb128 0x8 /* DW_FORM_string */
1717+ .uleb128 0xb /* DW_AT_byte_size */
1718+ .uleb128 0xb /* DW_FORM_data1 */
1719+ .uleb128 0x3e /* DW_AT_encoding */
1720+ .uleb128 0xb /* DW_FORM_data1 */
1721+ .byte 0x0 /* Terminator */
1722+ .byte 0x0 /* Terminator */
1723+
1724+ .uleb128 6 /* Abbrev code */
1725+ .uleb128 0x34 /* DW_TAG_variable */
1726+ .byte 0x0 /* no_children */
1727+ .uleb128 0x3 /* DW_AT_name */
1728+ .uleb128 0x8 /* DW_FORM_string */
1729+ .uleb128 0x49 /* DW_AT_type */
1730+ .uleb128 0x13 /* DW_FORM_ref4 */
1731+ .uleb128 0x2 /* DW_AT_location */
1732+ .uleb128 0xa /* DW_FORM_block1 */
1733+ .byte 0x0 /* Terminator */
1734+ .byte 0x0 /* Terminator */
1735+
1736+ .uleb128 8 /* Abbrev code */
1737+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */
1738+ .byte 0x0 /* no children */
1739+ .uleb128 0x22 /* DW_AT_lower_bound */
1740+ .uleb128 0xb /* DW_FORM_data1 */
1741+ .uleb128 0x2f /* DW_AT_upper_bound */
1742+ .uleb128 0xb /* DW_FORM_data1 */
1743+ .byte 0x0 /* Terminator */
1744+ .byte 0x0 /* Terminator */
1745+
1746+ .byte 0x0 /* Terminator */
1747Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
1748===================================================================
1749--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1750+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp 2014-06-16 23:30:30.112940488 +0200
1751@@ -0,0 +1,39 @@
1752+# Copyright 2012 Free Software Foundation, Inc.
1753+
1754+# This program is free software; you can redistribute it and/or modify
1755+# it under the terms of the GNU General Public License as published by
1756+# the Free Software Foundation; either version 3 of the License, or
1757+# (at your option) any later version.
1758+#
1759+# This program is distributed in the hope that it will be useful,
1760+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1761+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1762+# GNU General Public License for more details.
1763+#
1764+# You should have received a copy of the GNU General Public License
1765+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1766+load_lib dwarf.exp
1767+
1768+# https://bugzilla.redhat.com/show_bug.cgi?id=806920
1769+# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
1770+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
1771+# specified DW_AT_type, present only in XLF produced code.
1772+
1773+# This test can only be run on targets which support DWARF-2 and use gas.
1774+if {![dwarf2_support]} {
1775+ return 0
1776+}
1777+
1778+set testfile dw2-subrange-no-type
1779+set srcfile ${testfile}.S
1780+set executable ${testfile}.x
1781+set binfile [standard_output_file ${executable}]
1782+
1783+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
1784+ return -1
1785+}
1786+
1787+clean_restart $executable
1788+
1789+gdb_test "ptype notype_string" {type = char \[129\]}
1790+gdb_test "p notype_string" " = 'x' <repeats 129 times>"
1791Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp
1792===================================================================
1793--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1794+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2014-06-16 23:30:30.112940488 +0200
1795@@ -0,0 +1,42 @@
1796+# Copyright 2009 Free Software Foundation, Inc.
1797+
1798+# This program is free software; you can redistribute it and/or modify
1799+# it under the terms of the GNU General Public License as published by
1800+# the Free Software Foundation; either version 2 of the License, or
1801+# (at your option) any later version.
1802+#
1803+# This program is distributed in the hope that it will be useful,
1804+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1805+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1806+# GNU General Public License for more details.
1807+#
1808+# You should have received a copy of the GNU General Public License
1809+# along with this program; if not, write to the Free Software
1810+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1811+
1812+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
1813+
1814+# This file is part of the gdb testsuite. Array element stride must not be
1815+# specified in the number of elements but in a number of bytes instead.
1816+# Original problem:
1817+# (gdb) p c40pt(1)
1818+# $1 = '0-hello', ' ' <repeats 33 times>
1819+# (gdb) p c40pt(2)
1820+# warning: Fortran array stride not divisible by the element size
1821+
1822+set testfile dwarf-stride
1823+set srcfile ${testfile}.f90
1824+
1825+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
1826+ return -1
1827+}
1828+
1829+if ![runto MAIN__] then {
1830+ perror "couldn't run to breakpoint MAIN__"
1831+ continue
1832+}
1833+
1834+gdb_breakpoint [gdb_get_line_number "break-here"]
1835+gdb_continue_to_breakpoint "break-here" ".*break-here.*"
1836+gdb_test "p c40pt(1)" " = '0-hello.*"
1837+gdb_test "p c40pt(2)" " = '1-hello.*"
1838Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90
1839===================================================================
1840--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1841+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90 2014-06-16 23:30:30.112940488 +0200
1842@@ -0,0 +1,40 @@
1843+! Copyright 2009 Free Software Foundation, Inc.
1844+!
1845+! This program is free software; you can redistribute it and/or modify
1846+! it under the terms of the GNU General Public License as published by
1847+! the Free Software Foundation; either version 2 of the License, or
1848+! (at your option) any later version.
1849+!
1850+! This program is distributed in the hope that it will be useful,
1851+! but WITHOUT ANY WARRANTY; without even the implied warranty of
1852+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1853+! GNU General Public License for more details.
1854+!
1855+! You should have received a copy of the GNU General Public License
1856+! along with this program; if not, write to the Free Software
1857+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1858+!
1859+! File written by Alan Matsuoka.
1860+
1861+program repro
1862+
1863+ type small_stride
1864+ character*40 long_string
1865+ integer small_pad
1866+ end type small_stride
1867+
1868+ type(small_stride), dimension (20), target :: unpleasant
1869+ character*40, pointer, dimension(:):: c40pt
1870+
1871+ integer i
1872+
1873+ do i = 0,19
1874+ unpleasant(i+1)%small_pad = i+1
1875+ unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
1876+ end do
1877+
1878+ c40pt => unpleasant%long_string
1879+
1880+ print *, c40pt ! break-here
1881+
1882+end program repro
1883Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp
1884===================================================================
1885--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1886+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp 2014-06-16 23:37:45.568362563 +0200
1887@@ -0,0 +1,151 @@
1888+# Copyright 2007 Free Software Foundation, Inc.
1889+
1890+# This program is free software; you can redistribute it and/or modify
1891+# it under the terms of the GNU General Public License as published by
1892+# the Free Software Foundation; either version 2 of the License, or
1893+# (at your option) any later version.
1894+#
1895+# This program is distributed in the hope that it will be useful,
1896+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1897+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1898+# GNU General Public License for more details.
1899+#
1900+# You should have received a copy of the GNU General Public License
1901+# along with this program; if not, write to the Free Software
1902+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1903+
1904+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
1905+
1906+# This file is part of the gdb testsuite. It contains tests for dynamically
1907+# allocated Fortran arrays.
1908+# It depends on the GCC dynamic Fortran arrays DWARF support:
1909+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
1910+
1911+set testfile "dynamic"
1912+set srcfile ${testfile}.f90
1913+set binfile ${objdir}/${subdir}/${testfile}
1914+
1915+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
1916+ untested "Couldn't compile ${srcfile}"
1917+ return -1
1918+}
1919+
1920+gdb_exit
1921+gdb_start
1922+gdb_reinitialize_dir $srcdir/$subdir
1923+gdb_load ${binfile}
1924+
1925+if ![runto MAIN__] then {
1926+ perror "couldn't run to breakpoint MAIN__"
1927+ continue
1928+}
1929+
1930+gdb_breakpoint [gdb_get_line_number "varx-init"]
1931+gdb_continue_to_breakpoint "varx-init"
1932+gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx unallocated"
1933+gdb_test "ptype varx" "type = <not allocated>" "ptype varx unallocated"
1934+gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) unallocated"
1935+gdb_test "p varx(1,5,17)=1" "no such vector element because not allocated" "p varx(1,5,17)=1 unallocated"
1936+gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) unallocated"
1937+
1938+gdb_breakpoint [gdb_get_line_number "varx-allocated"]
1939+gdb_continue_to_breakpoint "varx-allocated"
1940+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
1941+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
1942+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
1943+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
1944+
1945+gdb_breakpoint [gdb_get_line_number "varx-filled"]
1946+gdb_continue_to_breakpoint "varx-filled"
1947+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
1948+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
1949+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
1950+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
1951+gdb_test "p varv" "\\$\[0-9\]* = <not associated>" "p varv unassociated"
1952+gdb_test "ptype varv" "type = <not associated>" "ptype varv unassociated"
1953+
1954+set test "output varx"
1955+gdb_test_multiple $test $test {
1956+ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
1957+ pass $test
1958+ }
1959+}
1960+
1961+gdb_breakpoint [gdb_get_line_number "varv-associated"]
1962+gdb_continue_to_breakpoint "varv-associated"
1963+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
1964+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
1965+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
1966+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
1967+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
1968+# Intel Fortran Compiler 10.1.008 uses the pointer type.
1969+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
1970+
1971+gdb_breakpoint [gdb_get_line_number "varv-filled"]
1972+gdb_continue_to_breakpoint "varv-filled"
1973+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
1974+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
1975+
1976+gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
1977+gdb_continue_to_breakpoint "varv-deassociated"
1978+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
1979+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"
1980+gdb_test "ptype varv" "type = (<not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated"
1981+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
1982+gdb_test "p varv(1,5,17)" "no such vector element because not associated"
1983+gdb_test "ptype varv(1,5,17)" "no such vector element because not associated"
1984+
1985+gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
1986+gdb_continue_to_breakpoint "varx-deallocated"
1987+gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
1988+gdb_test "ptype varx" "type = <not allocated>" "ptype varx deallocated"
1989+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
1990+gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) deallocated"
1991+gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) deallocated"
1992+
1993+gdb_breakpoint [gdb_get_line_number "vary-passed"]
1994+gdb_continue_to_breakpoint "vary-passed"
1995+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
1996+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
1997+
1998+gdb_breakpoint [gdb_get_line_number "vary-filled"]
1999+gdb_continue_to_breakpoint "vary-filled"
2000+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
2001+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
2002+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
2003+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
2004+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
2005+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
2006+
2007+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
2008+gdb_continue_to_breakpoint "varw-almostfilled"
2009+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
2010+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
2011+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
2012+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
2013+# "up" works with GCC but other Fortran compilers may copy the values into the
2014+# outer function only on the exit of the inner function.
2015+# We need both variants as depending on the arch we optionally may still be
2016+# executing the caller line or not after `finish'.
2017+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
2018+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
2019+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
2020+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
2021+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
2022+
2023+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
2024+gdb_continue_to_breakpoint "varz-almostfilled"
2025+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
2026+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
2027+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
2028+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
2029+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
2030+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
2031+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
2032+gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
2033+# maps to foo::vary(1,1)
2034+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
2035+# maps to foo::vary(2,2)
2036+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
2037+# maps to foo::vary(1,3)
2038+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
2039Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90
2040===================================================================
2041--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2042+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90 2014-06-16 23:30:30.113940488 +0200
2043@@ -0,0 +1,98 @@
2044+! Copyright 2007 Free Software Foundation, Inc.
2045+!
2046+! This program is free software; you can redistribute it and/or modify
2047+! it under the terms of the GNU General Public License as published by
2048+! the Free Software Foundation; either version 2 of the License, or
2049+! (at your option) any later version.
2050+!
2051+! This program is distributed in the hope that it will be useful,
2052+! but WITHOUT ANY WARRANTY; without even the implied warranty of
2053+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2054+! GNU General Public License for more details.
2055+!
2056+! You should have received a copy of the GNU General Public License
2057+! along with this program; if not, write to the Free Software
2058+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2059+!
2060+! Ihis file is the Fortran source file for dynamic.exp.
2061+! Original file written by Jakub Jelinek <jakub@redhat.com>.
2062+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
2063+
2064+subroutine baz
2065+ real, target, allocatable :: varx (:, :, :)
2066+ real, pointer :: varv (:, :, :)
2067+ real, target :: varu (1, 2, 3)
2068+ logical :: l
2069+ allocate (varx (1:6, 5:15, 17:28)) ! varx-init
2070+ l = allocated (varx)
2071+ varx(:, :, :) = 6 ! varx-allocated
2072+ varx(1, 5, 17) = 7
2073+ varx(2, 6, 18) = 8
2074+ varx(6, 15, 28) = 9
2075+ varv => varx ! varx-filled
2076+ l = associated (varv)
2077+ varv(3, 7, 19) = 10 ! varv-associated
2078+ varv => null () ! varv-filled
2079+ l = associated (varv)
2080+ deallocate (varx) ! varv-deassociated
2081+ l = allocated (varx)
2082+ varu(:, :, :) = 10 ! varx-deallocated
2083+ allocate (varv (1:6, 5:15, 17:28))
2084+ l = associated (varv)
2085+ varv(:, :, :) = 6
2086+ varv(1, 5, 17) = 7
2087+ varv(2, 6, 18) = 8
2088+ varv(6, 15, 28) = 9
2089+ deallocate (varv)
2090+ l = associated (varv)
2091+ varv => varu
2092+ varv(1, 1, 1) = 6
2093+ varv(1, 2, 3) = 7
2094+ l = associated (varv)
2095+end subroutine baz
2096+subroutine foo (vary, varw)
2097+ real :: vary (:, :)
2098+ real :: varw (:, :, :)
2099+ vary(:, :) = 4 ! vary-passed
2100+ vary(1, 1) = 8
2101+ vary(2, 2) = 9
2102+ vary(1, 3) = 10
2103+ varw(:, :, :) = 5 ! vary-filled
2104+ varw(1, 1, 1) = 6
2105+ varw(2, 2, 2) = 7 ! varw-almostfilled
2106+end subroutine foo
2107+subroutine bar (varz, vart)
2108+ real :: varz (*)
2109+ real :: vart (2:11, 7:*)
2110+ varz(1:3) = 4
2111+ varz(2) = 5 ! varz-almostfilled
2112+ vart(2,7) = vart(2,7)
2113+end subroutine bar
2114+program test
2115+ interface
2116+ subroutine foo (vary, varw)
2117+ real :: vary (:, :)
2118+ real :: varw (:, :, :)
2119+ end subroutine
2120+ end interface
2121+ interface
2122+ subroutine bar (varz, vart)
2123+ real :: varz (*)
2124+ real :: vart (2:11, 7:*)
2125+ end subroutine
2126+ end interface
2127+ real :: x (10, 10), y (5), z(8, 8, 8)
2128+ x(:,:) = 1
2129+ y(:) = 2
2130+ z(:,:,:) = 3
2131+ call baz
2132+ call foo (x, z(2:6, 4:7, 6:8))
2133+ call bar (y, x)
2134+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
2135+ if (x (1, 3) .ne. 10) call abort
2136+ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
2137+ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
2138+ call foo (transpose (x), z)
2139+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
2140+ if (x (3, 1) .ne. 10) call abort
2141+end
2142Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp
2143===================================================================
2144--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2145+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp 2014-06-16 23:30:30.114940489 +0200
2146@@ -0,0 +1,59 @@
2147+# Copyright 2008 Free Software Foundation, Inc.
2148+
2149+# This program is free software; you can redistribute it and/or modify
2150+# it under the terms of the GNU General Public License as published by
2151+# the Free Software Foundation; either version 2 of the License, or
2152+# (at your option) any later version.
2153+#
2154+# This program is distributed in the hope that it will be useful,
2155+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2156+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2157+# GNU General Public License for more details.
2158+#
2159+# You should have received a copy of the GNU General Public License
2160+# along with this program; if not, write to the Free Software
2161+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2162+
2163+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
2164+
2165+# This file is part of the gdb testsuite. It contains tests for Fortran
2166+# strings with dynamic length.
2167+
2168+set testfile "string"
2169+set srcfile ${testfile}.f90
2170+set binfile ${objdir}/${subdir}/${testfile}
2171+
2172+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
2173+ untested "Couldn't compile ${srcfile}"
2174+ return -1
2175+}
2176+
2177+gdb_exit
2178+gdb_start
2179+gdb_reinitialize_dir $srcdir/$subdir
2180+gdb_load ${binfile}
2181+
2182+if ![runto MAIN__] then {
2183+ perror "couldn't run to breakpoint MAIN__"
2184+ continue
2185+}
2186+
2187+gdb_breakpoint [gdb_get_line_number "var-init"]
2188+gdb_continue_to_breakpoint "var-init"
2189+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
2190+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
2191+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
2192+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
2193+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
2194+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
2195+gdb_test "p c" "\\$\[0-9\]* = 'c'"
2196+gdb_test "p d" "\\$\[0-9\]* = 'd '"
2197+gdb_test "p e" "\\$\[0-9\]* = 'g '"
2198+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 '\\) \\)"
2199+gdb_test "p *e" "Attempt to take contents of a non-pointer value."
2200+gdb_test "p *f" "Attempt to take contents of a non-pointer value."
2201+
2202+gdb_breakpoint [gdb_get_line_number "var-finish"]
2203+gdb_continue_to_breakpoint "var-finish"
2204+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set"
2205+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"
2206Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90
2207===================================================================
2208--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2209+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90 2014-06-16 23:30:30.114940489 +0200
2210@@ -0,0 +1,37 @@
2211+! Copyright 2008 Free Software Foundation, Inc.
2212+!
2213+! This program is free software; you can redistribute it and/or modify
2214+! it under the terms of the GNU General Public License as published by
2215+! the Free Software Foundation; either version 2 of the License, or
2216+! (at your option) any later version.
2217+!
2218+! This program is distributed in the hope that it will be useful,
2219+! but WITHOUT ANY WARRANTY; without even the implied warranty of
2220+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2221+! GNU General Public License for more details.
2222+!
2223+! You should have received a copy of the GNU General Public License
2224+! along with this program; if not, write to the Free Software
2225+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2226+!
2227+! Ihis file is the Fortran source file for dynamic.exp.
2228+! Original file written by Jakub Jelinek <jakub@redhat.com>.
2229+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
2230+
2231+subroutine foo (e, f)
2232+ character (len=1) :: c
2233+ character (len=8) :: d
2234+ character (len=*) :: e
2235+ character (len=*) :: f (1:7, 8:10)
2236+ c = 'c'
2237+ d = 'd'
2238+ e = 'e' ! var-init
2239+ f = 'f'
2240+ f(1,9) = 'f2'
2241+ c = 'c' ! var-finish
2242+end subroutine foo
2243+ character (len=4) :: g, h (1:7, 8:10)
2244+ g = 'g'
2245+ h = 'h'
2246+ call foo (g, h)
2247+end
2248Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp
2249===================================================================
2250--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2251+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp 2014-06-16 23:30:30.114940489 +0200
2252@@ -0,0 +1,72 @@
2253+# Copyright 2011 Free Software Foundation, Inc.
2254+
2255+# This program is free software; you can redistribute it and/or modify
2256+# it under the terms of the GNU General Public License as published by
2257+# the Free Software Foundation; either version 3 of the License, or
2258+# (at your option) any later version.
2259+#
2260+# This program is distributed in the hope that it will be useful,
2261+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2262+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2263+# GNU General Public License for more details.
2264+#
2265+# You should have received a copy of the GNU General Public License
2266+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2267+
2268+if { [skip_fortran_tests] } { return -1 }
2269+
2270+set testfile "subrange"
2271+set srcfile ${testfile}.f90
2272+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
2273+ return -1
2274+}
2275+
2276+if ![runto MAIN__] {
2277+ perror "Couldn't run to MAIN__"
2278+ continue
2279+}
2280+
2281+# Depending on the compiler version being used, the name of the 4-byte integer
2282+# and real types can be printed differently. For instance, gfortran-4.1 uses
2283+# "int4" whereas gfortran-4.3 uses "int(kind=4)".
2284+set int4 "(int4|integer\\(kind=4\\))"
2285+
2286+gdb_breakpoint [gdb_get_line_number "break-static"]
2287+gdb_continue_to_breakpoint "break-static" ".*break-static.*"
2288+
2289+foreach var {a alloc ptr} {
2290+ global pf_prefix
2291+ set old_prefix $pf_prefix
2292+ lappend pf_prefix "$var:"
2293+
2294+ setup_kfail "*-*-*" "vlaregression/9999"
2295+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
2296+ setup_kfail "*-*-*" "vlaregression/9999"
2297+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
2298+ setup_kfail "*-*-*" "vlaregression/9999"
2299+ gdb_test "p $var (1, 2:)" { = \(21, 31\)}
2300+ setup_kfail "*-*-*" "vlaregression/9999"
2301+ gdb_test "p $var (2, :2)" { = \(12, 22\)}
2302+ setup_kfail "*-*-*" "vlaregression/9999"
2303+ gdb_test "p $var (3, 2:2)" { = \(23\)}
2304+ setup_kfail "*-*-*" "vlaregression/9999"
2305+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
2306+ setup_kfail "*-*-*" "vlaregression/9999"
2307+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
2308+ setup_kfail "*-*-*" "vlaregression/9999"
2309+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
2310+ setup_kfail "*-*-*" "vlaregression/9999"
2311+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
2312+ setup_kfail "*-*-*" "vlaregression/9999"
2313+ gdb_test "p $var (:)" "Wrong number of subscripts"
2314+ setup_kfail "*-*-*" "vlaregression/9999"
2315+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
2316+
2317+ set pf_prefix $old_prefix
2318+}
2319+
2320+gdb_test_no_output {set $a=a}
2321+delete_breakpoints
2322+gdb_unload
2323+setup_kfail "*-*-*" "vlaregression/9999"
2324+gdb_test {p $a (3, 2:2)} { = \(23\)}
2325Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90
2326===================================================================
2327--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2328+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90 2014-06-16 23:30:30.114940489 +0200
2329@@ -0,0 +1,28 @@
2330+! Copyright 2011 Free Software Foundation, Inc.
2331+!
2332+! This program is free software; you can redistribute it and/or modify
2333+! it under the terms of the GNU General Public License as published by
2334+! the Free Software Foundation; either version 3 of the License, or
2335+! (at your option) any later version.
2336+!
2337+! This program is distributed in the hope that it will be useful,
2338+! but WITHOUT ANY WARRANTY; without even the implied warranty of
2339+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2340+! GNU General Public License for more details.
2341+!
2342+! You should have received a copy of the GNU General Public License
2343+! along with this program. If not, see <http://www.gnu.org/licenses/>.
2344+
2345+program test
2346+ integer, target :: a (4, 3)
2347+ integer, allocatable :: alloc (:, :)
2348+ integer, pointer :: ptr (:, :)
2349+ do 1 i = 1, 4
2350+ do 1 j = 1, 3
2351+ a (i, j) = j * 10 + i
2352+1 continue
2353+ allocate (alloc (4, 3))
2354+ alloc = a
2355+ ptr => a
2356+ write (*,*) a ! break-static
2357+end
2358Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
2359===================================================================
2360--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2361+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c 2014-06-16 23:30:30.114940489 +0200
2362@@ -0,0 +1,26 @@
2363+/* Copyright 2011 Free Software Foundation, Inc.
2364+
2365+ This file is part of GDB.
2366+
2367+ This program is free software; you can redistribute it and/or modify
2368+ it under the terms of the GNU General Public License as published by
2369+ the Free Software Foundation; either version 3 of the License, or
2370+ (at your option) any later version.
2371+
2372+ This program is distributed in the hope that it will be useful,
2373+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2374+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2375+ GNU General Public License for more details.
2376+
2377+ You should have received a copy of the GNU General Public License
2378+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
2379+
2380+int
2381+main (int argc, char **argv)
2382+{
2383+ char vla[argc];
2384+
2385+ vla[0] = 0; /* break-here */
2386+
2387+ return 0;
2388+}
2389Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
2390===================================================================
2391--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2392+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp 2014-06-16 23:30:30.114940489 +0200
2393@@ -0,0 +1,57 @@
2394+# Copyright 2011 Free Software Foundation, Inc.
2395+#
2396+# This program is free software; you can redistribute it and/or modify
2397+# it under the terms of the GNU General Public License as published by
2398+# the Free Software Foundation; either version 3 of the License, or
2399+# (at your option) any later version.
2400+#
2401+# This program is distributed in the hope that it will be useful,
2402+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2403+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2404+# GNU General Public License for more details.
2405+#
2406+# You should have received a copy of the GNU General Public License
2407+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2408+
2409+load_lib mi-support.exp
2410+set MIFLAGS "-i=mi2"
2411+
2412+gdb_exit
2413+if [mi_gdb_start] {
2414+ continue
2415+}
2416+
2417+set testfile "mi2-var-stale-type"
2418+set srcfile ${testfile}.c
2419+set binfile [standard_output_file ${testfile}]
2420+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
2421+ return -1
2422+}
2423+
2424+mi_delete_breakpoints
2425+mi_gdb_reinitialize_dir $srcdir/$subdir
2426+mi_gdb_load ${binfile}
2427+
2428+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
2429+ {\^done} \
2430+ "maintenance set internal-error quit yes"
2431+
2432+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
2433+ {\^done} \
2434+ "maintenance set internal-error corefile yes"
2435+
2436+set line [gdb_get_line_number "break-here"]
2437+set func "main"
2438+
2439+mi_gdb_test "-break-insert -t $srcfile:$line" \
2440+ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \
2441+ "breakpoint at $func"
2442+
2443+if { [mi_run_cmd] < 0 } {
2444+ return -1
2445+}
2446+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
2447+
2448+mi_create_varobj "vla" "vla" "create local variable vla"
2449+
2450+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
2451Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c
2452===================================================================
2453--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2454+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c 2014-06-16 23:30:30.115940490 +0200
2455@@ -0,0 +1,22 @@
2456+/* This file is part of GDB, the GNU debugger.
2457+
2458+ Copyright 2009 Free Software Foundation, Inc.
2459+
2460+ This program is free software; you can redistribute it and/or modify
2461+ it under the terms of the GNU General Public License as published by
2462+ the Free Software Foundation; either version 3 of the License, or
2463+ (at your option) any later version.
2464+
2465+ This program is distributed in the hope that it will be useful,
2466+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2467+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2468+ GNU General Public License for more details.
2469+
2470+ You should have received a copy of the GNU General Public License
2471+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
2472+
2473+int
2474+func (int *arr)
2475+{
2476+ return arr[0];
2477+}
2478Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c
2479===================================================================
2480--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2481+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c 2014-06-16 23:30:30.115940490 +0200
2482@@ -0,0 +1,28 @@
2483+/* This file is part of GDB, the GNU debugger.
2484+
2485+ Copyright 2009 Free Software Foundation, Inc.
2486+
2487+ This program is free software; you can redistribute it and/or modify
2488+ it under the terms of the GNU General Public License as published by
2489+ the Free Software Foundation; either version 3 of the License, or
2490+ (at your option) any later version.
2491+
2492+ This program is distributed in the hope that it will be useful,
2493+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2494+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2495+ GNU General Public License for more details.
2496+
2497+ You should have received a copy of the GNU General Public License
2498+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
2499+
2500+extern int func (int *arr);
2501+
2502+int
2503+main (void)
2504+{
2505+ int arr[] = { 42 };
2506+
2507+ func (arr);
2508+
2509+ return 0;
2510+}
2511Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp
2512===================================================================
2513--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2514+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp 2014-06-16 23:30:30.115940490 +0200
2515@@ -0,0 +1,33 @@
2516+# Copyright 2009 Free Software Foundation, Inc.
2517+#
2518+# This program is free software; you can redistribute it and/or modify
2519+# it under the terms of the GNU General Public License as published by
2520+# the Free Software Foundation; either version 2 of the License, or
2521+# (at your option) any later version.
2522+#
2523+# This program is distributed in the hope that it will be useful,
2524+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2525+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2526+# GNU General Public License for more details.
2527+#
2528+# You should have received a copy of the GNU General Public License
2529+# along with this program; if not, write to the Free Software
2530+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2531+#
2532+# This file is part of the gdb testsuite.
2533+
2534+if { [prepare_for_testing array-from-register.exp "array-from-register" \
2535+ {array-from-register.c array-from-register-func.c} \
2536+ {debug optimize=-O2}] } {
2537+ return -1
2538+}
2539+
2540+if ![runto func] then {
2541+ return -1
2542+}
2543+
2544+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
2545+
2546+# Seen regression:
2547+# Address requested for identifier "arr" which is in register $rdi
2548+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
2549Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp
2550===================================================================
2551--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2552+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp 2014-06-16 23:30:30.115940490 +0200
2553@@ -0,0 +1,104 @@
2554+# Copyright 2008, 2009 Free Software Foundation, Inc.
2555+#
2556+# This program is free software; you can redistribute it and/or modify
2557+# it under the terms of the GNU General Public License as published by
2558+# the Free Software Foundation; either version 3 of the License, or
2559+# (at your option) any later version.
2560+#
2561+# This program is distributed in the hope that it will be useful,
2562+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2563+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2564+# GNU General Public License for more details.
2565+#
2566+# You should have received a copy of the GNU General Public License
2567+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2568+
2569+if $tracelevel then {
2570+ strace $tracelevel
2571+}
2572+
2573+load_lib "pascal.exp"
2574+
2575+set testfile "arrays"
2576+set srcfile ${testfile}.pas
2577+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
2578+
2579+# These tests only work with fpc, using the -gw3 compile-option
2580+pascal_init
2581+if { $pascal_compiler_is_fpc != 1 } {
2582+ return -1
2583+}
2584+
2585+# Detect if the fpc version is below 2.3.0
2586+set fpc_generates_dwarf_for_dynamic_arrays 1
2587+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} {
2588+ set fpc_generates_dwarf_for_dynamic_arrays 0
2589+}
2590+
2591+
2592+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
2593+ return -1
2594+}
2595+
2596+gdb_exit
2597+gdb_start
2598+gdb_reinitialize_dir $srcdir/$subdir
2599+gdb_load ${binfile}
2600+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
2601+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
2602+
2603+
2604+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
2605+ pass "setting breakpoint 1"
2606+}
2607+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
2608+ pass "setting breakpoint 2"
2609+}
2610+
2611+# Verify that "start" lands inside the right procedure.
2612+if { [gdb_start_cmd] < 0 } {
2613+ untested start
2614+ return -1
2615+}
2616+
2617+gdb_test "" ".* at .*${srcfile}.*" "start"
2618+
2619+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
2620+
2621+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
2622+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
2623+
2624+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
2625+
2626+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
2627+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"
2628+
2629+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2630+ setup_xfail "*-*-*"
2631+}
2632+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
2633+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2634+ setup_xfail "*-*-*"
2635+}
2636+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
2637+
2638+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2639+ setup_xfail "*-*-*"
2640+}
2641+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
2642+
2643+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2644+ setup_xfail "*-*-*"
2645+}
2646+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
2647+
2648+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2649+ setup_xfail "*-*-*"
2650+}
2651+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
2652+
2653+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2654+ setup_xfail "*-*-*"
2655+}
2656+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
2657+
2658Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas
2659===================================================================
2660--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2661+++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas 2014-06-16 23:30:30.115940490 +0200
2662@@ -0,0 +1,82 @@
2663+{
2664+ Copyright 2008, 2009 Free Software Foundation, Inc.
2665+
2666+ This program is free software; you can redistribute it and/or modify
2667+ it under the terms of the GNU General Public License as published by
2668+ the Free Software Foundation; either version 3 of the License, or
2669+ (at your option) any later version.
2670+
2671+ This program is distributed in the hope that it will be useful,
2672+ but WITHOUT ANY WARRANTY; without even the implied warranty of
2673+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2674+ GNU General Public License for more details.
2675+
2676+ You should have received a copy of the GNU General Public License
2677+ along with this program. If not, see <http://www.gnu.org/licenses/>.
2678+}
2679+
2680+program arrays;
2681+
2682+{$mode objfpc}{$h+}
2683+
2684+uses sysutils;
2685+
2686+type TStatArrInt= array[0..11] of integer;
2687+ TDynArrInt= array of integer;
2688+ TStatArrStr= array[0..12] of string;
2689+ TDynArrStr= array of string;
2690+ TDynArrChar = array of char;
2691+ TStatArrChar = array [0..11] of char;
2692+
2693+ TStat2dArrInt = array[0..11,0..4] of integer;
2694+
2695+var StatArrInt: TStatArrInt;
2696+ StatArrInt_: Array[0..11] of integer;
2697+ DynArrInt: TDynArrInt;
2698+ DynArrInt_: Array of integer;
2699+ StatArrStr: TStatArrStr;
2700+ DynArrStr: TDynArrStr;
2701+ StatArrChar: TStatArrChar;
2702+ DynArrChar: TDynArrChar;
2703+
2704+ Stat2dArrInt: TStat2dArrInt;
2705+
2706+ s: string;
2707+
2708+ i,j : integer;
2709+
2710+begin
2711+ for i := 0 to 11 do
2712+ begin
2713+ StatArrInt[i]:= i+50;
2714+ StatArrInt_[i]:= i+50;
2715+ StatArrChar[i]:= chr(ord('a')+i);
2716+ for j := 0 to 4 do
2717+ Stat2dArrInt[i,j]:=i+j;
2718+ end;
2719+ writeln(StatArrInt_[0]);
2720+ writeln(StatArrInt[0]); { set breakpoint 1 here }
2721+ writeln(StatArrChar[0]);
2722+ writeln(Stat2dArrInt[0,0]);
2723+
2724+ setlength(DynArrInt,13);
2725+ setlength(DynArrInt_,13);
2726+ setlength(DynArrStr,13);
2727+ setlength(DynArrChar,13);
2728+ for i := 0 to 12 do
2729+ begin
2730+ DynArrInt[i]:= i+50;
2731+ DynArrInt_[i]:= i+50;
2732+ DynArrChar[i]:= chr(ord('a')+i);
2733+ StatArrStr[i]:='str'+inttostr(i);
2734+ DynArrStr[i]:='dstr'+inttostr(i);
2735+ end;
2736+ writeln(DynArrInt_[1]);
2737+ writeln(DynArrInt[1]);
2738+ writeln(DynArrStr[1]);
2739+ writeln(StatArrStr[1]);
2740+ writeln(DynArrChar[1]);
2741+
2742+ s := 'test'#0'string';
2743+ writeln(s); { set breakpoint 2 here }
2744+end.
2745Index: gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp
2746===================================================================
2747--- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:29.278939700 +0200
2748+++ gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:30.117940492 +0200
2749@@ -159,6 +159,11 @@ proc gdb_unload {} {
2750 send_gdb "y\n"
2751 exp_continue
2752 }
2753+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
2754+ { send_gdb "y\n"
2755+ verbose "\t\tUnloading symbols for program being debugged"
2756+ exp_continue
2757+ }
2758 -re "Discard symbol table from .*y or n.*$" {
2759 send_gdb "y\n"
2760 exp_continue
2761Index: gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp
2762===================================================================
2763--- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/pascal.exp 2014-06-13 03:59:37.000000000 +0200
2764+++ gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp 2014-06-16 23:30:30.117940492 +0200
2765@@ -37,6 +37,9 @@ proc pascal_init {} {
2766 global pascal_compiler_is_fpc
2767 global gpc_compiler
2768 global fpc_compiler
2769+ global fpcversion_major
2770+ global fpcversion_minor
2771+ global fpcversion_release
2772 global env
2773
2774 if { $pascal_init_done == 1 } {
2775@@ -64,6 +67,20 @@ proc pascal_init {} {
2776 set pascal_compiler_is_fpc 1
2777 verbose -log "Free Pascal compiler found"
2778 }
2779+
2780+ # Detect the fpc-version
2781+ if { $pascal_compiler_is_fpc == 1 } {
2782+ set fpcversion_major 1
2783+ set fpcversion_minor 0
2784+ set fpcversion_release 0
2785+ set fpcversion [ remote_exec host $fpc_compiler "-iV" ]
2786+ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] {
2787+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major
2788+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor
2789+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release
2790+ }
2791+ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release"
2792+ }
2793 }
2794 set pascal_init_done 1
2795 }
This page took 0.321729 seconds and 4 git commands to generate.