1054fa6d0b
- Fix various entry-values sub-optimal results.
846 lines
26 KiB
Diff
846 lines
26 KiB
Diff
http://sourceware.org/ml/gdb-patches/2013-03/msg00062.html
|
|
Subject: [patch] entry-values: Fix if callee called noreturn function
|
|
|
|
Hi,
|
|
|
|
while debugging the previous bug I found this bug.
|
|
|
|
THIS_PC found below is then passed to get_pc_function_start.
|
|
get_pc_function_start cannot handle PC which has address of the end of the
|
|
function.
|
|
|
|
No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu.
|
|
|
|
I will check it in.
|
|
|
|
|
|
Thanks,
|
|
Jan
|
|
|
|
|
|
gdb/
|
|
2013-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
Fix entry-values if the callee called a noreturn function.
|
|
* dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Use
|
|
get_frame_address_in_block. Add new comment.
|
|
|
|
gdb/testsuite/
|
|
2013-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
Fix entry-values if the callee called a noreturn function.
|
|
* gdb.arch/amd64-tailcall-noret.S: New file.
|
|
* gdb.arch/amd64-tailcall-noret.c: New file.
|
|
* gdb.arch/amd64-tailcall-noret.exp: New file.
|
|
|
|
diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c
|
|
index b5f95c3..b82a051 100644
|
|
--- a/gdb/dwarf2-frame-tailcall.c
|
|
+++ b/gdb/dwarf2-frame-tailcall.c
|
|
@@ -374,7 +374,9 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame,
|
|
|
|
gdb_assert (*tailcall_cachep == NULL);
|
|
|
|
- this_pc = get_frame_pc (this_frame);
|
|
+ /* PC may be after the function if THIS_FRAME calls noreturn function,
|
|
+ get_frame_address_in_block will decrease it by 1 in such case. */
|
|
+ this_pc = get_frame_address_in_block (this_frame);
|
|
|
|
/* Catch any unwinding errors. */
|
|
TRY_CATCH (except, RETURN_MASK_ERROR)
|
|
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S
|
|
new file mode 100644
|
|
index 0000000..25397e9
|
|
--- /dev/null
|
|
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.S
|
|
@@ -0,0 +1,694 @@
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
+
|
|
+ Copyright 2013 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 source file was generated by:
|
|
+ gcc -o gdb.arch/amd64-tailcall-noret.S gdb.arch/amd64-tailcall-noret.c -Wall -S -dA -O2 -g
|
|
+ */
|
|
+
|
|
+ .file "amd64-tailcall-noret.c"
|
|
+ .text
|
|
+.Ltext0:
|
|
+ .section .text.unlikely,"ax",@progbits
|
|
+ .type noret, @function
|
|
+noret:
|
|
+.LFB9:
|
|
+ .file 1 "gdb.arch/amd64-tailcall-noret.c"
|
|
+ # gdb.arch/amd64-tailcall-noret.c:24
|
|
+ .loc 1 24 0
|
|
+ .cfi_startproc
|
|
+.LVL0:
|
|
+# BLOCK 2 freq:10000 seq:0
|
|
+# PRED: ENTRY [100.0%] (fallthru)
|
|
+ pushq %rax
|
|
+.LCFI0:
|
|
+ .cfi_def_cfa_offset 16
|
|
+ # gdb.arch/amd64-tailcall-noret.c:25
|
|
+ .loc 1 25 0
|
|
+ call abort
|
|
+.LVL1:
|
|
+# SUCC:
|
|
+ .cfi_endproc
|
|
+.LFE9:
|
|
+ .size noret, .-noret
|
|
+ .text
|
|
+ .p2align 4,,15
|
|
+ .type mayret, @function
|
|
+mayret:
|
|
+.LFB10:
|
|
+ # gdb.arch/amd64-tailcall-noret.c:30
|
|
+ .loc 1 30 0
|
|
+ .cfi_startproc
|
|
+.LVL2:
|
|
+# BLOCK 2 freq:10000 seq:0
|
|
+# PRED: ENTRY [100.0%] (fallthru)
|
|
+ # gdb.arch/amd64-tailcall-noret.c:31
|
|
+ .loc 1 31 0
|
|
+ movl v(%rip), %eax
|
|
+ testl %eax, %eax
|
|
+# SUCC: 4 [0.0%] (can_fallthru) 3 [100.0%] (fallthru,can_fallthru)
|
|
+ jne .L8
|
|
+# BLOCK 3 freq:9996 seq:1
|
|
+# PRED: 2 [100.0%] (fallthru,can_fallthru)
|
|
+# SUCC: EXIT [100.0%]
|
|
+ rep
|
|
+ ret
|
|
+# BLOCK 4 freq:4 seq:2
|
|
+# PRED: 2 [0.0%] (can_fallthru)
|
|
+.L8:
|
|
+ # gdb.arch/amd64-tailcall-noret.c:30
|
|
+ .loc 1 30 0
|
|
+ pushq %rdx
|
|
+.LCFI1:
|
|
+ .cfi_def_cfa_offset 16
|
|
+ # gdb.arch/amd64-tailcall-noret.c:32
|
|
+ .loc 1 32 0
|
|
+ xorl %eax, %eax
|
|
+ call noret
|
|
+.LVL3:
|
|
+# SUCC:
|
|
+ .cfi_endproc
|
|
+.LFE10:
|
|
+ .size mayret, .-mayret
|
|
+ .p2align 4,,15
|
|
+ .type tailcall, @function
|
|
+tailcall:
|
|
+.LFB11:
|
|
+ # gdb.arch/amd64-tailcall-noret.c:37
|
|
+ .loc 1 37 0
|
|
+ .cfi_startproc
|
|
+.LVL4:
|
|
+# BLOCK 2 freq:10000 seq:0
|
|
+# PRED: ENTRY [100.0%] (fallthru)
|
|
+ # gdb.arch/amd64-tailcall-noret.c:38
|
|
+ .loc 1 38 0
|
|
+ jmp mayret
|
|
+.LVL5:
|
|
+# SUCC: EXIT [100.0%] (ab,sibcall)
|
|
+ .cfi_endproc
|
|
+.LFE11:
|
|
+ .size tailcall, .-tailcall
|
|
+ .section .text.startup,"ax",@progbits
|
|
+ .p2align 4,,15
|
|
+ .globl main
|
|
+ .type main, @function
|
|
+main:
|
|
+.LFB12:
|
|
+ # gdb.arch/amd64-tailcall-noret.c:43
|
|
+ .loc 1 43 0
|
|
+ .cfi_startproc
|
|
+# BLOCK 2 freq:10000 seq:0
|
|
+# PRED: ENTRY [100.0%] (fallthru)
|
|
+ subq $8, %rsp
|
|
+.LCFI2:
|
|
+ .cfi_def_cfa_offset 16
|
|
+ # gdb.arch/amd64-tailcall-noret.c:44
|
|
+ .loc 1 44 0
|
|
+ movl $1, %edi
|
|
+ call tailcall
|
|
+.LVL6:
|
|
+ # gdb.arch/amd64-tailcall-noret.c:46
|
|
+ .loc 1 46 0
|
|
+ xorl %eax, %eax
|
|
+ addq $8, %rsp
|
|
+.LCFI3:
|
|
+ .cfi_def_cfa_offset 8
|
|
+# SUCC: EXIT [100.0%]
|
|
+ ret
|
|
+ .cfi_endproc
|
|
+.LFE12:
|
|
+ .size main, .-main
|
|
+ .globl v
|
|
+ .data
|
|
+ .align 4
|
|
+ .type v, @object
|
|
+ .size v, 4
|
|
+v:
|
|
+ .long 1
|
|
+ .text
|
|
+.Letext0:
|
|
+ .file 2 "/usr/include/stdlib.h"
|
|
+ .section .debug_info,"",@progbits
|
|
+.Ldebug_info0:
|
|
+ .long 0x19d # 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 .LASF14 # DW_AT_producer: "GNU C 4.7.3 20130221 (prerelease)"
|
|
+ .byte 0x1 # DW_AT_language
|
|
+ .long .LASF15 # DW_AT_name: "gdb.arch/amd64-tailcall-noret.c"
|
|
+ .long .LASF16 # DW_AT_comp_dir: ""
|
|
+ .long .Ldebug_ranges0+0 # DW_AT_ranges
|
|
+ .quad 0 # DW_AT_low_pc
|
|
+ .quad 0 # DW_AT_entry_pc
|
|
+ .long .Ldebug_line0 # DW_AT_stmt_list
|
|
+ .uleb128 0x2 # (DIE (0x31) DW_TAG_base_type)
|
|
+ .byte 0x8 # DW_AT_byte_size
|
|
+ .byte 0x7 # DW_AT_encoding
|
|
+ .long .LASF0 # DW_AT_name: "long unsigned int"
|
|
+ .uleb128 0x3 # (DIE (0x38) DW_TAG_base_type)
|
|
+ .byte 0x4 # DW_AT_byte_size
|
|
+ .byte 0x5 # DW_AT_encoding
|
|
+ .ascii "int\0" # DW_AT_name
|
|
+ .uleb128 0x2 # (DIE (0x3f) DW_TAG_base_type)
|
|
+ .byte 0x1 # DW_AT_byte_size
|
|
+ .byte 0x8 # DW_AT_encoding
|
|
+ .long .LASF1 # DW_AT_name: "unsigned char"
|
|
+ .uleb128 0x2 # (DIE (0x46) DW_TAG_base_type)
|
|
+ .byte 0x2 # DW_AT_byte_size
|
|
+ .byte 0x7 # DW_AT_encoding
|
|
+ .long .LASF2 # DW_AT_name: "short unsigned int"
|
|
+ .uleb128 0x2 # (DIE (0x4d) DW_TAG_base_type)
|
|
+ .byte 0x4 # DW_AT_byte_size
|
|
+ .byte 0x7 # DW_AT_encoding
|
|
+ .long .LASF3 # DW_AT_name: "unsigned int"
|
|
+ .uleb128 0x2 # (DIE (0x54) DW_TAG_base_type)
|
|
+ .byte 0x1 # DW_AT_byte_size
|
|
+ .byte 0x6 # DW_AT_encoding
|
|
+ .long .LASF4 # DW_AT_name: "signed char"
|
|
+ .uleb128 0x2 # (DIE (0x5b) DW_TAG_base_type)
|
|
+ .byte 0x2 # DW_AT_byte_size
|
|
+ .byte 0x5 # DW_AT_encoding
|
|
+ .long .LASF5 # DW_AT_name: "short int"
|
|
+ .uleb128 0x2 # (DIE (0x62) DW_TAG_base_type)
|
|
+ .byte 0x8 # DW_AT_byte_size
|
|
+ .byte 0x5 # DW_AT_encoding
|
|
+ .long .LASF6 # DW_AT_name: "long int"
|
|
+ .uleb128 0x2 # (DIE (0x69) DW_TAG_base_type)
|
|
+ .byte 0x8 # DW_AT_byte_size
|
|
+ .byte 0x7 # DW_AT_encoding
|
|
+ .long .LASF7 # DW_AT_name: "sizetype"
|
|
+ .uleb128 0x2 # (DIE (0x70) DW_TAG_base_type)
|
|
+ .byte 0x1 # DW_AT_byte_size
|
|
+ .byte 0x6 # DW_AT_encoding
|
|
+ .long .LASF8 # DW_AT_name: "char"
|
|
+ .uleb128 0x2 # (DIE (0x77) DW_TAG_base_type)
|
|
+ .byte 0x8 # DW_AT_byte_size
|
|
+ .byte 0x5 # DW_AT_encoding
|
|
+ .long .LASF9 # DW_AT_name: "long long int"
|
|
+ .uleb128 0x2 # (DIE (0x7e) DW_TAG_base_type)
|
|
+ .byte 0x8 # DW_AT_byte_size
|
|
+ .byte 0x7 # DW_AT_encoding
|
|
+ .long .LASF10 # DW_AT_name: "long long unsigned int"
|
|
+ .uleb128 0x4 # (DIE (0x85) DW_TAG_volatile_type)
|
|
+ .long 0x38 # DW_AT_type
|
|
+ .uleb128 0x5 # (DIE (0x8a) DW_TAG_subprogram)
|
|
+ .long .LASF11 # DW_AT_name: "noret"
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x17 # DW_AT_decl_line
|
|
+ .byte 0x1 # DW_AT_prototyped
|
|
+ .quad .LFB9 # DW_AT_low_pc
|
|
+ .quad .LFE9 # DW_AT_high_pc
|
|
+ .long .LLST0 # DW_AT_frame_base
|
|
+ .byte 0x1 # DW_AT_GNU_all_call_sites
|
|
+ .long 0xc7 # DW_AT_sibling
|
|
+ .uleb128 0x6 # (DIE (0xab) DW_TAG_formal_parameter)
|
|
+ .ascii "x\0" # DW_AT_name
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x17 # DW_AT_decl_line
|
|
+ .long 0x38 # DW_AT_type
|
|
+ .long .LLST1 # DW_AT_location
|
|
+ .uleb128 0x7 # (DIE (0xb8) DW_TAG_unspecified_parameters)
|
|
+ .uleb128 0x8 # (DIE (0xb9) DW_TAG_GNU_call_site)
|
|
+ .quad .LVL1 # DW_AT_low_pc
|
|
+ .long 0x195 # DW_AT_abstract_origin
|
|
+ .byte 0 # end of children of DIE 0x8a
|
|
+ .uleb128 0x5 # (DIE (0xc7) DW_TAG_subprogram)
|
|
+ .long .LASF12 # DW_AT_name: "mayret"
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x1d # DW_AT_decl_line
|
|
+ .byte 0x1 # DW_AT_prototyped
|
|
+ .quad .LFB10 # DW_AT_low_pc
|
|
+ .quad .LFE10 # DW_AT_high_pc
|
|
+ .long .LLST2 # DW_AT_frame_base
|
|
+ .byte 0x1 # DW_AT_GNU_all_call_sites
|
|
+ .long 0x103 # DW_AT_sibling
|
|
+ .uleb128 0x6 # (DIE (0xe8) DW_TAG_formal_parameter)
|
|
+ .ascii "x\0" # DW_AT_name
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x1d # DW_AT_decl_line
|
|
+ .long 0x38 # DW_AT_type
|
|
+ .long .LLST3 # DW_AT_location
|
|
+ .uleb128 0x8 # (DIE (0xf5) DW_TAG_GNU_call_site)
|
|
+ .quad .LVL3 # DW_AT_low_pc
|
|
+ .long 0x8a # DW_AT_abstract_origin
|
|
+ .byte 0 # end of children of DIE 0xc7
|
|
+ .uleb128 0x9 # (DIE (0x103) DW_TAG_subprogram)
|
|
+ .long .LASF13 # DW_AT_name: "tailcall"
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x24 # DW_AT_decl_line
|
|
+ .byte 0x1 # DW_AT_prototyped
|
|
+ .quad .LFB11 # DW_AT_low_pc
|
|
+ .quad .LFE11 # DW_AT_high_pc
|
|
+ .byte 0x2 # DW_AT_frame_base
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 8
|
|
+ .byte 0x1 # DW_AT_GNU_all_call_sites
|
|
+ .long 0x147 # DW_AT_sibling
|
|
+ .uleb128 0x6 # (DIE (0x123) DW_TAG_formal_parameter)
|
|
+ .ascii "x\0" # DW_AT_name
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x24 # DW_AT_decl_line
|
|
+ .long 0x38 # DW_AT_type
|
|
+ .long .LLST4 # DW_AT_location
|
|
+ .uleb128 0xa # (DIE (0x130) DW_TAG_GNU_call_site)
|
|
+ .quad .LVL5 # DW_AT_low_pc
|
|
+ .byte 0x1 # DW_AT_GNU_tail_call
|
|
+ .long 0xc7 # DW_AT_abstract_origin
|
|
+ .uleb128 0xb # (DIE (0x13e) DW_TAG_GNU_call_site_parameter)
|
|
+ .byte 0x1 # DW_AT_location
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0x3 # DW_AT_GNU_call_site_value
|
|
+ .byte 0xf3 # DW_OP_GNU_entry_value
|
|
+ .uleb128 0x1
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0 # end of children of DIE 0x130
|
|
+ .byte 0 # end of children of DIE 0x103
|
|
+ .uleb128 0xc # (DIE (0x147) DW_TAG_subprogram)
|
|
+ .byte 0x1 # DW_AT_external
|
|
+ .long .LASF17 # DW_AT_name: "main"
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x2a # DW_AT_decl_line
|
|
+ .byte 0x1 # DW_AT_prototyped
|
|
+ .long 0x38 # DW_AT_type
|
|
+ .quad .LFB12 # DW_AT_low_pc
|
|
+ .quad .LFE12 # DW_AT_high_pc
|
|
+ .long .LLST5 # DW_AT_frame_base
|
|
+ .byte 0x1 # DW_AT_GNU_all_call_sites
|
|
+ .long 0x181 # DW_AT_sibling
|
|
+ .uleb128 0xd # (DIE (0x16d) DW_TAG_GNU_call_site)
|
|
+ .quad .LVL6 # DW_AT_low_pc
|
|
+ .long 0x103 # DW_AT_abstract_origin
|
|
+ .uleb128 0xb # (DIE (0x17a) DW_TAG_GNU_call_site_parameter)
|
|
+ .byte 0x1 # DW_AT_location
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0x1 # DW_AT_GNU_call_site_value
|
|
+ .byte 0x31 # DW_OP_lit1
|
|
+ .byte 0 # end of children of DIE 0x16d
|
|
+ .byte 0 # end of children of DIE 0x147
|
|
+ .uleb128 0xe # (DIE (0x181) DW_TAG_variable)
|
|
+ .ascii "v\0" # DW_AT_name
|
|
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-tailcall-noret.c)
|
|
+ .byte 0x14 # DW_AT_decl_line
|
|
+ .long 0x85 # DW_AT_type
|
|
+ .byte 0x1 # DW_AT_external
|
|
+ .byte 0x9 # DW_AT_location
|
|
+ .byte 0x3 # DW_OP_addr
|
|
+ .quad v
|
|
+ .uleb128 0xf # (DIE (0x195) DW_TAG_subprogram)
|
|
+ .byte 0x1 # DW_AT_external
|
|
+ .long .LASF18 # DW_AT_name: "abort"
|
|
+ .byte 0x2 # DW_AT_decl_file (/usr/include/stdlib.h)
|
|
+ .value 0x202 # DW_AT_decl_line
|
|
+ .byte 0x1 # DW_AT_prototyped
|
|
+ .byte 0x1 # DW_AT_declaration
|
|
+ .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 0x55 # (DW_AT_ranges)
|
|
+ .uleb128 0x6 # (DW_FORM_data4)
|
|
+ .uleb128 0x11 # (DW_AT_low_pc)
|
|
+ .uleb128 0x1 # (DW_FORM_addr)
|
|
+ .uleb128 0x52 # (DW_AT_entry_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 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
|
|
+ .uleb128 0x5 # (abbrev code)
|
|
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
|
|
+ .byte 0x1 # DW_children_yes
|
|
+ .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 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 0x2117 # (DW_AT_GNU_all_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 0x6 # (DW_FORM_data4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0x7 # (abbrev code)
|
|
+ .uleb128 0x18 # (TAG: DW_TAG_unspecified_parameters)
|
|
+ .byte 0 # DW_children_no
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0x8 # (abbrev code)
|
|
+ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
|
|
+ .byte 0 # DW_children_no
|
|
+ .uleb128 0x11 # (DW_AT_low_pc)
|
|
+ .uleb128 0x1 # (DW_FORM_addr)
|
|
+ .uleb128 0x31 # (DW_AT_abstract_origin)
|
|
+ .uleb128 0x13 # (DW_FORM_ref4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0x9 # (abbrev code)
|
|
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
|
|
+ .byte 0x1 # DW_children_yes
|
|
+ .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 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 0xa # (DW_FORM_block1)
|
|
+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .uleb128 0x1 # (DW_AT_sibling)
|
|
+ .uleb128 0x13 # (DW_FORM_ref4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xa # (abbrev code)
|
|
+ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
|
|
+ .byte 0x1 # DW_children_yes
|
|
+ .uleb128 0x11 # (DW_AT_low_pc)
|
|
+ .uleb128 0x1 # (DW_FORM_addr)
|
|
+ .uleb128 0x2115 # (DW_AT_GNU_tail_call)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .uleb128 0x31 # (DW_AT_abstract_origin)
|
|
+ .uleb128 0x13 # (DW_FORM_ref4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xb # (abbrev code)
|
|
+ .uleb128 0x410a # (TAG: DW_TAG_GNU_call_site_parameter)
|
|
+ .byte 0 # DW_children_no
|
|
+ .uleb128 0x2 # (DW_AT_location)
|
|
+ .uleb128 0xa # (DW_FORM_block1)
|
|
+ .uleb128 0x2111 # (DW_AT_GNU_call_site_value)
|
|
+ .uleb128 0xa # (DW_FORM_block1)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xc # (abbrev code)
|
|
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
|
|
+ .byte 0x1 # DW_children_yes
|
|
+ .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 0x2117 # (DW_AT_GNU_all_call_sites)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .uleb128 0x1 # (DW_AT_sibling)
|
|
+ .uleb128 0x13 # (DW_FORM_ref4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xd # (abbrev code)
|
|
+ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
|
|
+ .byte 0x1 # DW_children_yes
|
|
+ .uleb128 0x11 # (DW_AT_low_pc)
|
|
+ .uleb128 0x1 # (DW_FORM_addr)
|
|
+ .uleb128 0x31 # (DW_AT_abstract_origin)
|
|
+ .uleb128 0x13 # (DW_FORM_ref4)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xe # (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 0x3f # (DW_AT_external)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .uleb128 0x2 # (DW_AT_location)
|
|
+ .uleb128 0xa # (DW_FORM_block1)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .uleb128 0xf # (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 0x5 # (DW_FORM_data2)
|
|
+ .uleb128 0x27 # (DW_AT_prototyped)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .uleb128 0x3c # (DW_AT_declaration)
|
|
+ .uleb128 0xc # (DW_FORM_flag)
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .byte 0
|
|
+ .section .debug_loc,"",@progbits
|
|
+.Ldebug_loc0:
|
|
+.LLST0:
|
|
+ .quad .LFB9 # Location list begin address (*.LLST0)
|
|
+ .quad .LCFI0 # Location list end address (*.LLST0)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 8
|
|
+ .quad .LCFI0 # Location list begin address (*.LLST0)
|
|
+ .quad .LFE9 # Location list end address (*.LLST0)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 16
|
|
+ .quad 0 # Location list terminator begin (*.LLST0)
|
|
+ .quad 0 # Location list terminator end (*.LLST0)
|
|
+.LLST1:
|
|
+ .quad .LVL0 # Location list begin address (*.LLST1)
|
|
+ .quad .LVL1-1 # Location list end address (*.LLST1)
|
|
+ .value 0x1 # Location expression size
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .quad .LVL1-1 # Location list begin address (*.LLST1)
|
|
+ .quad .LFE9 # Location list end address (*.LLST1)
|
|
+ .value 0x4 # Location expression size
|
|
+ .byte 0xf3 # DW_OP_GNU_entry_value
|
|
+ .uleb128 0x1
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0x9f # DW_OP_stack_value
|
|
+ .quad 0 # Location list terminator begin (*.LLST1)
|
|
+ .quad 0 # Location list terminator end (*.LLST1)
|
|
+.LLST2:
|
|
+ .quad .LFB10 # Location list begin address (*.LLST2)
|
|
+ .quad .LCFI1 # Location list end address (*.LLST2)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 8
|
|
+ .quad .LCFI1 # Location list begin address (*.LLST2)
|
|
+ .quad .LFE10 # Location list end address (*.LLST2)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 16
|
|
+ .quad 0 # Location list terminator begin (*.LLST2)
|
|
+ .quad 0 # Location list terminator end (*.LLST2)
|
|
+.LLST3:
|
|
+ .quad .LVL2 # Location list begin address (*.LLST3)
|
|
+ .quad .LVL3-1 # Location list end address (*.LLST3)
|
|
+ .value 0x1 # Location expression size
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .quad .LVL3-1 # Location list begin address (*.LLST3)
|
|
+ .quad .LFE10 # Location list end address (*.LLST3)
|
|
+ .value 0x4 # Location expression size
|
|
+ .byte 0xf3 # DW_OP_GNU_entry_value
|
|
+ .uleb128 0x1
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0x9f # DW_OP_stack_value
|
|
+ .quad 0 # Location list terminator begin (*.LLST3)
|
|
+ .quad 0 # Location list terminator end (*.LLST3)
|
|
+.LLST4:
|
|
+ .quad .LVL4 # Location list begin address (*.LLST4)
|
|
+ .quad .LVL5-1 # Location list end address (*.LLST4)
|
|
+ .value 0x1 # Location expression size
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .quad .LVL5-1 # Location list begin address (*.LLST4)
|
|
+ .quad .LFE11 # Location list end address (*.LLST4)
|
|
+ .value 0x4 # Location expression size
|
|
+ .byte 0xf3 # DW_OP_GNU_entry_value
|
|
+ .uleb128 0x1
|
|
+ .byte 0x55 # DW_OP_reg5
|
|
+ .byte 0x9f # DW_OP_stack_value
|
|
+ .quad 0 # Location list terminator begin (*.LLST4)
|
|
+ .quad 0 # Location list terminator end (*.LLST4)
|
|
+.LLST5:
|
|
+ .quad .LFB12 # Location list begin address (*.LLST5)
|
|
+ .quad .LCFI2 # Location list end address (*.LLST5)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 8
|
|
+ .quad .LCFI2 # Location list begin address (*.LLST5)
|
|
+ .quad .LCFI3 # Location list end address (*.LLST5)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 16
|
|
+ .quad .LCFI3 # Location list begin address (*.LLST5)
|
|
+ .quad .LFE12 # Location list end address (*.LLST5)
|
|
+ .value 0x2 # Location expression size
|
|
+ .byte 0x77 # DW_OP_breg7
|
|
+ .sleb128 8
|
|
+ .quad 0 # Location list terminator begin (*.LLST5)
|
|
+ .quad 0 # Location list terminator end (*.LLST5)
|
|
+ .section .debug_aranges,"",@progbits
|
|
+ .long 0x4c # 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 .LFB9 # Address
|
|
+ .quad .LFE9-.LFB9 # Length
|
|
+ .quad .LFB12 # Address
|
|
+ .quad .LFE12-.LFB12 # Length
|
|
+ .quad 0
|
|
+ .quad 0
|
|
+ .section .debug_ranges,"",@progbits
|
|
+.Ldebug_ranges0:
|
|
+ .quad .Ltext0 # Offset 0
|
|
+ .quad .Letext0
|
|
+ .quad .LFB9 # Offset 0x10
|
|
+ .quad .LFE9
|
|
+ .quad .LFB12 # Offset 0x20
|
|
+ .quad .LFE12
|
|
+ .quad 0
|
|
+ .quad 0
|
|
+ .section .debug_line,"",@progbits
|
|
+.Ldebug_line0:
|
|
+ .section .debug_str,"MS",@progbits,1
|
|
+.LASF9:
|
|
+ .string "long long int"
|
|
+.LASF14:
|
|
+ .string "GNU C 4.7.3 20130221 (prerelease)"
|
|
+.LASF3:
|
|
+ .string "unsigned int"
|
|
+.LASF17:
|
|
+ .string "main"
|
|
+.LASF0:
|
|
+ .string "long unsigned int"
|
|
+.LASF10:
|
|
+ .string "long long unsigned int"
|
|
+.LASF16:
|
|
+ .string ""
|
|
+.LASF13:
|
|
+ .string "tailcall"
|
|
+.LASF1:
|
|
+ .string "unsigned char"
|
|
+.LASF8:
|
|
+ .string "char"
|
|
+.LASF6:
|
|
+ .string "long int"
|
|
+.LASF11:
|
|
+ .string "noret"
|
|
+.LASF2:
|
|
+ .string "short unsigned int"
|
|
+.LASF4:
|
|
+ .string "signed char"
|
|
+.LASF12:
|
|
+ .string "mayret"
|
|
+.LASF18:
|
|
+ .string "abort"
|
|
+.LASF5:
|
|
+ .string "short int"
|
|
+.LASF7:
|
|
+ .string "sizetype"
|
|
+.LASF15:
|
|
+ .string "gdb.arch/amd64-tailcall-noret.c"
|
|
+ .ident "GCC: (GNU) 4.7.3 20130221 (prerelease)"
|
|
+ .section .note.GNU-stack,"",@progbits
|
|
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c
|
|
new file mode 100644
|
|
index 0000000..6a84c76
|
|
--- /dev/null
|
|
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.c
|
|
@@ -0,0 +1,46 @@
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
+
|
|
+ Copyright 2013 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 <stdlib.h>
|
|
+
|
|
+volatile int v = 1;
|
|
+
|
|
+static __attribute__ ((noinline, noclone, noreturn)) void
|
|
+noret (int x, ...)
|
|
+{
|
|
+ abort ();
|
|
+}
|
|
+
|
|
+static __attribute__ ((noinline, noclone)) void
|
|
+mayret (int x)
|
|
+{
|
|
+ if (v)
|
|
+ noret (x);
|
|
+}
|
|
+
|
|
+static __attribute__ ((noinline, noclone)) void
|
|
+tailcall (int x)
|
|
+{
|
|
+ mayret (x);
|
|
+}
|
|
+
|
|
+int
|
|
+main (void)
|
|
+{
|
|
+ tailcall (1);
|
|
+ return 0;
|
|
+}
|
|
diff --git a/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
|
|
new file mode 100644
|
|
index 0000000..cd15596
|
|
--- /dev/null
|
|
+++ b/gdb/testsuite/gdb.arch/amd64-tailcall-noret.exp
|
|
@@ -0,0 +1,36 @@
|
|
+# Copyright (C) 2012-2013 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-tailcall-noret.exp COMPILE=1"
|
|
+ standard_testfile
|
|
+ lappend opts debug optimize=-O2
|
|
+} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
|
|
+ verbose "Skipping ${testfile}."
|
|
+ return
|
|
+}
|
|
+
|
|
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } {
|
|
+ return -1
|
|
+}
|
|
+
|
|
+if ![runto noret] {
|
|
+ return -1
|
|
+}
|
|
+
|
|
+gdb_test "bt" "#0 +noret \\(x=1\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in mayret \\(x=x@entry=1\\) at \[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in tailcall \\(x=x@entry=1\\) at \[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in main \\(\\) at .*"
|
|
|