[PATCH] Add option to control checking of inner frames when doing a backtrace
Jan Kratochvil
jan.kratochvil@redhat.com
Sun Oct 7 05:52:00 GMT 2012
Hi,
just a slightly improved patch.
Jan
gdb/testsuite/
2012-10-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/amd64-inner-frame.S: New file.
* gdb.arch/amd64-inner-frame.c: New file.
* gdb.arch/amd64-inner-frame.exp: New file.
diff --git a/gdb/testsuite/gdb.arch/amd64-inner-frame.S b/gdb/testsuite/gdb.arch/amd64-inner-frame.S
new file mode 100644
index 0000000..d11a058
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-inner-frame.S
@@ -0,0 +1,503 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is compiled from gdb.arch/amd64-inner-frame.c
+ using -g -dA -S. */
+
+ .file "amd64-inner-frame.c"
+ .text
+.Ltext0:
+ .local v
+ .comm v,4,4
+ .type f, @function
+f:
+.LFB0:
+ .file 1 "gdb.arch/amd64-inner-frame.c"
+ # gdb.arch/amd64-inner-frame.c:26
+ .loc 1 26 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (fallthru)
+ pushq %rbp
+.LCFI0:
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+.LCFI1:
+ .cfi_def_cfa_register 6
+ subq $32, %rsp
+ movl %edi, -20(%rbp)
+ # gdb.arch/amd64-inner-frame.c:27
+ .loc 1 27 0
+ movl $16, %eax
+ subq $1, %rax
+ addq $16, %rax
+ movq $16, -32(%rbp)
+ movl $0, %edx
+ divq -32(%rbp)
+ imulq $16, %rax, %rax
+ subq %rax, %rsp
+ movq %rsp, %rax
+ addq $15, %rax
+ shrq $4, %rax
+ salq $4, %rax
+ movq %rax, -8(%rbp)
+ # gdb.arch/amd64-inner-frame.c:28
+ .loc 1 28 0
+ movq -8(%rbp), %rax
+ movq %rax, -16(%rbp)
+ # gdb.arch/amd64-inner-frame.c:29
+ .loc 1 29 0
+ cmpl $2, -20(%rbp)
+# SUCC: 3 (fallthru) 4
+ jne .L2
+# BLOCK 3 seq:1
+# PRED: 2 (fallthru)
+ # gdb.arch/amd64-inner-frame.c:30
+ .loc 1 30 0
+ leaq -16(%rbp), %rax
+ addq $16, %rax
+ movq %rax, 64(%rbp)
+# SUCC: 5 [100.0%]
+ jmp .L3
+# BLOCK 4 seq:2
+# PRED: 2
+.L2:
+ # gdb.arch/amd64-inner-frame.c:32
+ .loc 1 32 0
+ movl -20(%rbp), %eax
+ addl $1, %eax
+ movl %eax, %edi
+# SUCC: 5 (fallthru)
+ call f
+# BLOCK 5 seq:3
+# PRED: 4 (fallthru) 3 [100.0%]
+.L3:
+ # gdb.arch/amd64-inner-frame.c:33
+ .loc 1 33 0
+ movl v(%rip), %eax
+ addl $1, %eax
+ movl %eax, v(%rip)
+ # gdb.arch/amd64-inner-frame.c:34
+ .loc 1 34 0
+ leave
+.LCFI2:
+ .cfi_def_cfa 7, 8
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE0:
+ .size f, .-f
+ .globl main
+ .type main, @function
+main:
+.LFB1:
+ # gdb.arch/amd64-inner-frame.c:38
+ .loc 1 38 0
+ .cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (fallthru)
+ pushq %rbp
+.LCFI3:
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+.LCFI4:
+ .cfi_def_cfa_register 6
+ # gdb.arch/amd64-inner-frame.c:39
+ .loc 1 39 0
+ movl $0, %edi
+ call f
+ # gdb.arch/amd64-inner-frame.c:40
+ .loc 1 40 0
+ movl $0, %eax
+ # gdb.arch/amd64-inner-frame.c:41
+ .loc 1 41 0
+ popq %rbp
+.LCFI5:
+ .cfi_def_cfa 7, 8
+# SUCC: EXIT [100.0%]
+ ret
+ .cfi_endproc
+.LFE1:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 0x100 # Length of Compilation Unit Info
+ .value 0x2 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x8 # Pointer Size (in bytes)
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF9 # DW_AT_producer: "GNU C 4.7.3 20121007 (prerelease)"
+ .byte 0x1 # DW_AT_language
+ .long .LASF10 # DW_AT_name: "gdb.arch/amd64-inner-frame.c"
+ .long .LASF11 # DW_AT_comp_dir: ""
+ .quad .Ltext0 # DW_AT_low_pc
+ .quad .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_base_type)
+ .byte 0x8 # DW_AT_byte_size
+ .byte 0x7 # DW_AT_encoding
+ .long .LASF0 # DW_AT_name: "long unsigned int"
+ .uleb128 0x2 # (DIE (0x34) DW_TAG_base_type)
+ .byte 0x8 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .long .LASF1 # DW_AT_name: "long int"
+ .uleb128 0x3 # (DIE (0x3b) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .ascii "int\0" # DW_AT_name
+ .uleb128 0x2 # (DIE (0x42) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x8 # DW_AT_encoding
+ .long .LASF2 # DW_AT_name: "unsigned char"
+ .uleb128 0x2 # (DIE (0x49) DW_TAG_base_type)
+ .byte 0x2 # DW_AT_byte_size
+ .byte 0x7 # DW_AT_encoding
+ .long .LASF3 # DW_AT_name: "short unsigned int"
+ .uleb128 0x2 # (DIE (0x50) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x7 # DW_AT_encoding
+ .long .LASF4 # DW_AT_name: "unsigned int"
+ .uleb128 0x2 # (DIE (0x57) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x6 # DW_AT_encoding
+ .long .LASF5 # DW_AT_name: "signed char"
+ .uleb128 0x2 # (DIE (0x5e) DW_TAG_base_type)
+ .byte 0x2 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .long .LASF6 # DW_AT_name: "short int"
+ .uleb128 0x2 # (DIE (0x65) DW_TAG_base_type)
+ .byte 0x8 # DW_AT_byte_size
+ .byte 0x7 # DW_AT_encoding
+ .long .LASF7 # DW_AT_name: "sizetype"
+ .uleb128 0x4 # (DIE (0x6c) DW_TAG_pointer_type)
+ .byte 0x8 # DW_AT_byte_size
+ .uleb128 0x2 # (DIE (0x6e) DW_TAG_base_type)
+ .byte 0x1 # DW_AT_byte_size
+ .byte 0x6 # DW_AT_encoding
+ .long .LASF8 # DW_AT_name: "char"
+ .uleb128 0x5 # (DIE (0x75) DW_TAG_subprogram)
+ .ascii "f\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x19 # DW_AT_decl_line
+ .byte 0x1 # DW_AT_prototyped
+ .quad .LFB0 # DW_AT_low_pc
+ .quad .LFE0 # DW_AT_high_pc
+ .long .LLST0 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .long 0xb9 # DW_AT_sibling
+ .uleb128 0x6 # (DIE (0x94) DW_TAG_formal_parameter)
+ .ascii "i\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x19 # DW_AT_decl_line
+ .long 0x3b # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -36
+ .uleb128 0x7 # (DIE (0xa0) DW_TAG_variable)
+ .ascii "l\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x1b # DW_AT_decl_line
+ .long 0x6c # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -24
+ .uleb128 0x7 # (DIE (0xac) DW_TAG_variable)
+ .ascii "a\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x1c # DW_AT_decl_line
+ .long 0xb9 # DW_AT_type
+ .byte 0x2 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -32
+ .byte 0 # end of children of DIE 0x75
+ .uleb128 0x8 # (DIE (0xb9) DW_TAG_array_type)
+ .long 0x6c # DW_AT_type
+ .long 0xc9 # DW_AT_sibling
+ .uleb128 0x9 # (DIE (0xc2) DW_TAG_subrange_type)
+ .long 0x65 # DW_AT_type
+ .byte 0 # DW_AT_upper_bound
+ .byte 0 # end of children of DIE 0xb9
+ .uleb128 0xa # (DIE (0xc9) DW_TAG_subprogram)
+ .byte 0x1 # DW_AT_external
+ .long .LASF12 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x25 # DW_AT_decl_line
+ .byte 0x1 # DW_AT_prototyped
+ .long 0x3b # DW_AT_type
+ .quad .LFB1 # DW_AT_low_pc
+ .quad .LFE1 # DW_AT_high_pc
+ .long .LLST1 # DW_AT_frame_base
+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites
+ .uleb128 0x7 # (DIE (0xeb) DW_TAG_variable)
+ .ascii "v\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-inner-frame.c)
+ .byte 0x16 # DW_AT_decl_line
+ .long 0xfe # DW_AT_type
+ .byte 0x9 # DW_AT_location
+ .byte 0x3 # DW_OP_addr
+ .quad v
+ .uleb128 0xb # (DIE (0xfe) DW_TAG_volatile_type)
+ .long 0x3b # DW_AT_type
+ .byte 0 # end of children of DIE 0xb
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .byte 0
+ .byte 0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0xf # (TAG: DW_TAG_pointer_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .byte 0
+ .byte 0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0xa # (DW_FORM_block1)
+ .byte 0
+ .byte 0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0x1 # (TAG: DW_TAG_array_type)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2f # (DW_AT_upper_bound)
+ .uleb128 0xb # (DW_FORM_data1)
+ .byte 0
+ .byte 0
+ .uleb128 0xa # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0 # DW_children_no
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0xc # (DW_FORM_flag)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x6 # (DW_FORM_data4)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0xc # (DW_FORM_flag)
+ .byte 0
+ .byte 0
+ .uleb128 0xb # (abbrev code)
+ .uleb128 0x35 # (TAG: DW_TAG_volatile_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+ .quad .LFB0-.Ltext0 # Location list begin address (*.LLST0)
+ .quad .LCFI0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 8
+ .quad .LCFI0-.Ltext0 # Location list begin address (*.LLST0)
+ .quad .LCFI1-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 16
+ .quad .LCFI1-.Ltext0 # Location list begin address (*.LLST0)
+ .quad .LCFI2-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x76 # DW_OP_breg6
+ .sleb128 16
+ .quad .LCFI2-.Ltext0 # Location list begin address (*.LLST0)
+ .quad .LFE0-.Ltext0 # Location list end address (*.LLST0)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 8
+ .quad 0 # Location list terminator begin (*.LLST0)
+ .quad 0 # Location list terminator end (*.LLST0)
+.LLST1:
+ .quad .LFB1-.Ltext0 # Location list begin address (*.LLST1)
+ .quad .LCFI3-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 8
+ .quad .LCFI3-.Ltext0 # Location list begin address (*.LLST1)
+ .quad .LCFI4-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 16
+ .quad .LCFI4-.Ltext0 # Location list begin address (*.LLST1)
+ .quad .LCFI5-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x76 # DW_OP_breg6
+ .sleb128 16
+ .quad .LCFI5-.Ltext0 # Location list begin address (*.LLST1)
+ .quad .LFE1-.Ltext0 # Location list end address (*.LLST1)
+ .value 0x2 # Location expression size
+ .byte 0x77 # DW_OP_breg7
+ .sleb128 8
+ .quad 0 # Location list terminator begin (*.LLST1)
+ .quad 0 # Location list terminator end (*.LLST1)
+ .section .debug_aranges,"",@progbits
+ .long 0x2c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x8 # Size of Address
+ .byte 0 # Size of Segment Descriptor
+ .value 0 # Pad to 16 byte boundary
+ .value 0
+ .quad .Ltext0 # Address
+ .quad .Letext0-.Ltext0 # Length
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF4:
+ .string "unsigned int"
+.LASF0:
+ .string "long unsigned int"
+.LASF11:
+ .string ""
+.LASF8:
+ .string "char"
+.LASF2:
+ .string "unsigned char"
+.LASF12:
+ .string "main"
+.LASF1:
+ .string "long int"
+.LASF3:
+ .string "short unsigned int"
+.LASF5:
+ .string "signed char"
+.LASF10:
+ .string "gdb.arch/amd64-inner-frame.c"
+.LASF9:
+ .string "GNU C 4.7.3 20121007 (prerelease)"
+.LASF6:
+ .string "short int"
+.LASF7:
+ .string "sizetype"
+ .ident "GCC: (GNU) 4.7.3 20121007 (prerelease)"
+ .section .note.GNU-stack,"",@progbits
diff --git a/gdb/testsuite/gdb.arch/amd64-inner-frame.c b/gdb/testsuite/gdb.arch/amd64-inner-frame.c
new file mode 100644
index 0000000..5726fb6
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-inner-frame.c
@@ -0,0 +1,41 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <alloca.h>
+#include <stddef.h>
+#include <stdio.h>
+
+static volatile int v;
+
+static void
+f (int i)
+{
+ void *l = alloca (1);
+ void *a[1] = { l };
+ if (i == 2)
+ a[10] = &a[2];
+ else
+ f (i + 1);
+ v++; /* break-here */
+}
+
+int
+main (void)
+{
+ f (0);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/amd64-inner-frame.exp b/gdb/testsuite/gdb.arch/amd64-inner-frame.exp
new file mode 100644
index 0000000..f9aab7d
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/amd64-inner-frame.exp
@@ -0,0 +1,48 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set opts {}
+standard_testfile .S
+
+if [info exists COMPILE] {
+ # make check RUNTESTFLAGS="gdb.arch/amd64-inner-frame.exp COMPILE=1"
+ standard_testfile
+ lappend opts debug
+} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
+ verbose "Skipping ${testfile}."
+ return
+}
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+set srcfile $testfile.c
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
+
+set test "backtrace"
+gdb_test_multiple $test $test {
+ -re "\r\n#3 " {
+ fail $test
+ }
+ -re "\r\nBacktrace stopped: previous frame inner to this frame \\(corrupt stack\\?\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
More information about the Gdb-patches
mailing list