1 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.ada/packed_array.exp
2 ===================================================================
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
6 # are. Observed with (FSF GNU Ada 4.5.3 20110124).
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)
17 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
18 ===================================================================
19 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
20 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S 2016-02-15 23:35:56.290999853 +0100
22 + .file "x86_64-vla-typedef.c"
23 + .section .debug_abbrev,"",@progbits
25 + .section .debug_info,"",@progbits
27 + .section .debug_line,"",@progbits
32 + .type foo, @function
35 + .file 1 "x86_64-vla-typedef.c"
43 + movl %edi, -36(%rbp)
46 + movq %rax, -48(%rbp)
48 + movl -36(%rbp), %edx
51 + movq %rax, -24(%rbp)
59 + movq %rsp, -56(%rbp)
60 + movq -56(%rbp), %rax
64 + movq %rax, -56(%rbp)
65 + movq -56(%rbp), %rax
66 + movq %rax, -16(%rbp)
75 + movq -16(%rbp), %rdx
77 + movb %cl, (%rdx,%rax)
82 + cmpl -36(%rbp), %eax
87 + movq -16(%rbp), %rax
89 + movq -48(%rbp), %rsp
95 + .section .debug_frame,"",@progbits
97 + .long .LECIE0-.LSCIE0
113 + .long .LEFDE0-.LASFDE0
125 + .long .LCFI1-.LCFI0
130 + .section .eh_frame,"a",@progbits
132 + .long .LECIE1-.LSCIE1
150 + .long .LEFDE1-.LASFDE1
152 + .long .LASFDE1-.Lframe1
163 + .long .LCFI1-.LCFI0
170 + .section .debug_loc,"",@progbits
173 + .quad .LFB2-.Ltext0
174 + .quad .LCFI0-.Ltext0
178 + .quad .LCFI0-.Ltext0
179 + .quad .LCFI1-.Ltext0
183 + .quad .LCFI1-.Ltext0
184 + .quad .LFE2-.Ltext0
190 + .section .debug_info
191 + .long .Ldebug_end - .Ldebug_start
194 + .long .Ldebug_abbrev0
203 + .long .Ldebug_line0
227 + .long .Ltag_array_type - .debug_info
228 + .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */
233 + .long .Ltag_typedef - .debug_info
235 + /* Debugging only: Skip the typedef indirection. */
236 + .long .Ltag_array_type - .debug_info
238 + /* DW_AT_location: DW_FORM_block1: start */
243 + .byte 0x6 /* DW_OP_deref */
245 + .byte 0x96 /* DW_OP_nop */
247 + /* DW_AT_location: DW_FORM_block1: end */
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 */
268 + .byte 0x97 /* DW_OP_push_object_address */
269 + .byte 0x6 /* DW_OP_deref */
270 +2: /* DW_AT_data_location: DW_FORM_block1: end */
272 + .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */
287 + .section .debug_abbrev
399 + .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */
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 */
413 + .uleb128 0x49 /* DW_AT_type */
414 + .uleb128 0x13 /* DW_FORM_ref4 */
440 + .section .debug_pubnames,"",@progbits
443 + .long .Ldebug_info0
448 + .section .debug_aranges,"",@progbits
451 + .long .Ldebug_info0
457 + .quad .Letext0-.Ltext0
460 + .section .debug_str,"MS",@progbits,1
466 + .string "x86_64-vla-typedef.c"
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
477 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
478 ===================================================================
479 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
480 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c 2016-02-15 23:35:56.290999853 +0100
482 +/* This testcase is part of GDB, the GNU debugger.
484 + Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>. */
504 + typedef char array_t[size];
508 + for (i = 0; i < size; i++)
511 + array[0] = 0; /* break-here */
516 +void foo (int size);
527 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
528 ===================================================================
529 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
530 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp 2016-02-15 23:35:56.290999853 +0100
532 +# Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>.
547 +# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
549 +if ![istarget "x86_64-*-*"] then {
550 + verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
554 +set testfile x86_64-vla-typedef
555 +set srcasmfile ${testfile}-foo.S
556 +set srcfile ${testfile}.c
557 +set binfile [standard_output_file ${testfile}]
558 +set binobjfile [standard_output_file ${testfile}-foo.o]
559 +if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
560 + untested "Couldn't compile test program"
563 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
564 + untested "Couldn't compile test program"
570 +gdb_reinitialize_dir $srcdir/$subdir
574 + untested x86_64-vla-typedef
578 +gdb_breakpoint "break_here"
580 +gdb_continue_to_breakpoint "break_here"
582 +gdb_test "whatis array" "type = array_t" "first: whatis array"
584 +gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
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'"
591 +gdb_continue_to_breakpoint "break_here"
593 +gdb_test "whatis array" "type = array_t" "second: whatis array"
595 +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
596 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/arrayidx.c
597 ===================================================================
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
602 int array[] = {1, 2, 3, 4};
614 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/arrayidx.exp
615 ===================================================================
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
619 "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
620 "Print array with array-indexes on"
623 +set test "p unbound.a == &unbound.a\[0\]"
624 +gdb_test_multiple $test $test {
625 + -re " = 1\r\n$gdb_prompt $" {
628 + -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
629 + unsupported "$test (no GCC)"
632 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/internal-var-field-address.c
633 ===================================================================
634 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
635 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/internal-var-field-address.c 2016-02-15 23:35:56.291999860 +0100
637 +/* This testcase is part of GDB, the GNU debugger.
639 + Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>. */
656 +} staticstruct = { 1 };
657 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/internal-var-field-address.exp
658 ===================================================================
659 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
660 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/internal-var-field-address.exp 2016-02-15 23:35:56.291999860 +0100
662 +# Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>.
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"
684 +clean_restart $binfile
686 +gdb_test {set $varstruct = staticstruct}
687 +gdb_test {p $varstruct.field} " = 1"
688 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-frame.c
689 ===================================================================
690 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
691 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-frame.c 2016-02-15 23:35:56.291999860 +0100
693 +/* This testcase is part of GDB, the GNU debugger.
695 + Copyright 2011 Free Software Foundation, Inc.
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.
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.
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/>. */
713 +main (int argc, char **argv)
716 + void (*f) (char *) = 0;
718 + memset (s, 0, sizeof (s));
724 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-frame.exp
725 ===================================================================
726 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
727 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-frame.exp 2016-02-15 23:35:56.291999860 +0100
729 +# Copyright 2011 Free Software Foundation, Inc.
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.
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.
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/>.
744 +set testfile vla-frame
745 +set executable ${testfile}
747 +if { [prepare_for_testing ${testfile}.exp ${executable}] } {
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 $" {
760 + -re "\r\n$gdb_prompt $" {
761 + untested ${testfile}.exp
766 +gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
767 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-overflow.c
768 ===================================================================
769 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
770 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-overflow.c 2016-02-15 23:35:56.291999860 +0100
772 +/* This testcase is part of GDB, the GNU debugger.
774 + Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>. */
792 +main (int argc, char **argv)
796 + array[0] = array[0];
802 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-overflow.exp
803 ===================================================================
804 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
805 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla-overflow.exp 2016-02-15 23:35:56.292999867 +0100
807 +# Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>.
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
832 +# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
834 +# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
836 +set testfile vla-overflow
837 +set shfile [standard_output_file ${testfile}-gdb.sh]
838 +set srcfile ${testfile}.c
839 +set binfile [standard_output_file ${testfile}]
840 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
841 + untested "Couldn't compile test program"
845 +set f [open "|getconf PAGESIZE" "r"]
851 +gdb_reinitialize_dir $srcdir/$subdir
854 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
856 +if { [runto_main] < 0 } {
857 + untested vla-overflow
861 +# Get the GDB memory size when we stay at main.
863 +proc memory_v_pages_get {} {
864 + global pid_of_gdb pagesize
865 + set fd [open "/proc/$pid_of_gdb/statm"]
868 + # number of pages of virtual memory
869 + scan $line "%d" drs
873 +set pages_found [memory_v_pages_get]
875 +# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
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"
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 \"\$@\""
888 +remote_exec host "chmod +x $shfile"
896 +gdb_reinitialize_dir $srcdir/$subdir
899 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
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.
906 +verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
908 +gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
910 +verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
912 +# `abort' can get expressed as `*__GI_abort'.
913 +gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
915 +verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
916 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla.c
917 ===================================================================
918 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
919 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla.c 2016-02-15 23:35:56.292999867 +0100
921 +/* This testcase is part of GDB, the GNU debugger.
923 + Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>. */
946 +bar (char *a, char *b, char *c, int size)
948 + memset (a, '1', size);
949 + memset (b, '2', size);
950 + memset (c, '3', 48);
959 + temp1[size - 1] = '\0';
963 + bar (temp1, temp2, temp3, size);
965 + marker (); /* break-here */
976 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla.exp
977 ===================================================================
978 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
979 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/vla.exp 2016-02-15 23:35:56.292999867 +0100
981 +# Copyright 2008 Free Software Foundation, Inc.
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.
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.
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/>.
997 +set srcfile ${testfile}.c
998 +set binfile [standard_output_file ${testfile}]
999 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
1000 + untested "Couldn't compile test program"
1006 +gdb_reinitialize_dir $srcdir/$subdir
1007 +gdb_load ${binfile}
1014 +gdb_breakpoint [gdb_get_line_number "break-here"]
1016 +gdb_continue_to_breakpoint "break-here"
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"
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"
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"
1030 +gdb_continue_to_breakpoint "break-here"
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"
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"
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"
1043 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
1044 ===================================================================
1045 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1046 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S 2016-02-15 23:35:56.292999867 +0100
1048 +/* This testcase is part of GDB, the GNU debugger.
1050 + Copyright 2010 Free Software Foundation, Inc.
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.
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.
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/>. */
1065 +/* Debug information */
1067 +/* We will `break *main' at the very first instruction. */
1068 +#define main_length 1
1072 + /* See DW_OP_lit3 + 1 (0-based). */
1073 + .string "seennotseen"
1075 + .section .debug_info
1077 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1079 + .2byte 2 /* DWARF version number */
1080 + .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1081 + .byte 4 /* Pointer Size (in bytes) */
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 */
1092 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1093 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
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 */
1101 + /* DW_AT_upper_bound is referencing an optimized-out variable. */
1103 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1104 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
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 */
1112 + /* DW_AT_upper_bound is referencing register. */
1114 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1115 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
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 */
1123 + .byte 0 /* End of children of die */
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 */
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 */
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 */
1143 + /* optimized-out variable for b_string. */
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 */
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> */
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> */
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> */
1175 + .byte 0 /* End of children of CU */
1178 + .section .debug_loc
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
1187 + .quad 0x0 # Location list terminator begin (*.LLST2)
1188 + .quad 0x0 # Location list terminator end (*.LLST2)
1190 + .section .debug_abbrev
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
1284 + .byte 0x0 /* Terminator */
1287 + .section .debug_str
1289 + .string "GNU C 3.3.3"
1293 + .string "unsigned int"
1294 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
1295 ===================================================================
1296 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1297 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2016-02-15 23:35:56.292999867 +0100
1299 +# Copyright 2010 Free Software Foundation, Inc.
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.
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.
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/>.
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
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*]} {
1330 +set testfile dw2-bound-loclist
1331 +if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
1335 +# Verify it behaves at least as an unbound array without inferior.
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 $" {
1345 +# -re "No registers\\.\r\n$gdb_prompt $" {
1346 +# kfail "vlaregression" $test
1350 +#gdb_test "ptype a_string" {type = char \[variable length\]}
1352 +# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
1353 +if ![runto "*main"] {
1357 +gdb_test "p a_string" { = "seen"}
1358 +gdb_test "ptype a_string" {type = char \[4\]}
1360 +gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
1361 +gdb_test "ptype b_string" {type = char \[\]}
1363 +# The register contains unpredictable value - the array size.
1364 +gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
1365 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
1366 ===================================================================
1367 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1368 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2016-02-15 23:35:56.293999874 +0100
1370 +/* This testcase is part of GDB, the GNU debugger.
1372 + Copyright 2004 Free Software Foundation, Inc.
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.
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.
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,
1390 +/* The function `func1' traced into must have debug info on offset > 0;
1391 + (DW_UNSND (attr)). This is the reason of `func0' existence. */
1394 +func0(int a, int b)
1398 +/* `func1' being traced into must have some arguments to dump. */
1401 +func1(int a, int b)
1412 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
1413 ===================================================================
1414 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1415 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2016-02-15 23:35:56.293999874 +0100
1417 +# Copyright 2006 Free Software Foundation, Inc.
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.
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.
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.
1433 +# Minimal DWARF-2 unit test
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*]} {
1446 +set testfile "dw2-stripped"
1447 +set srcfile ${testfile}.c
1448 +set binfile ${objdir}/${subdir}/${testfile}.x
1450 +remote_exec build "rm -f ${binfile}"
1452 +# get the value of gcc_compiled
1453 +if [get_compiler_info ${binfile}] {
1457 +# This test can only be run on gcc as we use additional_flags=FIXME
1458 +if {$gcc_compiled == 0} {
1462 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
1466 +remote_exec build "objcopy -R .debug_loc ${binfile}"
1467 +set strip_output [remote_exec build "objdump -h ${binfile}"]
1469 +set test "stripping test file preservation"
1470 +if [ regexp ".debug_info " $strip_output] {
1471 + pass "$test (.debug_info preserved)"
1473 + fail "$test (.debug_info got also stripped)"
1476 +set test "stripping test file functionality"
1477 +if [ regexp ".debug_loc " $strip_output] {
1478 + fail "$test (.debug_loc still present)"
1480 + pass "$test (.debug_loc stripped)"
1485 +gdb_reinitialize_dir $srcdir/$subdir
1486 +gdb_load ${binfile}
1488 +# For C programs, "start" should stop in main().
1491 + ".*main \\(\\) at .*" \
1494 + "func.* \\(.*\\) at .*" \
1496 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
1497 ===================================================================
1498 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1499 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S 2016-02-15 23:35:56.293999874 +0100
1501 +/* This testcase is part of GDB, the GNU debugger.
1503 + Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>. */
1518 +/* Debug information */
1520 + .section .debug_info
1523 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1525 + .2byte 2 /* DWARF Version */
1526 + .4byte .Labbrev1_begin /* Offset into abbrev section */
1527 + .byte 4 /* Pointer size */
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) */
1536 + .uleb128 2 /* Abbrev: DW_TAG_structure_type */
1537 + .ascii "some_struct\0" /* DW_AT_name */
1539 + .uleb128 3 /* Abbrev: DW_TAG_member */
1540 + .ascii "field\0" /* DW_AT_name */
1541 + .byte 0 /* DW_AT_data_member_location */
1543 + .byte 0 /* End of children of some_struct */
1545 + .byte 0 /* End of children of CU */
1550 + .section .debug_abbrev
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 */
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 */
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 */
1582 + .byte 0x0 /* Terminator */
1583 + .byte 0x0 /* Terminator */
1584 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
1585 ===================================================================
1586 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1587 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp 2016-02-15 23:35:56.293999874 +0100
1589 +# Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>.
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*]} {
1615 +set testfile "dw2-struct-member-data-location"
1616 +set srcfile ${testfile}.S
1617 +set binfile ${testfile}.x
1619 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } {
1623 +clean_restart $binfile
1625 +gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
1626 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
1627 ===================================================================
1628 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1629 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S 2016-02-15 23:35:56.293999874 +0100
1631 +/* This testcase is part of GDB, the GNU debugger.
1633 + Copyright 2012 Free Software Foundation, Inc.
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.
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.
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/>. */
1648 +/* Debug information */
1657 + .section .debug_info
1659 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1661 + .2byte 2 /* DWARF version number */
1662 + .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1663 + .byte 4 /* Pointer Size (in bytes) */
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) - */
1671 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1672 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
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 */
1678 + .byte 0 /* End of children of die */
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 */
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> */
1694 + .byte 0 /* End of children of CU */
1697 + .section .debug_abbrev
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 */
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 */
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 */
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 */
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 */
1751 + .byte 0x0 /* Terminator */
1752 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
1753 ===================================================================
1754 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1755 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp 2016-02-15 23:35:56.293999874 +0100
1757 +# Copyright 2012 Free Software Foundation, Inc.
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.
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.
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/>.
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.
1778 +# This test can only be run on targets which support DWARF-2 and use gas.
1779 +if {![dwarf2_support]} {
1783 +set testfile dw2-subrange-no-type
1784 +set srcfile ${testfile}.S
1785 +set executable ${testfile}.x
1786 +set binfile [standard_output_file ${executable}]
1788 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
1792 +clean_restart $executable
1794 +gdb_test "ptype notype_string" {type = char \[129\]}
1795 +gdb_test "p notype_string" " = 'x' <repeats 129 times>"
1796 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dwarf-stride.exp
1797 ===================================================================
1798 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1799 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2016-02-15 23:35:56.294999881 +0100
1801 +# Copyright 2009 Free Software Foundation, Inc.
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.
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.
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.
1817 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
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:
1823 +# $1 = '0-hello', ' ' <repeats 33 times>
1825 +# warning: Fortran array stride not divisible by the element size
1827 +set testfile dwarf-stride
1828 +set srcfile ${testfile}.f90
1830 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
1834 +if ![runto MAIN__] then {
1835 + perror "couldn't run to breakpoint MAIN__"
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.*"
1843 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dwarf-stride.f90
1844 ===================================================================
1845 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1846 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dwarf-stride.f90 2016-02-15 23:35:56.294999881 +0100
1848 +! Copyright 2009 Free Software Foundation, Inc.
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.
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.
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.
1864 +! File written by Alan Matsuoka.
1869 + character*40 long_string
1871 + end type small_stride
1873 + type(small_stride), dimension (20), target :: unpleasant
1874 + character*40, pointer, dimension(:):: c40pt
1879 + unpleasant(i+1)%small_pad = i+1
1880 + unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
1883 + c40pt => unpleasant%long_string
1885 + print *, c40pt ! break-here
1888 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dynamic.exp
1889 ===================================================================
1890 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1891 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dynamic.exp 2016-02-15 23:36:39.358305635 +0100
1893 +# Copyright 2007 Free Software Foundation, Inc.
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.
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.
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.
1909 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
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
1916 +set testfile "dynamic"
1917 +set srcfile ${testfile}.f90
1918 +set binfile [standard_output_file ${testfile}]
1920 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
1921 + untested "Couldn't compile ${srcfile}"
1927 +gdb_reinitialize_dir $srcdir/$subdir
1928 +gdb_load ${binfile}
1930 +if ![runto MAIN__] then {
1931 + perror "couldn't run to breakpoint MAIN__"
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"
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"
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"
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"
1959 +set test "output varx"
1960 +gdb_test_multiple $test $test {
1961 + -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
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"
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"
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"
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\)}
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"
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"
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, .\]*\\)"
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, .\]*\\)"
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"
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"
2044 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dynamic.f90
2045 ===================================================================
2046 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2047 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/dynamic.f90 2016-02-15 23:35:56.294999881 +0100
2049 +! Copyright 2007 Free Software Foundation, Inc.
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.
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.
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.
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>.
2070 + real, target, allocatable :: varx (:, :, :)
2071 + real, pointer :: varv (:, :, :)
2072 + real, target :: varu (1, 2, 3)
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)
2091 + varv(1, 5, 17) = 7
2092 + varv(2, 6, 18) = 8
2093 + varv(6, 15, 28) = 9
2095 + l = associated (varv)
2099 + l = associated (varv)
2101 +subroutine foo (vary, varw)
2102 + real :: vary (:, :)
2103 + real :: varw (:, :, :)
2104 + vary(:, :) = 4 ! vary-passed
2108 + varw(:, :, :) = 5 ! vary-filled
2110 + varw(2, 2, 2) = 7 ! varw-almostfilled
2112 +subroutine bar (varz, vart)
2114 + real :: vart (2:11, 7:*)
2116 + varz(2) = 5 ! varz-almostfilled
2117 + vart(2,7) = vart(2,7)
2121 + subroutine foo (vary, varw)
2122 + real :: vary (:, :)
2123 + real :: varw (:, :, :)
2127 + subroutine bar (varz, vart)
2129 + real :: vart (2:11, 7:*)
2132 + real :: x (10, 10), y (5), z(8, 8, 8)
2137 + call foo (x, z(2:6, 4:7, 6:8))
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
2147 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/string.exp
2148 ===================================================================
2149 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2150 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/string.exp 2016-02-15 23:36:39.359305642 +0100
2152 +# Copyright 2008 Free Software Foundation, Inc.
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.
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.
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.
2168 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
2170 +# This file is part of the gdb testsuite. It contains tests for Fortran
2171 +# strings with dynamic length.
2173 +set testfile "string"
2174 +set srcfile ${testfile}.f90
2175 +set binfile [standard_output_file ${testfile}]
2177 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
2178 + untested "Couldn't compile ${srcfile}"
2184 +gdb_reinitialize_dir $srcdir/$subdir
2185 +gdb_load ${binfile}
2187 +if ![runto MAIN__] then {
2188 + perror "couldn't run to breakpoint MAIN__"
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."
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"
2211 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/string.f90
2212 ===================================================================
2213 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2214 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/string.f90 2016-02-15 23:35:56.295999888 +0100
2216 +! Copyright 2008 Free Software Foundation, Inc.
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.
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.
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.
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>.
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)
2243 + e = 'e' ! var-init
2246 + c = 'c' ! var-finish
2248 + character (len=4) :: g, h (1:7, 8:10)
2253 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/subrange.exp
2254 ===================================================================
2255 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2256 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/subrange.exp 2016-02-15 23:35:56.295999888 +0100
2258 +# Copyright 2011 Free Software Foundation, Inc.
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.
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.
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/>.
2273 +if { [skip_fortran_tests] } { return -1 }
2275 +set testfile "subrange"
2276 +set srcfile ${testfile}.f90
2277 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
2281 +if ![runto MAIN__] {
2282 + perror "Couldn't run to MAIN__"
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\\))"
2291 +gdb_breakpoint [gdb_get_line_number "break-static"]
2292 +gdb_continue_to_breakpoint "break-static" ".*break-static.*"
2294 +foreach var {a alloc ptr} {
2296 + set old_prefix $pf_prefix
2297 + lappend pf_prefix "$var:"
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"
2322 + set pf_prefix $old_prefix
2325 +gdb_test_no_output {set $a=a}
2328 +setup_kfail "*-*-*" "vlaregression/9999"
2329 +gdb_test {p $a (3, 2:2)} { = \(23\)}
2330 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/subrange.f90
2331 ===================================================================
2332 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2333 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.fortran/subrange.f90 2016-02-15 23:35:56.295999888 +0100
2335 +! Copyright 2011 Free Software Foundation, Inc.
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.
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.
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/>.
2351 + integer, target :: a (4, 3)
2352 + integer, allocatable :: alloc (:, :)
2353 + integer, pointer :: ptr (:, :)
2356 + a (i, j) = j * 10 + i
2358 + allocate (alloc (4, 3))
2361 + write (*,*) a ! break-static
2363 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
2364 ===================================================================
2365 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2366 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.mi/mi2-var-stale-type.c 2016-02-15 23:35:56.295999888 +0100
2368 +/* Copyright 2011 Free Software Foundation, Inc.
2370 + This file is part of GDB.
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.
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.
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/>. */
2386 +main (int argc, char **argv)
2390 + vla[0] = 0; /* break-here */
2394 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
2395 ===================================================================
2396 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2397 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp 2016-02-15 23:35:56.295999888 +0100
2399 +# Copyright 2011 Free Software Foundation, Inc.
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.
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.
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/>.
2414 +load_lib mi-support.exp
2415 +set MIFLAGS "-i=mi2"
2418 +if [mi_gdb_start] {
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} {
2429 +mi_delete_breakpoints
2430 +mi_gdb_reinitialize_dir $srcdir/$subdir
2431 +mi_gdb_load ${binfile}
2433 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
2435 + "maintenance set internal-error quit yes"
2437 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
2439 + "maintenance set internal-error corefile yes"
2441 +set line [gdb_get_line_number "break-here"]
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"
2448 +if { [mi_run_cmd] < 0 } {
2451 +mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
2453 +mi_create_varobj "vla" "vla" "create local variable vla"
2455 +mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
2456 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register-func.c
2457 ===================================================================
2458 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2459 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register-func.c 2016-02-15 23:35:56.295999888 +0100
2461 +/* This file is part of GDB, the GNU debugger.
2463 + Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>. */
2483 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register.c
2484 ===================================================================
2485 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2486 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register.c 2016-02-15 23:35:56.296999895 +0100
2488 +/* This file is part of GDB, the GNU debugger.
2490 + Copyright 2009 Free Software Foundation, Inc.
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.
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.
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/>. */
2505 +extern int func (int *arr);
2510 + int arr[] = { 42 };
2516 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register.exp
2517 ===================================================================
2518 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2519 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.opt/array-from-register.exp 2016-02-15 23:35:56.296999895 +0100
2521 +# Copyright 2009 Free Software Foundation, Inc.
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.
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.
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.
2537 +# This file is part of the gdb testsuite.
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}] } {
2545 +if ![runto func] then {
2549 +gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
2552 +# Address requested for identifier "arr" which is in register $rdi
2553 +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
2554 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.pascal/arrays.exp
2555 ===================================================================
2556 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2557 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.pascal/arrays.exp 2016-02-15 23:36:39.359305642 +0100
2559 +# Copyright 2008, 2009 Free Software Foundation, Inc.
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.
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.
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/>.
2574 +if $tracelevel then {
2575 + strace $tracelevel
2578 +load_lib "pascal.exp"
2580 +set testfile "arrays"
2581 +set srcfile ${testfile}.pas
2582 +set binfile [standard_output_file ${testfile}$EXEEXT]
2584 +# These tests only work with fpc, using the -gw3 compile-option
2586 +if { $pascal_compiler_is_fpc != 1 } {
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
2597 +if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
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"]
2609 +if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
2610 + pass "setting breakpoint 1"
2612 +if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
2613 + pass "setting breakpoint 2"
2616 +# Verify that "start" lands inside the right procedure.
2617 +if { [gdb_start_cmd] < 0 } {
2622 +gdb_test "" ".* at .*${srcfile}.*" "start"
2624 +gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
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"
2629 +gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
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"
2634 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2635 + setup_xfail "*-*-*"
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 "*-*-*"
2641 +gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
2643 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2644 + setup_xfail "*-*-*"
2646 +gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
2648 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2649 + setup_xfail "*-*-*"
2651 +gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
2653 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2654 + setup_xfail "*-*-*"
2656 +gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
2658 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2659 + setup_xfail "*-*-*"
2661 +gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
2663 Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.pascal/arrays.pas
2664 ===================================================================
2665 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2666 +++ gdb-7.10.90.20160211/gdb/testsuite/gdb.pascal/arrays.pas 2016-02-15 23:35:56.296999895 +0100
2669 + Copyright 2008, 2009 Free Software Foundation, Inc.
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.
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.
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/>.
2687 +{$mode objfpc}{$h+}
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;
2698 + TStat2dArrInt = array[0..11,0..4] of integer;
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;
2709 + Stat2dArrInt: TStat2dArrInt;
2716 + for i := 0 to 11 do
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;
2724 + writeln(StatArrInt_[0]);
2725 + writeln(StatArrInt[0]); { set breakpoint 1 here }
2726 + writeln(StatArrChar[0]);
2727 + writeln(Stat2dArrInt[0,0]);
2729 + setlength(DynArrInt,13);
2730 + setlength(DynArrInt_,13);
2731 + setlength(DynArrStr,13);
2732 + setlength(DynArrChar,13);
2733 + for i := 0 to 12 do
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);
2741 + writeln(DynArrInt_[1]);
2742 + writeln(DynArrInt[1]);
2743 + writeln(DynArrStr[1]);
2744 + writeln(StatArrStr[1]);
2745 + writeln(DynArrChar[1]);
2747 + s := 'test'#0'string';
2748 + writeln(s); { set breakpoint 2 here }
2750 Index: gdb-7.10.90.20160211/gdb/testsuite/lib/gdb.exp
2751 ===================================================================
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 @@
2758 + -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
2760 + verbose "\t\tUnloading symbols for program being debugged"
2763 -re "Discard symbol table from .*y or n.*$" {
2766 Index: gdb-7.10.90.20160211/gdb/testsuite/lib/pascal.exp
2767 ===================================================================
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
2771 global pascal_compiler_is_fpc
2774 + global fpcversion_major
2775 + global fpcversion_minor
2776 + global fpcversion_release
2779 if { $pascal_init_done == 1 } {
2781 set pascal_compiler_is_fpc 1
2782 verbose -log "Free Pascal compiler found"
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
2796 + verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release"
2799 set pascal_init_done 1