1 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp
2 ===================================================================
3 --- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-13 03:59:37.000000000 +0200
4 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-16 23:30:30.107940483 +0200
5 @@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" {
6 # are. Observed with (FSF GNU Ada 4.5.3 20110124).
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.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
18 ===================================================================
19 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
20 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S 2014-06-16 23:30:30.108940484 +0200
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.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
478 ===================================================================
479 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
480 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c 2014-06-16 23:30:30.109940484 +0200
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 */
525 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
526 ===================================================================
527 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
528 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp 2014-06-16 23:30:30.109940484 +0200
530 +# Copyright 2009 Free Software Foundation, Inc.
532 +# This program is free software; you can redistribute it and/or modify
533 +# it under the terms of the GNU General Public License as published by
534 +# the Free Software Foundation; either version 3 of the License, or
535 +# (at your option) any later version.
537 +# This program is distributed in the hope that it will be useful,
538 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
539 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
540 +# GNU General Public License for more details.
542 +# You should have received a copy of the GNU General Public License
543 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
545 +# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
547 +if ![istarget "x86_64-*-*"] then {
548 + verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
552 +set testfile x86_64-vla-typedef
553 +set srcasmfile ${testfile}-foo.S
554 +set srcfile ${testfile}.c
555 +set binfile ${objdir}/${subdir}/${testfile}
556 +set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
557 +if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
558 + untested "Couldn't compile test program"
561 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
562 + untested "Couldn't compile test program"
568 +gdb_reinitialize_dir $srcdir/$subdir
572 + untested x86_64-vla-typedef
576 +gdb_breakpoint "break_here"
578 +gdb_continue_to_breakpoint "break_here"
580 +gdb_test "whatis array" "type = array_t" "first: whatis array"
582 +gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
584 +gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
585 +gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
586 +gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
587 +gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
589 +gdb_continue_to_breakpoint "break_here"
591 +gdb_test "whatis array" "type = array_t" "second: whatis array"
593 +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
594 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c
595 ===================================================================
596 --- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.c 2014-06-13 03:59:37.000000000 +0200
597 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c 2014-06-16 23:30:30.109940484 +0200
600 int array[] = {1, 2, 3, 4};
612 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp
613 ===================================================================
614 --- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-13 03:59:37.000000000 +0200
615 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-16 23:30:30.109940484 +0200
616 @@ -49,4 +49,12 @@ gdb_test "print array" \
617 "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
618 "Print array with array-indexes on"
621 +set test "p unbound.a == &unbound.a\[0\]"
622 +gdb_test_multiple $test $test {
623 + -re " = 1\r\n$gdb_prompt $" {
626 + -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
627 + unsupported "$test (no GCC)"
630 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c
631 ===================================================================
632 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
633 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c 2014-06-16 23:30:30.109940484 +0200
635 +/* This testcase is part of GDB, the GNU debugger.
637 + Copyright 2009 Free Software Foundation, Inc.
639 + This program is free software; you can redistribute it and/or modify
640 + it under the terms of the GNU General Public License as published by
641 + the Free Software Foundation; either version 3 of the License, or
642 + (at your option) any later version.
644 + This program is distributed in the hope that it will be useful,
645 + but WITHOUT ANY WARRANTY; without even the implied warranty of
646 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
647 + GNU General Public License for more details.
649 + You should have received a copy of the GNU General Public License
650 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
654 +} staticstruct = { 1 };
655 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp
656 ===================================================================
657 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
658 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp 2014-06-16 23:30:30.109940484 +0200
660 +# Copyright 2009 Free Software Foundation, Inc.
662 +# This program is free software; you can redistribute it and/or modify
663 +# it under the terms of the GNU General Public License as published by
664 +# the Free Software Foundation; either version 3 of the License, or
665 +# (at your option) any later version.
667 +# This program is distributed in the hope that it will be useful,
668 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
669 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
670 +# GNU General Public License for more details.
672 +# You should have received a copy of the GNU General Public License
673 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
675 +set test internal-var-field-address
676 +set binfile ${test}.x
677 +if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } {
678 + untested "Couldn't compile test program"
682 +clean_restart $binfile
684 +gdb_test {set $varstruct = staticstruct}
685 +gdb_test {p $varstruct.field} " = 1"
686 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c
687 ===================================================================
688 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
689 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c 2014-06-16 23:30:30.110940485 +0200
691 +/* This testcase is part of GDB, the GNU debugger.
693 + Copyright 2011 Free Software Foundation, Inc.
695 + This program is free software; you can redistribute it and/or modify
696 + it under the terms of the GNU General Public License as published by
697 + the Free Software Foundation; either version 3 of the License, or
698 + (at your option) any later version.
700 + This program is distributed in the hope that it will be useful,
701 + but WITHOUT ANY WARRANTY; without even the implied warranty of
702 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
703 + GNU General Public License for more details.
705 + You should have received a copy of the GNU General Public License
706 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
711 +main (int argc, char **argv)
714 + void (*f) (char *) = 0;
716 + memset (s, 0, sizeof (s));
722 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp
723 ===================================================================
724 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
725 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp 2014-06-16 23:30:30.110940485 +0200
727 +# Copyright 2011 Free Software Foundation, Inc.
729 +# This program is free software; you can redistribute it and/or modify
730 +# it under the terms of the GNU General Public License as published by
731 +# the Free Software Foundation; either version 3 of the License, or
732 +# (at your option) any later version.
734 +# This program is distributed in the hope that it will be useful,
735 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
736 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
737 +# GNU General Public License for more details.
739 +# You should have received a copy of the GNU General Public License
740 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
742 +set testfile vla-frame
743 +set executable ${testfile}
745 +if { [prepare_for_testing ${testfile}.exp ${executable}] } {
754 +gdb_test_multiple $test $test {
755 + -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
758 + -re "\r\n$gdb_prompt $" {
759 + untested ${testfile}.exp
764 +gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
765 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c
766 ===================================================================
767 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
768 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c 2014-06-16 23:30:30.110940485 +0200
770 +/* This testcase is part of GDB, the GNU debugger.
772 + Copyright 2008 Free Software Foundation, Inc.
774 + This program is free software; you can redistribute it and/or modify
775 + it under the terms of the GNU General Public License as published by
776 + the Free Software Foundation; either version 3 of the License, or
777 + (at your option) any later version.
779 + This program is distributed in the hope that it will be useful,
780 + but WITHOUT ANY WARRANTY; without even the implied warranty of
781 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
782 + GNU General Public License for more details.
784 + You should have received a copy of the GNU General Public License
785 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
790 +main (int argc, char **argv)
794 + array[0] = array[0];
800 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp
801 ===================================================================
802 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
803 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp 2014-06-16 23:30:30.110940485 +0200
805 +# Copyright 2008 Free Software Foundation, Inc.
807 +# This program is free software; you can redistribute it and/or modify
808 +# it under the terms of the GNU General Public License as published by
809 +# the Free Software Foundation; either version 3 of the License, or
810 +# (at your option) any later version.
812 +# This program is distributed in the hope that it will be useful,
813 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
814 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
815 +# GNU General Public License for more details.
817 +# You should have received a copy of the GNU General Public License
818 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
820 +# We could crash in:
821 +# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69
822 +# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
823 +# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL));
824 +# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
825 +# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
826 +# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
827 +# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
828 +# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840
830 +# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
832 +# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
834 +set testfile vla-overflow
835 +set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
836 +set srcfile ${testfile}.c
837 +set binfile ${objdir}/${subdir}/${testfile}
838 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
839 + untested "Couldn't compile test program"
843 +set f [open "|getconf PAGESIZE" "r"]
849 +gdb_reinitialize_dir $srcdir/$subdir
852 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
854 +if { [runto_main] < 0 } {
855 + untested vla-overflow
859 +# Get the GDB memory size when we stay at main.
861 +proc memory_v_pages_get {} {
862 + global pid_of_gdb pagesize
863 + set fd [open "/proc/$pid_of_gdb/statm"]
866 + # number of pages of virtual memory
867 + scan $line "%d" drs
871 +set pages_found [memory_v_pages_get]
873 +# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
875 +verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
876 +set kb_found [expr $pages_found * $pagesize / 1024]
877 +set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
878 +verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
880 +# Create the ulimit wrapper.
881 +set f [open $shfile "w"]
882 +puts $f "#! /bin/sh"
883 +puts $f "ulimit -v $kb_permit"
884 +puts $f "exec $GDB \"\$@\""
886 +remote_exec host "chmod +x $shfile"
894 +gdb_reinitialize_dir $srcdir/$subdir
897 +set pid_of_gdb [exp_pid -i [board_info host fileid]]
899 +# Check the size again after the second run.
900 +# We must not stop in main as it would cache `array' and never crash later.
904 +verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
906 +gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
908 +verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
910 +# `abort' can get expressed as `*__GI_abort'.
911 +gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
913 +verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
914 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c
915 ===================================================================
916 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
917 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c 2014-06-16 23:30:30.110940485 +0200
919 +/* This testcase is part of GDB, the GNU debugger.
921 + Copyright 2008 Free Software Foundation, Inc.
923 + This program is free software; you can redistribute it and/or modify
924 + it under the terms of the GNU General Public License as published by
925 + the Free Software Foundation; either version 3 of the License, or
926 + (at your option) any later version.
928 + This program is distributed in the hope that it will be useful,
929 + but WITHOUT ANY WARRANTY; without even the implied warranty of
930 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
931 + GNU General Public License for more details.
933 + You should have received a copy of the GNU General Public License
934 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
944 +bar (char *a, char *b, char *c, int size)
946 + memset (a, '1', size);
947 + memset (b, '2', size);
948 + memset (c, '3', 48);
957 + temp1[size - 1] = '\0';
961 + bar (temp1, temp2, temp3, size);
963 + marker (); /* break-here */
974 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp
975 ===================================================================
976 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
977 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp 2014-06-16 23:30:30.110940485 +0200
979 +# Copyright 2008 Free Software Foundation, Inc.
981 +# This program is free software; you can redistribute it and/or modify
982 +# it under the terms of the GNU General Public License as published by
983 +# the Free Software Foundation; either version 3 of the License, or
984 +# (at your option) any later version.
986 +# This program is distributed in the hope that it will be useful,
987 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
988 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
989 +# GNU General Public License for more details.
991 +# You should have received a copy of the GNU General Public License
992 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
995 +set srcfile ${testfile}.c
996 +set binfile ${objdir}/${subdir}/${testfile}
997 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
998 + untested "Couldn't compile test program"
1004 +gdb_reinitialize_dir $srcdir/$subdir
1005 +gdb_load ${binfile}
1012 +gdb_breakpoint [gdb_get_line_number "break-here"]
1014 +gdb_continue_to_breakpoint "break-here"
1016 +gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1"
1017 +gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2"
1018 +gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
1020 +gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
1021 +gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
1022 +gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
1024 +gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
1025 +gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
1026 +gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
1028 +gdb_continue_to_breakpoint "break-here"
1030 +gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1"
1031 +gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2"
1032 +gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
1034 +gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
1035 +gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
1036 +gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
1038 +gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
1039 +gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
1040 +gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
1041 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
1042 ===================================================================
1043 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1044 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S 2014-06-16 23:30:30.111940487 +0200
1046 +/* This testcase is part of GDB, the GNU debugger.
1048 + Copyright 2010 Free Software Foundation, Inc.
1050 + This program is free software; you can redistribute it and/or modify
1051 + it under the terms of the GNU General Public License as published by
1052 + the Free Software Foundation; either version 3 of the License, or
1053 + (at your option) any later version.
1055 + This program is distributed in the hope that it will be useful,
1056 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1057 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1058 + GNU General Public License for more details.
1060 + You should have received a copy of the GNU General Public License
1061 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
1063 +/* Debug information */
1065 +/* We will `break *main' at the very first instruction. */
1066 +#define main_length 1
1070 + /* See DW_OP_lit3 + 1 (0-based). */
1071 + .string "seennotseen"
1073 + .section .debug_info
1075 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1077 + .2byte 2 /* DWARF version number */
1078 + .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1079 + .byte 4 /* Pointer Size (in bytes) */
1082 + .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1083 + .4byte .Lproducer /* DW_AT_producer */
1084 + /* Use C++ to exploit a bug in parsing DW_AT_name "". */
1085 + .byte 4 /* DW_AT_language (C++) - */
1086 + .4byte main /* DW_AT_low_pc */
1087 + .byte main_length /* DW_AT_high_pc */
1090 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1091 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1093 + .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
1094 + .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1095 + .byte 0 /* DW_AT_lower_bound */
1096 + .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */
1097 + .byte 0 /* End of children of die */
1099 + /* DW_AT_upper_bound is referencing an optimized-out variable. */
1101 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1102 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1104 + .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
1105 + .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1106 + .byte 0 /* DW_AT_lower_bound */
1107 + .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */
1108 + .byte 0 /* End of children of die */
1110 + /* DW_AT_upper_bound is referencing register. */
1112 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1113 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1115 + .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */
1116 + .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1117 + .byte 0 /* DW_AT_lower_bound */
1118 + .byte 2f - 1f /* DW_AT_upper_bound */
1119 +1: .byte 0x50 /* DW_OP_reg0 */
1121 + .byte 0 /* End of children of die */
1124 + .uleb128 4 /* Abbrev: DW_TAG_base_type */
1125 + .4byte .Luint_str /* DW_AT_name */
1126 + .byte 4 /* DW_AT_byte_size */
1127 + .byte 7 /* DW_AT_encoding */
1130 + .uleb128 4 /* Abbrev: DW_TAG_base_type */
1131 + .4byte .Lchar_str /* DW_AT_name */
1132 + .byte 1 /* DW_AT_byte_size */
1133 + .byte 6 /* DW_AT_encoding */
1136 + .uleb128 5 /* Abbrev: DW_TAG_variable artificial */
1137 + .byte 1 /* DW_AT_artificial */
1138 + .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1139 + .4byte .Llen_loclist-.Lloclist /* DW_AT_location */
1141 + /* optimized-out variable for b_string. */
1143 + .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
1144 + .byte 1 /* DW_AT_artificial */
1145 + .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
1147 + .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1148 + .string "a_string" /* DW_AT_name */
1149 + .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
1150 + .byte 2f - 1f /* DW_AT_location */
1151 +1: .byte 3 /* DW_OP_addr */
1152 + .4byte vardata /* <addr> */
1155 + /* DW_AT_upper_bound is referencing an optimized-out variable. */
1156 + .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1157 + .string "b_string" /* DW_AT_name */
1158 + .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */
1159 + .byte 2f - 1f /* DW_AT_location */
1160 +1: .byte 3 /* DW_OP_addr */
1161 + .4byte vardata /* <addr> */
1164 + /* DW_AT_upper_bound is referencing register. */
1165 + .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1166 + .string "reg_string" /* DW_AT_name */
1167 + .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */
1168 + .byte 2f - 1f /* DW_AT_location */
1169 +1: .byte 3 /* DW_OP_addr */
1170 + .4byte vardata /* <addr> */
1173 + .byte 0 /* End of children of CU */
1176 + .section .debug_loc
1179 + .4byte 0 # Location list begin address
1180 + .4byte main_length # Location list end address
1181 + .value 2f-1f # Location expression size
1182 +1: .byte 0x33 # DW_OP_lit3
1183 + .byte 0x9f # DW_OP_stack_value
1185 + .quad 0x0 # Location list terminator begin (*.LLST2)
1186 + .quad 0x0 # Location list terminator end (*.LLST2)
1188 + .section .debug_abbrev
1190 + .uleb128 1 /* Abbrev code */
1191 + .uleb128 0x11 /* DW_TAG_compile_unit */
1192 + .byte 0x1 /* has_children */
1193 + .uleb128 0x25 /* DW_AT_producer */
1194 + .uleb128 0xe /* DW_FORM_strp */
1195 + .uleb128 0x13 /* DW_AT_language */
1196 + .uleb128 0xb /* DW_FORM_data1 */
1197 + .uleb128 0x11 /* DW_AT_low_pc */
1198 + .uleb128 0x1 /* DW_FORM_addr */
1199 + .uleb128 0x12 /* DW_AT_high_pc */
1200 + .uleb128 0xb /* DW_FORM_data1 */
1201 + .byte 0x0 /* Terminator */
1202 + .byte 0x0 /* Terminator */
1204 + .uleb128 2 /* Abbrev code */
1205 + .uleb128 0x1 /* TAG: DW_TAG_array_type */
1206 + .byte 0x1 /* DW_children_yes */
1207 + .uleb128 0x49 /* DW_AT_type */
1208 + .uleb128 0x13 /* DW_FORM_ref4 */
1209 + .byte 0x0 /* Terminator */
1210 + .byte 0x0 /* Terminator */
1212 + .uleb128 3 /* Abbrev code */
1213 + .uleb128 0x21 /* DW_TAG_subrange_type */
1214 + .byte 0x0 /* no children */
1215 + .uleb128 0x49 /* DW_AT_type */
1216 + .uleb128 0x13 /* DW_FORM_ref4 */
1217 + .uleb128 0x22 /* DW_AT_lower_bound */
1218 + .uleb128 0xb /* DW_FORM_data1 */
1219 + .uleb128 0x2f /* DW_AT_upper_bound */
1220 + .uleb128 0x13 /* DW_FORM_ref4 */
1221 + .byte 0x0 /* Terminator */
1222 + .byte 0x0 /* Terminator */
1224 + .uleb128 4 /* Abbrev code */
1225 + .uleb128 0x24 /* DW_TAG_base_type */
1226 + .byte 0x0 /* no_children */
1227 + .uleb128 0x3 /* DW_AT_name */
1228 + .uleb128 0xe /* DW_FORM_strp */
1229 + .uleb128 0xb /* DW_AT_byte_size */
1230 + .uleb128 0xb /* DW_FORM_data1 */
1231 + .uleb128 0x3e /* DW_AT_encoding */
1232 + .uleb128 0xb /* DW_FORM_data1 */
1233 + .byte 0x0 /* Terminator */
1234 + .byte 0x0 /* Terminator */
1236 + .uleb128 5 /* Abbrev code */
1237 + .uleb128 0x34 /* DW_TAG_variable */
1238 + .byte 0x0 /* no_children */
1239 + .uleb128 0x34 /* DW_AT_artificial */
1240 + .uleb128 0x0c /* DW_FORM_flag */
1241 + .uleb128 0x49 /* DW_AT_type */
1242 + .uleb128 0x13 /* DW_FORM_ref4 */
1243 + .uleb128 0x02 /* DW_AT_location */
1244 + .uleb128 0x06 /* DW_FORM_data4 */
1245 + .byte 0x0 /* Terminator */
1246 + .byte 0x0 /* Terminator */
1248 + .uleb128 6 /* Abbrev code */
1249 + .uleb128 0x34 /* DW_TAG_variable */
1250 + .byte 0x0 /* no_children */
1251 + .uleb128 0x3 /* DW_AT_name */
1252 + .uleb128 0x8 /* DW_FORM_string */
1253 + .uleb128 0x49 /* DW_AT_type */
1254 + .uleb128 0x13 /* DW_FORM_ref4 */
1255 + .uleb128 0x2 /* DW_AT_location */
1256 + .uleb128 0xa /* DW_FORM_block1 */
1257 + .byte 0x0 /* Terminator */
1258 + .byte 0x0 /* Terminator */
1260 + .uleb128 7 /* Abbrev code */
1261 + .uleb128 0x34 /* DW_TAG_variable */
1262 + .byte 0x0 /* no_children */
1263 + .uleb128 0x34 /* DW_AT_artificial */
1264 + .uleb128 0x0c /* DW_FORM_flag */
1265 + .uleb128 0x49 /* DW_AT_type */
1266 + .uleb128 0x13 /* DW_FORM_ref4 */
1267 + .byte 0x0 /* Terminator */
1268 + .byte 0x0 /* Terminator */
1270 + .uleb128 8 /* Abbrev code */
1271 + .uleb128 0x21 /* DW_TAG_subrange_type with block */
1272 + .byte 0x0 /* no children */
1273 + .uleb128 0x49 /* DW_AT_type */
1274 + .uleb128 0x13 /* DW_FORM_ref4 */
1275 + .uleb128 0x22 /* DW_AT_lower_bound */
1276 + .uleb128 0xb /* DW_FORM_data1 */
1277 + .uleb128 0x2f /* DW_AT_upper_bound */
1278 + .uleb128 0xa /* DW_FORM_block1 */
1279 + .byte 0x0 /* Terminator */
1280 + .byte 0x0 /* Terminator */
1282 + .byte 0x0 /* Terminator */
1285 + .section .debug_str
1287 + .string "GNU C 3.3.3"
1291 + .string "unsigned int"
1292 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
1293 ===================================================================
1294 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1295 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2014-06-16 23:30:30.111940487 +0200
1297 +# Copyright 2010 Free Software Foundation, Inc.
1299 +# This program is free software; you can redistribute it and/or modify
1300 +# it under the terms of the GNU General Public License as published by
1301 +# the Free Software Foundation; either version 3 of the License, or
1302 +# (at your option) any later version.
1304 +# This program is distributed in the hope that it will be useful,
1305 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1306 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1307 +# GNU General Public License for more details.
1309 +# You should have received a copy of the GNU General Public License
1310 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
1312 +# Test printing variable with dynamic bounds which reference a different
1313 +# (artificial in the GCC case) variable containing loclist as its location.
1314 +# This testcase uses value (not address) of the referenced variable:
1315 +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
1317 +# This test can only be run on targets which support DWARF-2 and use gas.
1318 +# For now pick a sampling of likely targets.
1319 +if {![istarget *-*-linux*]
1320 + && ![istarget *-*-gnu*]
1321 + && ![istarget *-*-elf*]
1322 + && ![istarget *-*-openbsd*]
1323 + && ![istarget arm-*-eabi*]
1324 + && ![istarget powerpc-*-eabi*]} {
1328 +set testfile dw2-bound-loclist
1329 +if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
1333 +# Verify it behaves at least as an unbound array without inferior.
1335 +set test "p a_string"
1336 +gdb_test_multiple $test $test {
1337 + -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" {
1340 + -re "No registers\\.\r\n$gdb_prompt $" {
1341 + kfail "vlaregression" $test
1345 +gdb_test "ptype a_string" {type = char \[variable length\]}
1347 +# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
1348 +if ![runto "*main"] {
1352 +gdb_test "p a_string" { = "seen"}
1353 +gdb_test "ptype a_string" {type = char \[4\]}
1355 +gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
1356 +gdb_test "ptype b_string" {type = char \[\]}
1358 +# The register contains unpredictable value - the array size.
1359 +gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
1360 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
1361 ===================================================================
1362 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1363 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2014-06-16 23:30:30.111940487 +0200
1365 +/* This testcase is part of GDB, the GNU debugger.
1367 + Copyright 2004 Free Software Foundation, Inc.
1369 + This program is free software; you can redistribute it and/or modify
1370 + it under the terms of the GNU General Public License as published by
1371 + the Free Software Foundation; either version 2 of the License, or
1372 + (at your option) any later version.
1374 + This program is distributed in the hope that it will be useful,
1375 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1376 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1377 + GNU General Public License for more details.
1379 + You should have received a copy of the GNU General Public License
1380 + along with this program; if not, write to the Free Software
1381 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1385 +/* The function `func1' traced into must have debug info on offset > 0;
1386 + (DW_UNSND (attr)). This is the reason of `func0' existence. */
1389 +func0(int a, int b)
1393 +/* `func1' being traced into must have some arguments to dump. */
1396 +func1(int a, int b)
1407 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
1408 ===================================================================
1409 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1410 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2014-06-16 23:30:30.111940487 +0200
1412 +# Copyright 2006 Free Software Foundation, Inc.
1414 +# This program is free software; you can redistribute it and/or modify
1415 +# it under the terms of the GNU General Public License as published by
1416 +# the Free Software Foundation; either version 2 of the License, or
1417 +# (at your option) any later version.
1419 +# This program is distributed in the hope that it will be useful,
1420 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1421 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1422 +# GNU General Public License for more details.
1424 +# You should have received a copy of the GNU General Public License
1425 +# along with this program; if not, write to the Free Software
1426 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1428 +# Minimal DWARF-2 unit test
1430 +# This test can only be run on targets which support DWARF-2.
1431 +# For now pick a sampling of likely targets.
1432 +if {![istarget *-*-linux*]
1433 + && ![istarget *-*-gnu*]
1434 + && ![istarget *-*-elf*]
1435 + && ![istarget *-*-openbsd*]
1436 + && ![istarget arm-*-eabi*]
1437 + && ![istarget powerpc-*-eabi*]} {
1441 +set testfile "dw2-stripped"
1442 +set srcfile ${testfile}.c
1443 +set binfile ${objdir}/${subdir}/${testfile}.x
1445 +remote_exec build "rm -f ${binfile}"
1447 +# get the value of gcc_compiled
1448 +if [get_compiler_info ${binfile}] {
1452 +# This test can only be run on gcc as we use additional_flags=FIXME
1453 +if {$gcc_compiled == 0} {
1457 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
1461 +remote_exec build "objcopy -R .debug_loc ${binfile}"
1462 +set strip_output [remote_exec build "objdump -h ${binfile}"]
1464 +set test "stripping test file preservation"
1465 +if [ regexp ".debug_info " $strip_output] {
1466 + pass "$test (.debug_info preserved)"
1468 + fail "$test (.debug_info got also stripped)"
1471 +set test "stripping test file functionality"
1472 +if [ regexp ".debug_loc " $strip_output] {
1473 + fail "$test (.debug_loc still present)"
1475 + pass "$test (.debug_loc stripped)"
1480 +gdb_reinitialize_dir $srcdir/$subdir
1481 +gdb_load ${binfile}
1483 +# For C programs, "start" should stop in main().
1486 + ".*main \\(\\) at .*" \
1489 + "func.* \\(.*\\) at .*" \
1491 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
1492 ===================================================================
1493 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1494 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S 2014-06-16 23:30:30.112940488 +0200
1496 +/* This testcase is part of GDB, the GNU debugger.
1498 + Copyright 2009 Free Software Foundation, Inc.
1500 + This program is free software; you can redistribute it and/or modify
1501 + it under the terms of the GNU General Public License as published by
1502 + the Free Software Foundation; either version 3 of the License, or
1503 + (at your option) any later version.
1505 + This program is distributed in the hope that it will be useful,
1506 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1507 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1508 + GNU General Public License for more details.
1510 + You should have received a copy of the GNU General Public License
1511 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
1513 +/* Debug information */
1515 + .section .debug_info
1518 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1520 + .2byte 2 /* DWARF Version */
1521 + .4byte .Labbrev1_begin /* Offset into abbrev section */
1522 + .byte 4 /* Pointer size */
1525 + .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1526 + .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */
1527 + .ascii "GNU C 4.3.2\0" /* DW_AT_producer */
1528 + .byte 1 /* DW_AT_language (C) */
1531 + .uleb128 2 /* Abbrev: DW_TAG_structure_type */
1532 + .ascii "some_struct\0" /* DW_AT_name */
1534 + .uleb128 3 /* Abbrev: DW_TAG_member */
1535 + .ascii "field\0" /* DW_AT_name */
1536 + .byte 0 /* DW_AT_data_member_location */
1538 + .byte 0 /* End of children of some_struct */
1540 + .byte 0 /* End of children of CU */
1545 + .section .debug_abbrev
1547 + .uleb128 1 /* Abbrev code */
1548 + .uleb128 0x11 /* DW_TAG_compile_unit */
1549 + .byte 1 /* has_children */
1550 + .uleb128 0x3 /* DW_AT_name */
1551 + .uleb128 0x8 /* DW_FORM_string */
1552 + .uleb128 0x25 /* DW_AT_producer */
1553 + .uleb128 0x8 /* DW_FORM_string */
1554 + .uleb128 0x13 /* DW_AT_language */
1555 + .uleb128 0xb /* DW_FORM_data1 */
1556 + .byte 0x0 /* Terminator */
1557 + .byte 0x0 /* Terminator */
1559 + .uleb128 2 /* Abbrev code */
1560 + .uleb128 0x13 /* DW_TAG_structure_type */
1561 + .byte 1 /* has_children */
1562 + .uleb128 0x3 /* DW_AT_name */
1563 + .uleb128 0x8 /* DW_FORM_string */
1564 + .byte 0x0 /* Terminator */
1565 + .byte 0x0 /* Terminator */
1567 + .uleb128 3 /* Abbrev code */
1568 + .uleb128 0x0d /* DW_TAG_member */
1569 + .byte 0 /* has_children */
1570 + .uleb128 0x3 /* DW_AT_name */
1571 + .uleb128 0x8 /* DW_FORM_string */
1572 + .uleb128 0x38 /* DW_AT_data_member_location */
1573 + .uleb128 0x0b /* DW_FORM_data1 */
1574 + .byte 0x0 /* Terminator */
1575 + .byte 0x0 /* Terminator */
1577 + .byte 0x0 /* Terminator */
1578 + .byte 0x0 /* Terminator */
1579 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
1580 ===================================================================
1581 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1582 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp 2014-06-16 23:30:30.112940488 +0200
1584 +# Copyright 2009 Free Software Foundation, Inc.
1586 +# This program is free software; you can redistribute it and/or modify
1587 +# it under the terms of the GNU General Public License as published by
1588 +# the Free Software Foundation; either version 3 of the License, or
1589 +# (at your option) any later version.
1591 +# This program is distributed in the hope that it will be useful,
1592 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1593 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1594 +# GNU General Public License for more details.
1596 +# You should have received a copy of the GNU General Public License
1597 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
1599 +# This test can only be run on targets which support DWARF-2 and use gas.
1600 +# For now pick a sampling of likely targets.
1601 +if {![istarget *-*-linux*]
1602 + && ![istarget *-*-gnu*]
1603 + && ![istarget *-*-elf*]
1604 + && ![istarget *-*-openbsd*]
1605 + && ![istarget arm-*-eabi*]
1606 + && ![istarget powerpc-*-eabi*]} {
1610 +set testfile "dw2-struct-member-data-location"
1611 +set srcfile ${testfile}.S
1612 +set binfile ${testfile}.x
1614 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } {
1618 +clean_restart $binfile
1620 +gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
1621 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
1622 ===================================================================
1623 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1624 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S 2014-06-16 23:30:30.112940488 +0200
1626 +/* This testcase is part of GDB, the GNU debugger.
1628 + Copyright 2012 Free Software Foundation, Inc.
1630 + This program is free software; you can redistribute it and/or modify
1631 + it under the terms of the GNU General Public License as published by
1632 + the Free Software Foundation; either version 3 of the License, or
1633 + (at your option) any later version.
1635 + This program is distributed in the hope that it will be useful,
1636 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1637 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1638 + GNU General Public License for more details.
1640 + You should have received a copy of the GNU General Public License
1641 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
1643 +/* Debug information */
1652 + .section .debug_info
1654 + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
1656 + .2byte 2 /* DWARF version number */
1657 + .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
1658 + .byte 4 /* Pointer Size (in bytes) */
1661 + .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
1662 + .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
1663 + .byte 2 /* DW_AT_language (C) - */
1666 + .uleb128 2 /* Abbrev: DW_TAG_array_type */
1667 + .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
1669 + .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
1670 + .byte 0 /* DW_AT_lower_bound */
1671 + .byte 128 /* DW_AT_upper_bound */
1673 + .byte 0 /* End of children of die */
1676 + .uleb128 4 /* Abbrev: DW_TAG_base_type */
1677 + .ascii "char\0" /* DW_AT_name */
1678 + .byte 1 /* DW_AT_byte_size */
1679 + .byte 6 /* DW_AT_encoding */
1681 + .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
1682 + .ascii "notype_string\0" /* DW_AT_name */
1683 + .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
1684 + .byte 2f - 1f /* DW_AT_location */
1685 +1: .byte 3 /* DW_OP_addr */
1686 + .4byte vardata /* <addr> */
1689 + .byte 0 /* End of children of CU */
1692 + .section .debug_abbrev
1694 + .uleb128 1 /* Abbrev code */
1695 + .uleb128 0x11 /* DW_TAG_compile_unit */
1696 + .byte 0x1 /* has_children */
1697 + .uleb128 0x25 /* DW_AT_producer */
1698 + .uleb128 0x8 /* DW_FORM_string */
1699 + .uleb128 0x13 /* DW_AT_language */
1700 + .uleb128 0xb /* DW_FORM_data1 */
1701 + .byte 0x0 /* Terminator */
1702 + .byte 0x0 /* Terminator */
1704 + .uleb128 2 /* Abbrev code */
1705 + .uleb128 0x1 /* TAG: DW_TAG_array_type */
1706 + .byte 0x1 /* DW_children_yes */
1707 + .uleb128 0x49 /* DW_AT_type */
1708 + .uleb128 0x13 /* DW_FORM_ref4 */
1709 + .byte 0x0 /* Terminator */
1710 + .byte 0x0 /* Terminator */
1712 + .uleb128 4 /* Abbrev code */
1713 + .uleb128 0x24 /* DW_TAG_base_type */
1714 + .byte 0x0 /* no_children */
1715 + .uleb128 0x3 /* DW_AT_name */
1716 + .uleb128 0x8 /* DW_FORM_string */
1717 + .uleb128 0xb /* DW_AT_byte_size */
1718 + .uleb128 0xb /* DW_FORM_data1 */
1719 + .uleb128 0x3e /* DW_AT_encoding */
1720 + .uleb128 0xb /* DW_FORM_data1 */
1721 + .byte 0x0 /* Terminator */
1722 + .byte 0x0 /* Terminator */
1724 + .uleb128 6 /* Abbrev code */
1725 + .uleb128 0x34 /* DW_TAG_variable */
1726 + .byte 0x0 /* no_children */
1727 + .uleb128 0x3 /* DW_AT_name */
1728 + .uleb128 0x8 /* DW_FORM_string */
1729 + .uleb128 0x49 /* DW_AT_type */
1730 + .uleb128 0x13 /* DW_FORM_ref4 */
1731 + .uleb128 0x2 /* DW_AT_location */
1732 + .uleb128 0xa /* DW_FORM_block1 */
1733 + .byte 0x0 /* Terminator */
1734 + .byte 0x0 /* Terminator */
1736 + .uleb128 8 /* Abbrev code */
1737 + .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */
1738 + .byte 0x0 /* no children */
1739 + .uleb128 0x22 /* DW_AT_lower_bound */
1740 + .uleb128 0xb /* DW_FORM_data1 */
1741 + .uleb128 0x2f /* DW_AT_upper_bound */
1742 + .uleb128 0xb /* DW_FORM_data1 */
1743 + .byte 0x0 /* Terminator */
1744 + .byte 0x0 /* Terminator */
1746 + .byte 0x0 /* Terminator */
1747 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
1748 ===================================================================
1749 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1750 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp 2014-06-16 23:30:30.112940488 +0200
1752 +# Copyright 2012 Free Software Foundation, Inc.
1754 +# This program is free software; you can redistribute it and/or modify
1755 +# it under the terms of the GNU General Public License as published by
1756 +# the Free Software Foundation; either version 3 of the License, or
1757 +# (at your option) any later version.
1759 +# This program is distributed in the hope that it will be useful,
1760 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1761 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1762 +# GNU General Public License for more details.
1764 +# You should have received a copy of the GNU General Public License
1765 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
1768 +# https://bugzilla.redhat.com/show_bug.cgi?id=806920
1769 +# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
1770 +# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
1771 +# specified DW_AT_type, present only in XLF produced code.
1773 +# This test can only be run on targets which support DWARF-2 and use gas.
1774 +if {![dwarf2_support]} {
1778 +set testfile dw2-subrange-no-type
1779 +set srcfile ${testfile}.S
1780 +set executable ${testfile}.x
1781 +set binfile [standard_output_file ${executable}]
1783 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
1787 +clean_restart $executable
1789 +gdb_test "ptype notype_string" {type = char \[129\]}
1790 +gdb_test "p notype_string" " = 'x' <repeats 129 times>"
1791 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp
1792 ===================================================================
1793 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1794 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2014-06-16 23:30:30.112940488 +0200
1796 +# Copyright 2009 Free Software Foundation, Inc.
1798 +# This program is free software; you can redistribute it and/or modify
1799 +# it under the terms of the GNU General Public License as published by
1800 +# the Free Software Foundation; either version 2 of the License, or
1801 +# (at your option) any later version.
1803 +# This program is distributed in the hope that it will be useful,
1804 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1805 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1806 +# GNU General Public License for more details.
1808 +# You should have received a copy of the GNU General Public License
1809 +# along with this program; if not, write to the Free Software
1810 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1812 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
1814 +# This file is part of the gdb testsuite. Array element stride must not be
1815 +# specified in the number of elements but in a number of bytes instead.
1816 +# Original problem:
1818 +# $1 = '0-hello', ' ' <repeats 33 times>
1820 +# warning: Fortran array stride not divisible by the element size
1822 +set testfile dwarf-stride
1823 +set srcfile ${testfile}.f90
1825 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
1829 +if ![runto MAIN__] then {
1830 + perror "couldn't run to breakpoint MAIN__"
1834 +gdb_breakpoint [gdb_get_line_number "break-here"]
1835 +gdb_continue_to_breakpoint "break-here" ".*break-here.*"
1836 +gdb_test "p c40pt(1)" " = '0-hello.*"
1837 +gdb_test "p c40pt(2)" " = '1-hello.*"
1838 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90
1839 ===================================================================
1840 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1841 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90 2014-06-16 23:30:30.112940488 +0200
1843 +! Copyright 2009 Free Software Foundation, Inc.
1845 +! This program is free software; you can redistribute it and/or modify
1846 +! it under the terms of the GNU General Public License as published by
1847 +! the Free Software Foundation; either version 2 of the License, or
1848 +! (at your option) any later version.
1850 +! This program is distributed in the hope that it will be useful,
1851 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
1852 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1853 +! GNU General Public License for more details.
1855 +! You should have received a copy of the GNU General Public License
1856 +! along with this program; if not, write to the Free Software
1857 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1859 +! File written by Alan Matsuoka.
1864 + character*40 long_string
1866 + end type small_stride
1868 + type(small_stride), dimension (20), target :: unpleasant
1869 + character*40, pointer, dimension(:):: c40pt
1874 + unpleasant(i+1)%small_pad = i+1
1875 + unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
1878 + c40pt => unpleasant%long_string
1880 + print *, c40pt ! break-here
1883 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp
1884 ===================================================================
1885 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1886 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp 2014-06-16 23:37:45.568362563 +0200
1888 +# Copyright 2007 Free Software Foundation, Inc.
1890 +# This program is free software; you can redistribute it and/or modify
1891 +# it under the terms of the GNU General Public License as published by
1892 +# the Free Software Foundation; either version 2 of the License, or
1893 +# (at your option) any later version.
1895 +# This program is distributed in the hope that it will be useful,
1896 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1897 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1898 +# GNU General Public License for more details.
1900 +# You should have received a copy of the GNU General Public License
1901 +# along with this program; if not, write to the Free Software
1902 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1904 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
1906 +# This file is part of the gdb testsuite. It contains tests for dynamically
1907 +# allocated Fortran arrays.
1908 +# It depends on the GCC dynamic Fortran arrays DWARF support:
1909 +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
1911 +set testfile "dynamic"
1912 +set srcfile ${testfile}.f90
1913 +set binfile ${objdir}/${subdir}/${testfile}
1915 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
1916 + untested "Couldn't compile ${srcfile}"
1922 +gdb_reinitialize_dir $srcdir/$subdir
1923 +gdb_load ${binfile}
1925 +if ![runto MAIN__] then {
1926 + perror "couldn't run to breakpoint MAIN__"
1930 +gdb_breakpoint [gdb_get_line_number "varx-init"]
1931 +gdb_continue_to_breakpoint "varx-init"
1932 +gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx unallocated"
1933 +gdb_test "ptype varx" "type = <not allocated>" "ptype varx unallocated"
1934 +gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) unallocated"
1935 +gdb_test "p varx(1,5,17)=1" "no such vector element because not allocated" "p varx(1,5,17)=1 unallocated"
1936 +gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) unallocated"
1938 +gdb_breakpoint [gdb_get_line_number "varx-allocated"]
1939 +gdb_continue_to_breakpoint "varx-allocated"
1940 +# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
1941 +gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
1942 +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
1943 +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
1945 +gdb_breakpoint [gdb_get_line_number "varx-filled"]
1946 +gdb_continue_to_breakpoint "varx-filled"
1947 +gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
1948 +gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
1949 +gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
1950 +gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
1951 +gdb_test "p varv" "\\$\[0-9\]* = <not associated>" "p varv unassociated"
1952 +gdb_test "ptype varv" "type = <not associated>" "ptype varv unassociated"
1954 +set test "output varx"
1955 +gdb_test_multiple $test $test {
1956 + -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
1961 +gdb_breakpoint [gdb_get_line_number "varv-associated"]
1962 +gdb_continue_to_breakpoint "varv-associated"
1963 +gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
1964 +gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
1965 +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
1966 +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
1967 +gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
1968 +# Intel Fortran Compiler 10.1.008 uses the pointer type.
1969 +gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
1971 +gdb_breakpoint [gdb_get_line_number "varv-filled"]
1972 +gdb_continue_to_breakpoint "varv-filled"
1973 +gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
1974 +gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
1976 +gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
1977 +gdb_continue_to_breakpoint "varv-deassociated"
1978 +# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
1979 +gdb_test "p varv" "\\$\[0-9\]* = (<not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated"
1980 +gdb_test "ptype varv" "type = (<not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated"
1981 +gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
1982 +gdb_test "p varv(1,5,17)" "no such vector element because not associated"
1983 +gdb_test "ptype varv(1,5,17)" "no such vector element because not associated"
1985 +gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
1986 +gdb_continue_to_breakpoint "varx-deallocated"
1987 +gdb_test "p varx" "\\$\[0-9\]* = <not allocated>" "p varx deallocated"
1988 +gdb_test "ptype varx" "type = <not allocated>" "ptype varx deallocated"
1989 +gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
1990 +gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) deallocated"
1991 +gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) deallocated"
1993 +gdb_breakpoint [gdb_get_line_number "vary-passed"]
1994 +gdb_continue_to_breakpoint "vary-passed"
1995 +# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
1996 +gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
1998 +gdb_breakpoint [gdb_get_line_number "vary-filled"]
1999 +gdb_continue_to_breakpoint "vary-filled"
2000 +gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
2001 +gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
2002 +gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
2003 +gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
2004 +# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
2005 +gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
2007 +gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
2008 +gdb_continue_to_breakpoint "varw-almostfilled"
2009 +gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
2010 +gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
2011 +# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
2012 +gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
2013 +# "up" works with GCC but other Fortran compilers may copy the values into the
2014 +# outer function only on the exit of the inner function.
2015 +# We need both variants as depending on the arch we optionally may still be
2016 +# executing the caller line or not after `finish'.
2017 +gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
2018 +gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
2019 +gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
2020 +gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
2021 +gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
2023 +gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
2024 +gdb_continue_to_breakpoint "varz-almostfilled"
2025 +# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
2026 +gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
2027 +# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
2028 +# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
2029 +gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
2030 +gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
2031 +gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
2032 +gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
2033 +# maps to foo::vary(1,1)
2034 +gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
2035 +# maps to foo::vary(2,2)
2036 +gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
2037 +# maps to foo::vary(1,3)
2038 +gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
2039 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90
2040 ===================================================================
2041 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2042 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90 2014-06-16 23:30:30.113940488 +0200
2044 +! Copyright 2007 Free Software Foundation, Inc.
2046 +! This program is free software; you can redistribute it and/or modify
2047 +! it under the terms of the GNU General Public License as published by
2048 +! the Free Software Foundation; either version 2 of the License, or
2049 +! (at your option) any later version.
2051 +! This program is distributed in the hope that it will be useful,
2052 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
2053 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2054 +! GNU General Public License for more details.
2056 +! You should have received a copy of the GNU General Public License
2057 +! along with this program; if not, write to the Free Software
2058 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2060 +! Ihis file is the Fortran source file for dynamic.exp.
2061 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
2062 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
2065 + real, target, allocatable :: varx (:, :, :)
2066 + real, pointer :: varv (:, :, :)
2067 + real, target :: varu (1, 2, 3)
2069 + allocate (varx (1:6, 5:15, 17:28)) ! varx-init
2070 + l = allocated (varx)
2071 + varx(:, :, :) = 6 ! varx-allocated
2072 + varx(1, 5, 17) = 7
2073 + varx(2, 6, 18) = 8
2074 + varx(6, 15, 28) = 9
2075 + varv => varx ! varx-filled
2076 + l = associated (varv)
2077 + varv(3, 7, 19) = 10 ! varv-associated
2078 + varv => null () ! varv-filled
2079 + l = associated (varv)
2080 + deallocate (varx) ! varv-deassociated
2081 + l = allocated (varx)
2082 + varu(:, :, :) = 10 ! varx-deallocated
2083 + allocate (varv (1:6, 5:15, 17:28))
2084 + l = associated (varv)
2086 + varv(1, 5, 17) = 7
2087 + varv(2, 6, 18) = 8
2088 + varv(6, 15, 28) = 9
2090 + l = associated (varv)
2094 + l = associated (varv)
2096 +subroutine foo (vary, varw)
2097 + real :: vary (:, :)
2098 + real :: varw (:, :, :)
2099 + vary(:, :) = 4 ! vary-passed
2103 + varw(:, :, :) = 5 ! vary-filled
2105 + varw(2, 2, 2) = 7 ! varw-almostfilled
2107 +subroutine bar (varz, vart)
2109 + real :: vart (2:11, 7:*)
2111 + varz(2) = 5 ! varz-almostfilled
2112 + vart(2,7) = vart(2,7)
2116 + subroutine foo (vary, varw)
2117 + real :: vary (:, :)
2118 + real :: varw (:, :, :)
2122 + subroutine bar (varz, vart)
2124 + real :: vart (2:11, 7:*)
2127 + real :: x (10, 10), y (5), z(8, 8, 8)
2132 + call foo (x, z(2:6, 4:7, 6:8))
2134 + if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
2135 + if (x (1, 3) .ne. 10) call abort
2136 + if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
2137 + if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
2138 + call foo (transpose (x), z)
2139 + if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
2140 + if (x (3, 1) .ne. 10) call abort
2142 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp
2143 ===================================================================
2144 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2145 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp 2014-06-16 23:30:30.114940489 +0200
2147 +# Copyright 2008 Free Software Foundation, Inc.
2149 +# This program is free software; you can redistribute it and/or modify
2150 +# it under the terms of the GNU General Public License as published by
2151 +# the Free Software Foundation; either version 2 of the License, or
2152 +# (at your option) any later version.
2154 +# This program is distributed in the hope that it will be useful,
2155 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2156 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2157 +# GNU General Public License for more details.
2159 +# You should have received a copy of the GNU General Public License
2160 +# along with this program; if not, write to the Free Software
2161 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2163 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
2165 +# This file is part of the gdb testsuite. It contains tests for Fortran
2166 +# strings with dynamic length.
2168 +set testfile "string"
2169 +set srcfile ${testfile}.f90
2170 +set binfile ${objdir}/${subdir}/${testfile}
2172 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
2173 + untested "Couldn't compile ${srcfile}"
2179 +gdb_reinitialize_dir $srcdir/$subdir
2180 +gdb_load ${binfile}
2182 +if ![runto MAIN__] then {
2183 + perror "couldn't run to breakpoint MAIN__"
2187 +gdb_breakpoint [gdb_get_line_number "var-init"]
2188 +gdb_continue_to_breakpoint "var-init"
2189 +gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
2190 +gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
2191 +gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
2192 +gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
2193 +gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
2194 +gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
2195 +gdb_test "p c" "\\$\[0-9\]* = 'c'"
2196 +gdb_test "p d" "\\$\[0-9\]* = 'd '"
2197 +gdb_test "p e" "\\$\[0-9\]* = 'g '"
2198 +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)"
2199 +gdb_test "p *e" "Attempt to take contents of a non-pointer value."
2200 +gdb_test "p *f" "Attempt to take contents of a non-pointer value."
2202 +gdb_breakpoint [gdb_get_line_number "var-finish"]
2203 +gdb_continue_to_breakpoint "var-finish"
2204 +gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set"
2205 +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set"
2206 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90
2207 ===================================================================
2208 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2209 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90 2014-06-16 23:30:30.114940489 +0200
2211 +! Copyright 2008 Free Software Foundation, Inc.
2213 +! This program is free software; you can redistribute it and/or modify
2214 +! it under the terms of the GNU General Public License as published by
2215 +! the Free Software Foundation; either version 2 of the License, or
2216 +! (at your option) any later version.
2218 +! This program is distributed in the hope that it will be useful,
2219 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
2220 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2221 +! GNU General Public License for more details.
2223 +! You should have received a copy of the GNU General Public License
2224 +! along with this program; if not, write to the Free Software
2225 +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2227 +! Ihis file is the Fortran source file for dynamic.exp.
2228 +! Original file written by Jakub Jelinek <jakub@redhat.com>.
2229 +! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
2231 +subroutine foo (e, f)
2232 + character (len=1) :: c
2233 + character (len=8) :: d
2234 + character (len=*) :: e
2235 + character (len=*) :: f (1:7, 8:10)
2238 + e = 'e' ! var-init
2241 + c = 'c' ! var-finish
2243 + character (len=4) :: g, h (1:7, 8:10)
2248 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp
2249 ===================================================================
2250 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2251 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp 2014-06-16 23:30:30.114940489 +0200
2253 +# Copyright 2011 Free Software Foundation, Inc.
2255 +# This program is free software; you can redistribute it and/or modify
2256 +# it under the terms of the GNU General Public License as published by
2257 +# the Free Software Foundation; either version 3 of the License, or
2258 +# (at your option) any later version.
2260 +# This program is distributed in the hope that it will be useful,
2261 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2262 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2263 +# GNU General Public License for more details.
2265 +# You should have received a copy of the GNU General Public License
2266 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
2268 +if { [skip_fortran_tests] } { return -1 }
2270 +set testfile "subrange"
2271 +set srcfile ${testfile}.f90
2272 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
2276 +if ![runto MAIN__] {
2277 + perror "Couldn't run to MAIN__"
2281 +# Depending on the compiler version being used, the name of the 4-byte integer
2282 +# and real types can be printed differently. For instance, gfortran-4.1 uses
2283 +# "int4" whereas gfortran-4.3 uses "int(kind=4)".
2284 +set int4 "(int4|integer\\(kind=4\\))"
2286 +gdb_breakpoint [gdb_get_line_number "break-static"]
2287 +gdb_continue_to_breakpoint "break-static" ".*break-static.*"
2289 +foreach var {a alloc ptr} {
2291 + set old_prefix $pf_prefix
2292 + lappend pf_prefix "$var:"
2294 + setup_kfail "*-*-*" "vlaregression/9999"
2295 + gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
2296 + setup_kfail "*-*-*" "vlaregression/9999"
2297 + gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
2298 + setup_kfail "*-*-*" "vlaregression/9999"
2299 + gdb_test "p $var (1, 2:)" { = \(21, 31\)}
2300 + setup_kfail "*-*-*" "vlaregression/9999"
2301 + gdb_test "p $var (2, :2)" { = \(12, 22\)}
2302 + setup_kfail "*-*-*" "vlaregression/9999"
2303 + gdb_test "p $var (3, 2:2)" { = \(23\)}
2304 + setup_kfail "*-*-*" "vlaregression/9999"
2305 + gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
2306 + setup_kfail "*-*-*" "vlaregression/9999"
2307 + gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
2308 + setup_kfail "*-*-*" "vlaregression/9999"
2309 + gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
2310 + setup_kfail "*-*-*" "vlaregression/9999"
2311 + gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
2312 + setup_kfail "*-*-*" "vlaregression/9999"
2313 + gdb_test "p $var (:)" "Wrong number of subscripts"
2314 + setup_kfail "*-*-*" "vlaregression/9999"
2315 + gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
2317 + set pf_prefix $old_prefix
2320 +gdb_test_no_output {set $a=a}
2323 +setup_kfail "*-*-*" "vlaregression/9999"
2324 +gdb_test {p $a (3, 2:2)} { = \(23\)}
2325 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90
2326 ===================================================================
2327 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2328 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90 2014-06-16 23:30:30.114940489 +0200
2330 +! Copyright 2011 Free Software Foundation, Inc.
2332 +! This program is free software; you can redistribute it and/or modify
2333 +! it under the terms of the GNU General Public License as published by
2334 +! the Free Software Foundation; either version 3 of the License, or
2335 +! (at your option) any later version.
2337 +! This program is distributed in the hope that it will be useful,
2338 +! but WITHOUT ANY WARRANTY; without even the implied warranty of
2339 +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2340 +! GNU General Public License for more details.
2342 +! You should have received a copy of the GNU General Public License
2343 +! along with this program. If not, see <http://www.gnu.org/licenses/>.
2346 + integer, target :: a (4, 3)
2347 + integer, allocatable :: alloc (:, :)
2348 + integer, pointer :: ptr (:, :)
2351 + a (i, j) = j * 10 + i
2353 + allocate (alloc (4, 3))
2356 + write (*,*) a ! break-static
2358 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
2359 ===================================================================
2360 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2361 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c 2014-06-16 23:30:30.114940489 +0200
2363 +/* Copyright 2011 Free Software Foundation, Inc.
2365 + This file is part of GDB.
2367 + This program is free software; you can redistribute it and/or modify
2368 + it under the terms of the GNU General Public License as published by
2369 + the Free Software Foundation; either version 3 of the License, or
2370 + (at your option) any later version.
2372 + This program is distributed in the hope that it will be useful,
2373 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2374 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2375 + GNU General Public License for more details.
2377 + You should have received a copy of the GNU General Public License
2378 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
2381 +main (int argc, char **argv)
2385 + vla[0] = 0; /* break-here */
2389 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
2390 ===================================================================
2391 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2392 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp 2014-06-16 23:30:30.114940489 +0200
2394 +# Copyright 2011 Free Software Foundation, Inc.
2396 +# This program is free software; you can redistribute it and/or modify
2397 +# it under the terms of the GNU General Public License as published by
2398 +# the Free Software Foundation; either version 3 of the License, or
2399 +# (at your option) any later version.
2401 +# This program is distributed in the hope that it will be useful,
2402 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2403 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2404 +# GNU General Public License for more details.
2406 +# You should have received a copy of the GNU General Public License
2407 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
2409 +load_lib mi-support.exp
2410 +set MIFLAGS "-i=mi2"
2413 +if [mi_gdb_start] {
2417 +set testfile "mi2-var-stale-type"
2418 +set srcfile ${testfile}.c
2419 +set binfile [standard_output_file ${testfile}]
2420 +if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
2424 +mi_delete_breakpoints
2425 +mi_gdb_reinitialize_dir $srcdir/$subdir
2426 +mi_gdb_load ${binfile}
2428 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
2430 + "maintenance set internal-error quit yes"
2432 +mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
2434 + "maintenance set internal-error corefile yes"
2436 +set line [gdb_get_line_number "break-here"]
2439 +mi_gdb_test "-break-insert -t $srcfile:$line" \
2440 + "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \
2441 + "breakpoint at $func"
2443 +if { [mi_run_cmd] < 0 } {
2446 +mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
2448 +mi_create_varobj "vla" "vla" "create local variable vla"
2450 +mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
2451 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c
2452 ===================================================================
2453 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2454 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c 2014-06-16 23:30:30.115940490 +0200
2456 +/* This file is part of GDB, the GNU debugger.
2458 + Copyright 2009 Free Software Foundation, Inc.
2460 + This program is free software; you can redistribute it and/or modify
2461 + it under the terms of the GNU General Public License as published by
2462 + the Free Software Foundation; either version 3 of the License, or
2463 + (at your option) any later version.
2465 + This program is distributed in the hope that it will be useful,
2466 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2467 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2468 + GNU General Public License for more details.
2470 + You should have received a copy of the GNU General Public License
2471 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
2478 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c
2479 ===================================================================
2480 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2481 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c 2014-06-16 23:30:30.115940490 +0200
2483 +/* This file is part of GDB, the GNU debugger.
2485 + Copyright 2009 Free Software Foundation, Inc.
2487 + This program is free software; you can redistribute it and/or modify
2488 + it under the terms of the GNU General Public License as published by
2489 + the Free Software Foundation; either version 3 of the License, or
2490 + (at your option) any later version.
2492 + This program is distributed in the hope that it will be useful,
2493 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2494 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2495 + GNU General Public License for more details.
2497 + You should have received a copy of the GNU General Public License
2498 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
2500 +extern int func (int *arr);
2505 + int arr[] = { 42 };
2511 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp
2512 ===================================================================
2513 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2514 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp 2014-06-16 23:30:30.115940490 +0200
2516 +# Copyright 2009 Free Software Foundation, Inc.
2518 +# This program is free software; you can redistribute it and/or modify
2519 +# it under the terms of the GNU General Public License as published by
2520 +# the Free Software Foundation; either version 2 of the License, or
2521 +# (at your option) any later version.
2523 +# This program is distributed in the hope that it will be useful,
2524 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2525 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2526 +# GNU General Public License for more details.
2528 +# You should have received a copy of the GNU General Public License
2529 +# along with this program; if not, write to the Free Software
2530 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2532 +# This file is part of the gdb testsuite.
2534 +if { [prepare_for_testing array-from-register.exp "array-from-register" \
2535 + {array-from-register.c array-from-register-func.c} \
2536 + {debug optimize=-O2}] } {
2540 +if ![runto func] then {
2544 +gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
2547 +# Address requested for identifier "arr" which is in register $rdi
2548 +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
2549 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp
2550 ===================================================================
2551 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2552 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp 2014-06-16 23:30:30.115940490 +0200
2554 +# Copyright 2008, 2009 Free Software Foundation, Inc.
2556 +# This program is free software; you can redistribute it and/or modify
2557 +# it under the terms of the GNU General Public License as published by
2558 +# the Free Software Foundation; either version 3 of the License, or
2559 +# (at your option) any later version.
2561 +# This program is distributed in the hope that it will be useful,
2562 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2563 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2564 +# GNU General Public License for more details.
2566 +# You should have received a copy of the GNU General Public License
2567 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
2569 +if $tracelevel then {
2570 + strace $tracelevel
2573 +load_lib "pascal.exp"
2575 +set testfile "arrays"
2576 +set srcfile ${testfile}.pas
2577 +set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
2579 +# These tests only work with fpc, using the -gw3 compile-option
2581 +if { $pascal_compiler_is_fpc != 1 } {
2585 +# Detect if the fpc version is below 2.3.0
2586 +set fpc_generates_dwarf_for_dynamic_arrays 1
2587 +if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} {
2588 + set fpc_generates_dwarf_for_dynamic_arrays 0
2592 +if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
2598 +gdb_reinitialize_dir $srcdir/$subdir
2599 +gdb_load ${binfile}
2600 +set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
2601 +set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
2604 +if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
2605 + pass "setting breakpoint 1"
2607 +if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
2608 + pass "setting breakpoint 2"
2611 +# Verify that "start" lands inside the right procedure.
2612 +if { [gdb_start_cmd] < 0 } {
2617 +gdb_test "" ".* at .*${srcfile}.*" "start"
2619 +gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
2621 +gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
2622 +gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
2624 +gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
2626 +gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
2627 +gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer"
2629 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2630 + setup_xfail "*-*-*"
2632 +gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
2633 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2634 + setup_xfail "*-*-*"
2636 +gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
2638 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2639 + setup_xfail "*-*-*"
2641 +gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
2643 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2644 + setup_xfail "*-*-*"
2646 +gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
2648 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2649 + setup_xfail "*-*-*"
2651 +gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
2653 +if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
2654 + setup_xfail "*-*-*"
2656 +gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
2658 Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas
2659 ===================================================================
2660 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2661 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas 2014-06-16 23:30:30.115940490 +0200
2664 + Copyright 2008, 2009 Free Software Foundation, Inc.
2666 + This program is free software; you can redistribute it and/or modify
2667 + it under the terms of the GNU General Public License as published by
2668 + the Free Software Foundation; either version 3 of the License, or
2669 + (at your option) any later version.
2671 + This program is distributed in the hope that it will be useful,
2672 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2673 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2674 + GNU General Public License for more details.
2676 + You should have received a copy of the GNU General Public License
2677 + along with this program. If not, see <http://www.gnu.org/licenses/>.
2682 +{$mode objfpc}{$h+}
2686 +type TStatArrInt= array[0..11] of integer;
2687 + TDynArrInt= array of integer;
2688 + TStatArrStr= array[0..12] of string;
2689 + TDynArrStr= array of string;
2690 + TDynArrChar = array of char;
2691 + TStatArrChar = array [0..11] of char;
2693 + TStat2dArrInt = array[0..11,0..4] of integer;
2695 +var StatArrInt: TStatArrInt;
2696 + StatArrInt_: Array[0..11] of integer;
2697 + DynArrInt: TDynArrInt;
2698 + DynArrInt_: Array of integer;
2699 + StatArrStr: TStatArrStr;
2700 + DynArrStr: TDynArrStr;
2701 + StatArrChar: TStatArrChar;
2702 + DynArrChar: TDynArrChar;
2704 + Stat2dArrInt: TStat2dArrInt;
2711 + for i := 0 to 11 do
2713 + StatArrInt[i]:= i+50;
2714 + StatArrInt_[i]:= i+50;
2715 + StatArrChar[i]:= chr(ord('a')+i);
2716 + for j := 0 to 4 do
2717 + Stat2dArrInt[i,j]:=i+j;
2719 + writeln(StatArrInt_[0]);
2720 + writeln(StatArrInt[0]); { set breakpoint 1 here }
2721 + writeln(StatArrChar[0]);
2722 + writeln(Stat2dArrInt[0,0]);
2724 + setlength(DynArrInt,13);
2725 + setlength(DynArrInt_,13);
2726 + setlength(DynArrStr,13);
2727 + setlength(DynArrChar,13);
2728 + for i := 0 to 12 do
2730 + DynArrInt[i]:= i+50;
2731 + DynArrInt_[i]:= i+50;
2732 + DynArrChar[i]:= chr(ord('a')+i);
2733 + StatArrStr[i]:='str'+inttostr(i);
2734 + DynArrStr[i]:='dstr'+inttostr(i);
2736 + writeln(DynArrInt_[1]);
2737 + writeln(DynArrInt[1]);
2738 + writeln(DynArrStr[1]);
2739 + writeln(StatArrStr[1]);
2740 + writeln(DynArrChar[1]);
2742 + s := 'test'#0'string';
2743 + writeln(s); { set breakpoint 2 here }
2745 Index: gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp
2746 ===================================================================
2747 --- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:29.278939700 +0200
2748 +++ gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:30.117940492 +0200
2749 @@ -159,6 +159,11 @@ proc gdb_unload {} {
2753 + -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
2755 + verbose "\t\tUnloading symbols for program being debugged"
2758 -re "Discard symbol table from .*y or n.*$" {
2761 Index: gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp
2762 ===================================================================
2763 --- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/pascal.exp 2014-06-13 03:59:37.000000000 +0200
2764 +++ gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp 2014-06-16 23:30:30.117940492 +0200
2765 @@ -37,6 +37,9 @@ proc pascal_init {} {
2766 global pascal_compiler_is_fpc
2769 + global fpcversion_major
2770 + global fpcversion_minor
2771 + global fpcversion_release
2774 if { $pascal_init_done == 1 } {
2775 @@ -64,6 +67,20 @@ proc pascal_init {} {
2776 set pascal_compiler_is_fpc 1
2777 verbose -log "Free Pascal compiler found"
2780 + # Detect the fpc-version
2781 + if { $pascal_compiler_is_fpc == 1 } {
2782 + set fpcversion_major 1
2783 + set fpcversion_minor 0
2784 + set fpcversion_release 0
2785 + set fpcversion [ remote_exec host $fpc_compiler "-iV" ]
2786 + if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] {
2787 + regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major
2788 + regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor
2789 + regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release
2791 + verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release"
2794 set pascal_init_done 1