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