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