From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27818 invoked by alias); 7 Jul 2011 21:17:02 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 27784 invoked by uid 9674); 7 Jul 2011 21:17:01 -0000 Date: Thu, 07 Jul 2011 21:17:00 -0000 Message-ID: <20110707211701.27768.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-entryval: +testcase X-Git-Refname: refs/heads/archer-jankratochvil-entryval X-Git-Reftype: branch X-Git-Oldrev: 5338cf4fd4d6743ec1f5dff3ef4cdcc5a5f3ce22 X-Git-Newrev: 25fbe602f290d6b1007fe9bc79ef1b7325b4b146 X-SW-Source: 2011-q3/txt/msg00006.txt.bz2 List-Id: The branch, archer-jankratochvil-entryval has been updated via 25fbe602f290d6b1007fe9bc79ef1b7325b4b146 (commit) from 5338cf4fd4d6743ec1f5dff3ef4cdcc5a5f3ce22 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 25fbe602f290d6b1007fe9bc79ef1b7325b4b146 Author: Jan Kratochvil Date: Thu Jul 7 23:16:49 2011 +0200 +testcase ----------------------------------------------------------------------- Summary of changes: gdb/testsuite/gdb.arch/amd64-entry-value.c | 62 +++ gdb/testsuite/gdb.arch/amd64-entry-value.exp | 57 ++ gdb/testsuite/gdb.arch/amd64-entry-value.s | 728 ++++++++++++++++++++++++++ 3 files changed, 847 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/amd64-entry-value.c create mode 100644 gdb/testsuite/gdb.arch/amd64-entry-value.exp create mode 100644 gdb/testsuite/gdb.arch/amd64-entry-value.s First 500 lines of diff: diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.c b/gdb/testsuite/gdb.arch/amd64-entry-value.c new file mode 100644 index 0000000..2e9eed2 --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.c @@ -0,0 +1,62 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 . */ + +static volatile int v; + +static void __attribute__((noinline, noclone)) +e (int i) +{ + v = 0; +} + +static void __attribute__((noinline, noclone)) +d (int i) +{ + i++; + e (i); + e (v); +asm ("breakhere:"); +} + +static void __attribute__((noinline, noclone)) +c (int i) +{ + d (i * 10); +} + +static void __attribute__((noinline, noclone)) +a (int i) +{ + c (i + 1); +} + +static void __attribute__((noinline, noclone)) +b (int i) +{ + c (i + 2); +} + +int +main (void) +{ + d (30); + if (v) + a (1); + else + b (5); + return 0; +} diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp new file mode 100644 index 0000000..edf38f8 --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -0,0 +1,57 @@ +# Copyright (C) 2011 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 . + +if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { + verbose "Skipping amd64-entry-value." + return +} + +set testfile amd64-entry-value +if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.s {}] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +gdb_breakpoint "breakhere" + + +# Test @entry values. + +gdb_continue_to_breakpoint "breakhere" + +# (gdb) bt full +# #0 d (i=31) at gdb.arch/amd64-entry-value.c:33 +# i@entry = 30 +# #1 0x00000000004003da in main () at gdb.arch/amd64-entry-value.c:56 +# No locals. +gdb_test "bt full" "^bt full\r\n#0 +d *\\(i=31\\) \[^\r\n\]*\r\n\[ \t\]*i@entry = 30\r\n#1 +0x\[0-9a-f\]+ in main .*" +gdb_test "p i" " = 31" +gdb_test "p i@entry" " = 30" + + +# Test virtual tail call frames. + +gdb_continue_to_breakpoint "breakhere" + +# #0 d (i=71) at gdb.arch/amd64-entry-value.c:33 +# #1 0x0000000000400527 in c (i=7) at gdb.arch/amd64-entry-value.c:38 +# #2 0x0000000000400545 in b (i=5) at gdb.arch/amd64-entry-value.c:50 +# #3 0x00000000004003ee in main () at gdb.arch/amd64-entry-value.c:60 +gdb_test "bt" "^bt\r\n#0 +d *\\(i=71\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in c \\(i=7\\) \[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in b \\(i=5\\) \[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in main \[^\r\n\]*" +gdb_test "p i" " = 71" +gdb_test "p i@entry" " = 70" diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.s b/gdb/testsuite/gdb.arch/amd64-entry-value.s new file mode 100644 index 0000000..3f2320a --- /dev/null +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.s @@ -0,0 +1,728 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 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 . */ + +/* This file is compiled form gdb.arch/amd64-entry-value.c + using -g -dA -S -O2. */ + + .file "entry-value.c" + .text +.Ltext0: + .p2align 4,,15 + .type e, @function +e: +.LFB0: + .file 1 "gdb.arch/amd64-entry-value.c" + # gdb.arch/amd64-entry-value.c:22 + .loc 1 22 0 + .cfi_startproc +.LVL0: +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:23 + .loc 1 23 0 + movl $0, v(%rip) +# SUCC: EXIT [100.0%] + # gdb.arch/amd64-entry-value.c:24 + .loc 1 24 0 + ret + .cfi_endproc +.LFE0: + .size e, .-e + .p2align 4,,15 + .type d, @function +d: +.LFB1: + # gdb.arch/amd64-entry-value.c:28 + .loc 1 28 0 + .cfi_startproc +.LVL1: +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:29 + .loc 1 29 0 + addl $1, %edi +.LVL2: + # gdb.arch/amd64-entry-value.c:30 + .loc 1 30 0 + call e +.LVL3: + # gdb.arch/amd64-entry-value.c:31 + .loc 1 31 0 + movl v(%rip), %edi + call e +.LVL4: + # gdb.arch/amd64-entry-value.c:32 + .loc 1 32 0 +#APP +# 32 "gdb.arch/amd64-entry-value.c" 1 + breakhere: +# 0 "" 2 +# SUCC: EXIT [100.0%] + # gdb.arch/amd64-entry-value.c:33 + .loc 1 33 0 +#NO_APP + ret + .cfi_endproc +.LFE1: + .size d, .-d + .p2align 4,,15 + .type c, @function +c: +.LFB2: + # gdb.arch/amd64-entry-value.c:37 + .loc 1 37 0 + .cfi_startproc +.LVL5: +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:38 + .loc 1 38 0 + leal (%rdi,%rdi,4), %edi +.LVL6: + addl %edi, %edi + jmp d +# SUCC: EXIT [100.0%] (ab,sibcall) +.LVL7: + .cfi_endproc +.LFE2: + .size c, .-c + .p2align 4,,15 + .type a, @function +a: +.LFB3: + # gdb.arch/amd64-entry-value.c:43 + .loc 1 43 0 + .cfi_startproc +.LVL8: +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:44 + .loc 1 44 0 + addl $1, %edi +.LVL9: + jmp c +.LVL10: +# SUCC: EXIT [100.0%] (ab,sibcall) + .cfi_endproc +.LFE3: + .size a, .-a + .p2align 4,,15 + .type b, @function +b: +.LFB4: + # gdb.arch/amd64-entry-value.c:49 + .loc 1 49 0 + .cfi_startproc +.LVL11: +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:50 + .loc 1 50 0 + addl $2, %edi +.LVL12: + jmp c +.LVL13: +# SUCC: EXIT [100.0%] (ab,sibcall) + .cfi_endproc +.LFE4: + .size b, .-b + .section .text.startup,"ax",@progbits + .p2align 4,,15 + .globl main + .type main, @function +main: +.LFB5: + # gdb.arch/amd64-entry-value.c:55 + .loc 1 55 0 + .cfi_startproc +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (fallthru) + # gdb.arch/amd64-entry-value.c:56 + .loc 1 56 0 + movl $30, %edi + call d +.LVL14: + # gdb.arch/amd64-entry-value.c:57 + .loc 1 57 0 + movl v(%rip), %eax + testl %eax, %eax +# SUCC: 5 [39.0%] (can_fallthru) 3 [61.0%] (fallthru,can_fallthru) + jne .L10 +# BLOCK 3 freq:6100 seq:1 +# PRED: 2 [61.0%] (fallthru,can_fallthru) + # gdb.arch/amd64-entry-value.c:60 + .loc 1 60 0 + movl $5, %edi + call b +# SUCC: 4 [100.0%] (fallthru,can_fallthru) +.LVL15: +# BLOCK 4 freq:10000 seq:2 +# PRED: 3 [100.0%] (fallthru,can_fallthru) 5 [100.0%] +.L8: + # gdb.arch/amd64-entry-value.c:62 + .loc 1 62 0 + xorl %eax, %eax +# SUCC: EXIT [100.0%] + ret +# BLOCK 5 freq:3900 seq:3 +# PRED: 2 [39.0%] (can_fallthru) +.L10: + # gdb.arch/amd64-entry-value.c:58 + .loc 1 58 0 + movl $1, %edi + call a +.LVL16: + .p2align 4,,2 +# SUCC: 4 [100.0%] + jmp .L8 + .cfi_endproc +.LFE5: + .size main, .-main + .local v + .comm v,4,4 + .text +.Letext0: + .section .debug_info,"",@progbits +.Ldebug_info0: + .long 0x200 # 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 .LASF0 # DW_AT_producer: "GNU C 4.7.0 20110707 (experimental)" + .byte 0x1 # DW_AT_language + .long .LASF1 # DW_AT_name: "gdb.arch/amd64-entry-value.c" + .long .LASF2 # 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_subprogram) + .ascii "e\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x15 # DW_AT_decl_line + .byte 0x1 # DW_AT_prototyped + .quad .LFB0 # DW_AT_low_pc + .quad .LFE0 # 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 0x5b # DW_AT_sibling + .uleb128 0x3 # (DIE (0x4f) DW_TAG_formal_parameter) + .ascii "i\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x15 # DW_AT_decl_line + .long 0x5b # DW_AT_type + .byte 0x1 # DW_AT_location + .byte 0x55 # DW_OP_reg5 + .byte 0 # end of children of DIE 0x31 + .uleb128 0x4 # (DIE (0x5b) DW_TAG_base_type) + .byte 0x4 # DW_AT_byte_size + .byte 0x5 # DW_AT_encoding + .ascii "int\0" # DW_AT_name + .uleb128 0x2 # (DIE (0x62) DW_TAG_subprogram) + .ascii "d\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x1b # DW_AT_decl_line + .byte 0x1 # DW_AT_prototyped + .quad .LFB1 # DW_AT_low_pc + .quad .LFE1 # 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 0xb6 # DW_AT_sibling + .uleb128 0x5 # (DIE (0x80) DW_TAG_formal_parameter) + .ascii "i\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x1b # DW_AT_decl_line + .long 0x5b # DW_AT_type + .long .LLST0 # DW_AT_location + .uleb128 0x6 # (DIE (0x8d) DW_TAG_GNU_call_site) + .quad .LVL3 # DW_AT_low_pc + .long 0x31 # DW_AT_abstract_origin + .long 0xa8 # DW_AT_sibling + .uleb128 0x7 # (DIE (0x9e) DW_TAG_GNU_call_site_parameter) + .byte 0x1 # DW_AT_location + .byte 0x55 # DW_OP_reg5 + .byte 0x5 # DW_AT_GNU_call_site_value + .byte 0xf3 # DW_OP_GNU_entry_value + .uleb128 0x1 + .byte 0x55 # DW_OP_reg5 + .byte 0x23 # DW_OP_plus_uconst + .uleb128 0x1 + .byte 0 # end of children of DIE 0x8d + .uleb128 0x8 # (DIE (0xa8) DW_TAG_GNU_call_site) + .quad .LVL4 # DW_AT_low_pc + .long 0x31 # DW_AT_abstract_origin + .byte 0 # end of children of DIE 0x62 + .uleb128 0x2 # (DIE (0xb6) DW_TAG_subprogram) + .ascii "c\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x24 # DW_AT_decl_line + .byte 0x1 # DW_AT_prototyped + .quad .LFB2 # DW_AT_low_pc + .quad .LFE2 # 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 0xfc # DW_AT_sibling + .uleb128 0x5 # (DIE (0xd4) DW_TAG_formal_parameter) + .ascii "i\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x24 # DW_AT_decl_line + .long 0x5b # DW_AT_type + .long .LLST1 # DW_AT_location + .uleb128 0x9 # (DIE (0xe1) DW_TAG_GNU_call_site) + .quad .LVL7 # DW_AT_low_pc + .byte 0x1 # DW_AT_GNU_tail_call + .long 0x62 # DW_AT_abstract_origin + .uleb128 0x7 # (DIE (0xef) DW_TAG_GNU_call_site_parameter) + .byte 0x1 # DW_AT_location + .byte 0x55 # DW_OP_reg5 + .byte 0x7 # DW_AT_GNU_call_site_value + .byte 0xf3 # DW_OP_GNU_entry_value + .uleb128 0x1 + .byte 0x55 # DW_OP_reg5 + .byte 0x35 # DW_OP_lit5 + .byte 0x1e # DW_OP_mul + .byte 0x31 # DW_OP_lit1 + .byte 0x24 # DW_OP_shl + .byte 0 # end of children of DIE 0xe1 + .byte 0 # end of children of DIE 0xb6 + .uleb128 0x2 # (DIE (0xfc) DW_TAG_subprogram) + .ascii "a\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x2a # DW_AT_decl_line + .byte 0x1 # DW_AT_prototyped + .quad .LFB3 # DW_AT_low_pc + .quad .LFE3 # 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 0x140 # DW_AT_sibling + .uleb128 0x5 # (DIE (0x11a) DW_TAG_formal_parameter) + .ascii "i\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x2a # DW_AT_decl_line + .long 0x5b # DW_AT_type + .long .LLST2 # DW_AT_location + .uleb128 0x9 # (DIE (0x127) DW_TAG_GNU_call_site) + .quad .LVL10 # DW_AT_low_pc + .byte 0x1 # DW_AT_GNU_tail_call + .long 0xb6 # DW_AT_abstract_origin + .uleb128 0x7 # (DIE (0x135) DW_TAG_GNU_call_site_parameter) + .byte 0x1 # DW_AT_location + .byte 0x55 # DW_OP_reg5 + .byte 0x5 # DW_AT_GNU_call_site_value + .byte 0xf3 # DW_OP_GNU_entry_value + .uleb128 0x1 + .byte 0x55 # DW_OP_reg5 + .byte 0x23 # DW_OP_plus_uconst + .uleb128 0x1 + .byte 0 # end of children of DIE 0x127 + .byte 0 # end of children of DIE 0xfc + .uleb128 0x2 # (DIE (0x140) DW_TAG_subprogram) + .ascii "b\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x30 # DW_AT_decl_line + .byte 0x1 # DW_AT_prototyped + .quad .LFB4 # DW_AT_low_pc + .quad .LFE4 # 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 0x184 # DW_AT_sibling + .uleb128 0x5 # (DIE (0x15e) DW_TAG_formal_parameter) + .ascii "i\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value.c) + .byte 0x30 # DW_AT_decl_line + .long 0x5b # DW_AT_type + .long .LLST3 # DW_AT_location + .uleb128 0x9 # (DIE (0x16b) DW_TAG_GNU_call_site) + .quad .LVL13 # DW_AT_low_pc + .byte 0x1 # DW_AT_GNU_tail_call + .long 0xb6 # DW_AT_abstract_origin hooks/post-receive -- Repository for Project Archer.