From 66849923d2f6505b691f24dcb15797f2e0d969ec Mon Sep 17 00:00:00 2001 From: Markus Metzger Date: Tue, 3 Feb 2015 16:42:41 +0100 Subject: [PATCH] btrace: fix tests for 32-bit The x86-record_goto.S assembly source file does not build on 32-bit. This breaks many tests that use this file. Split it into x86_64-record_goto.S and i686-record_goto.S. Luckily, we can use either one with the same test .exp file. It further turned out that most tests do not really need a fixed binary; they should work pretty well with a newly-compiled C program. The one thing that breaks this is the heavy use of "record goto" to navigate inside the recorded execution. Combine step.exp, next,exp, and finish.exp into a single test step.exp and use normal stepping and reverse-stepping commands for navigation. testsuite/ * gdb.btrace/next.exp: Merged into step.exp. * gdb.btrace/finish.exp: Merged into step.exp. * gdb.btrace/nexti.exp: Merged into stepi.exp. * gdb.btrace/step.exp: Use record_goto.c as test file. Avoid using "record goto" and checking the exact replay position. * gdb.btrace/stepi.exp: Choose test file based on target. Do not check for "Recording format" in "info record" output. * gdb.btrace/record_goto.exp: Choose test file based on target. * gdb.btrace/x86-record_goto.S: Renamed into ... * gdb.btrace/x86_64-record_goto.S: ... this. * gdb.btrace/i686-record_goto.S: New. * gdb.btrace/x86-tailcall.S: Renamed into ... * gdb.btrace/x86_64-tailcall.S: ... this. * gdb.btrace/i686-tailcall.S: New. * gdb.btrace/x86-tailcall.c: Renamed into ... * gdb.btrace/tailcall.c: ... this. Split "return ++answer" into two separate statements. Update test. * gdb.btrace/delta.exp: Use record_goto.c as test file. * gdb.btrace/gcore.exp: Use record_goto.c as test file. * gdb.btrace/nohist.exp: Use record_goto.c as test file. * gdb.btrace/tailcall.exp: Choose test file based on target. * gdb.btrace/Makefile.in: Remove next, finish, and nexti. --- gdb/testsuite/ChangeLog | 25 ++ gdb/testsuite/gdb.btrace/Makefile.in | 4 +- gdb/testsuite/gdb.btrace/delta.exp | 2 +- gdb/testsuite/gdb.btrace/finish.exp | 60 --- gdb/testsuite/gdb.btrace/gcore.exp | 2 +- gdb/testsuite/gdb.btrace/i686-record_goto.S | 384 ++++++++++++++++++ gdb/testsuite/gdb.btrace/i686-tailcall.S | 351 ++++++++++++++++ gdb/testsuite/gdb.btrace/next.exp | 78 ---- gdb/testsuite/gdb.btrace/nexti.exp | 78 ---- gdb/testsuite/gdb.btrace/nohist.exp | 2 +- gdb/testsuite/gdb.btrace/record_goto.exp | 19 +- gdb/testsuite/gdb.btrace/step.exp | 66 +-- gdb/testsuite/gdb.btrace/stepi.exp | 50 ++- .../gdb.btrace/{x86-tailcall.c => tailcall.c} | 4 +- gdb/testsuite/gdb.btrace/tailcall.exp | 54 +-- ...x86-record_goto.S => x86_64-record_goto.S} | 2 +- .../{x86-tailcall.S => x86_64-tailcall.S} | 304 ++++++++------ 17 files changed, 1057 insertions(+), 428 deletions(-) delete mode 100644 gdb/testsuite/gdb.btrace/finish.exp create mode 100644 gdb/testsuite/gdb.btrace/i686-record_goto.S create mode 100644 gdb/testsuite/gdb.btrace/i686-tailcall.S delete mode 100644 gdb/testsuite/gdb.btrace/next.exp delete mode 100644 gdb/testsuite/gdb.btrace/nexti.exp rename gdb/testsuite/gdb.btrace/{x86-tailcall.c => tailcall.c} (96%) rename gdb/testsuite/gdb.btrace/{x86-record_goto.S => x86_64-record_goto.S} (99%) rename gdb/testsuite/gdb.btrace/{x86-tailcall.S => x86_64-tailcall.S} (50%) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f066b8af80..e501b119b7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2015-03-25 Markus Metzger + + * gdb.btrace/next.exp: Merged into step.exp. + * gdb.btrace/finish.exp: Merged into step.exp. + * gdb.btrace/nexti.exp: Merged into stepi.exp. + * gdb.btrace/step.exp: Use record_goto.c as test file. Avoid using + "record goto" and checking the exact replay position. + * gdb.btrace/stepi.exp: Choose test file based on target. Do not + check for "Recording format" in "info record" output. + * gdb.btrace/record_goto.exp: Choose test file based on target. + * gdb.btrace/x86-record_goto.S: Renamed into ... + * gdb.btrace/x86_64-record_goto.S: ... this. + * gdb.btrace/i686-record_goto.S: New. + * gdb.btrace/x86-tailcall.S: Renamed into ... + * gdb.btrace/x86_64-tailcall.S: ... this. + * gdb.btrace/i686-tailcall.S: New. + * gdb.btrace/x86-tailcall.c: Renamed into ... + * gdb.btrace/tailcall.c: ... this. Split "return ++answer" into two + separate statements. Update test. + * gdb.btrace/delta.exp: Use record_goto.c as test file. + * gdb.btrace/gcore.exp: Use record_goto.c as test file. + * gdb.btrace/nohist.exp: Use record_goto.c as test file. + * gdb.btrace/tailcall.exp: Choose test file based on target. + * gdb.btrace/Makefile.in: Remove next, finish, and nexti. + 2015-03-25 Markus Metzger * gdb.btrace/exception.exp: Increase BTS buffer size. diff --git a/gdb/testsuite/gdb.btrace/Makefile.in b/gdb/testsuite/gdb.btrace/Makefile.in index ec00b5972d..c90794f11d 100644 --- a/gdb/testsuite/gdb.btrace/Makefile.in +++ b/gdb/testsuite/gdb.btrace/Makefile.in @@ -2,8 +2,8 @@ VPATH = @srcdir@ srcdir = @srcdir@ EXECUTABLES = enable function_call_history instruction_history tailcall \ - exception unknown_functions record_goto delta finish next nexti step \ - stepi multi-thread-step rn-dl-bind data + exception unknown_functions record_goto delta step stepi \ + multi-thread-step rn-dl-bind data MISCELLANEOUS = diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp index 38b6e268c6..fed22f11e9 100644 --- a/gdb/testsuite/gdb.btrace/delta.exp +++ b/gdb/testsuite/gdb.btrace/delta.exp @@ -21,7 +21,7 @@ if { [skip_btrace_tests] } { return -1 } # start inferior -standard_testfile x86-record_goto.S +standard_testfile record_goto.c if [prepare_for_testing delta.exp $testfile $srcfile] { return -1 } diff --git a/gdb/testsuite/gdb.btrace/finish.exp b/gdb/testsuite/gdb.btrace/finish.exp deleted file mode 100644 index 6881e3bd6c..0000000000 --- a/gdb/testsuite/gdb.btrace/finish.exp +++ /dev/null @@ -1,60 +0,0 @@ -# This testcase is part of GDB, the GNU debugger. -# -# Copyright 2013-2015 Free Software Foundation, Inc. -# -# Contributed by Intel Corp. -# -# 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 . - -# check for btrace support -if { [skip_btrace_tests] } { return -1 } - -# start inferior -standard_testfile x86-record_goto.S -if [prepare_for_testing finish.exp $testfile $srcfile] { - return -1 -} - -if ![runto_main] { - return -1 -} - -# trace the call to the test function -gdb_test_no_output "record btrace" -gdb_test "next" - -proc check_replay_at { insn } { - gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ - "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] -} - -# let's go somewhere where we can finish -gdb_test "record goto 32" ".*fun1\.1.*" -with_test_prefix "at 32" { check_replay_at 32 } - -gdb_test "finish" ".*fun2\.3.*" -with_test_prefix "finish into fun2" { check_replay_at 35 } - -gdb_test "reverse-finish" ".*fun3\.3.*" -with_test_prefix "reverse-finish into fun3" { check_replay_at 27 } - -gdb_test "finish" ".*fun4\.5.*" -with_test_prefix "finish into fun4" { check_replay_at 39 } - -gdb_test "reverse-finish" ".*main\.2.*" -with_test_prefix "reverse-finish into main" { check_replay_at 1 } diff --git a/gdb/testsuite/gdb.btrace/gcore.exp b/gdb/testsuite/gdb.btrace/gcore.exp index 8c4ada56b9..eb1a9c593c 100644 --- a/gdb/testsuite/gdb.btrace/gcore.exp +++ b/gdb/testsuite/gdb.btrace/gcore.exp @@ -21,7 +21,7 @@ if { [skip_btrace_tests] } { return -1 } # start inferior -standard_testfile x86-record_goto.S +standard_testfile record_goto.c if [prepare_for_testing gcore.exp $testfile $srcfile] { return -1 } diff --git a/gdb/testsuite/gdb.btrace/i686-record_goto.S b/gdb/testsuite/gdb.btrace/i686-record_goto.S new file mode 100644 index 0000000000..5aab2b1e2e --- /dev/null +++ b/gdb/testsuite/gdb.btrace/i686-record_goto.S @@ -0,0 +1,384 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013-2015 Free Software Foundation, Inc. + + Contributed by Intel Corp. + + 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 has been generated using: + gcc -S -dA -g record_goto.c -o i686-record_goto.S */ + + .file "record_goto.c" + .text +.Ltext0: + .globl fun1 + .type fun1, @function +fun1: +.LFB0: + .file 1 "record_goto.c" + # record_goto.c:22 + .loc 1 22 0 + .cfi_startproc +# BLOCK 2 seq:0 +# PRED: ENTRY (FALLTHRU) + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset 5, -8 + movl %esp, %ebp + .cfi_def_cfa_register 5 + # record_goto.c:23 + .loc 1 23 0 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE0: + .size fun1, .-fun1 + .globl fun2 + .type fun2, @function +fun2: +.LFB1: + # record_goto.c:27 + .loc 1 27 0 + .cfi_startproc +# BLOCK 2 seq:0 +# PRED: ENTRY (FALLTHRU) + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset 5, -8 + movl %esp, %ebp + .cfi_def_cfa_register 5 + # record_goto.c:28 + .loc 1 28 0 + call fun1 + # record_goto.c:29 + .loc 1 29 0 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE1: + .size fun2, .-fun2 + .globl fun3 + .type fun3, @function +fun3: +.LFB2: + # record_goto.c:33 + .loc 1 33 0 + .cfi_startproc +# BLOCK 2 seq:0 +# PRED: ENTRY (FALLTHRU) + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset 5, -8 + movl %esp, %ebp + .cfi_def_cfa_register 5 + # record_goto.c:34 + .loc 1 34 0 + call fun1 + # record_goto.c:35 + .loc 1 35 0 + call fun2 + # record_goto.c:36 + .loc 1 36 0 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE2: + .size fun3, .-fun3 + .globl fun4 + .type fun4, @function +fun4: +.LFB3: + # record_goto.c:40 + .loc 1 40 0 + .cfi_startproc +# BLOCK 2 seq:0 +# PRED: ENTRY (FALLTHRU) + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset 5, -8 + movl %esp, %ebp + .cfi_def_cfa_register 5 + # record_goto.c:41 + .loc 1 41 0 + call fun1 + # record_goto.c:42 + .loc 1 42 0 + call fun2 + # record_goto.c:43 + .loc 1 43 0 + call fun3 + # record_goto.c:44 + .loc 1 44 0 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE3: + .size fun4, .-fun4 + .globl main + .type main, @function +main: +.LFB4: + # record_goto.c:48 + .loc 1 48 0 + .cfi_startproc +# BLOCK 2 seq:0 +# PRED: ENTRY (FALLTHRU) + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset 5, -8 + movl %esp, %ebp + .cfi_def_cfa_register 5 + # record_goto.c:49 + .loc 1 49 0 + call fun4 + # record_goto.c:50 + .loc 1 50 0 + movl $0, %eax + # record_goto.c:51 + .loc 1 51 0 + popl %ebp + .cfi_restore 5 + .cfi_def_cfa 4, 4 +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE4: + .size main, .-main +.Letext0: + .section .debug_info,"",@progbits +.Ldebug_info0: + .long 0x82 # Length of Compilation Unit Info + .value 0x4 # DWARF version number + .long .Ldebug_abbrev0 # Offset Into Abbrev. Section + .byte 0x4 # Pointer Size (in bytes) + .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) + .long .LASF4 # DW_AT_producer: "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=i686 -g" + .byte 0x1 # DW_AT_language + .long .LASF5 # DW_AT_name: "record_goto.c" + .long .LASF6 # DW_AT_comp_dir: "" + .long .Ltext0 # DW_AT_low_pc + .long .Letext0-.Ltext0 # DW_AT_high_pc + .long .Ldebug_line0 # DW_AT_stmt_list + .uleb128 0x2 # (DIE (0x25) DW_TAG_subprogram) + # DW_AT_external + .long .LASF0 # DW_AT_name: "fun1" + .byte 0x1 # DW_AT_decl_file (record_goto.c) + .byte 0x15 # DW_AT_decl_line + # DW_AT_prototyped + .long .LFB0 # DW_AT_low_pc + .long .LFE0-.LFB0 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_call_sites + .uleb128 0x3 # (DIE (0x36) DW_TAG_subprogram) + # DW_AT_external + .long .LASF1 # DW_AT_name: "fun2" + .byte 0x1 # DW_AT_decl_file (record_goto.c) + .byte 0x1a # DW_AT_decl_line + # DW_AT_prototyped + .long .LFB1 # DW_AT_low_pc + .long .LFE1-.LFB1 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_tail_call_sites + .uleb128 0x3 # (DIE (0x47) DW_TAG_subprogram) + # DW_AT_external + .long .LASF2 # DW_AT_name: "fun3" + .byte 0x1 # DW_AT_decl_file (record_goto.c) + .byte 0x20 # DW_AT_decl_line + # DW_AT_prototyped + .long .LFB2 # DW_AT_low_pc + .long .LFE2-.LFB2 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_tail_call_sites + .uleb128 0x3 # (DIE (0x58) DW_TAG_subprogram) + # DW_AT_external + .long .LASF3 # DW_AT_name: "fun4" + .byte 0x1 # DW_AT_decl_file (record_goto.c) + .byte 0x27 # DW_AT_decl_line + # DW_AT_prototyped + .long .LFB3 # DW_AT_low_pc + .long .LFE3-.LFB3 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_tail_call_sites + .uleb128 0x4 # (DIE (0x69) DW_TAG_subprogram) + # DW_AT_external + .long .LASF7 # DW_AT_name: "main" + .byte 0x1 # DW_AT_decl_file (record_goto.c) + .byte 0x2f # DW_AT_decl_line + # DW_AT_prototyped + .long 0x7e # DW_AT_type + .long .LFB4 # DW_AT_low_pc + .long .LFE4-.LFB4 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_tail_call_sites + .uleb128 0x5 # (DIE (0x7e) DW_TAG_base_type) + .byte 0x4 # DW_AT_byte_size + .byte 0x5 # DW_AT_encoding + .ascii "int\0" # DW_AT_name + .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 0x6 # (DW_FORM_data4) + .uleb128 0x10 # (DW_AT_stmt_list) + .uleb128 0x17 # (DW_FORM_sec_offset) + .byte 0 + .byte 0 + .uleb128 0x2 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .byte 0 # DW_children_no + .uleb128 0x3f # (DW_AT_external) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 0x19 # (DW_FORM_flag_present) + .uleb128 0x11 # (DW_AT_low_pc) + .uleb128 0x1 # (DW_FORM_addr) + .uleb128 0x12 # (DW_AT_high_pc) + .uleb128 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .byte 0 + .byte 0 + .uleb128 0x3 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .byte 0 # DW_children_no + .uleb128 0x3f # (DW_AT_external) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 0x19 # (DW_FORM_flag_present) + .uleb128 0x11 # (DW_AT_low_pc) + .uleb128 0x1 # (DW_FORM_addr) + .uleb128 0x12 # (DW_AT_high_pc) + .uleb128 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .byte 0 + .byte 0 + .uleb128 0x4 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .byte 0 # DW_children_no + .uleb128 0x3f # (DW_AT_external) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 0x19 # (DW_FORM_flag_present) + .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 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .byte 0 + .byte 0 + .uleb128 0x5 # (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 + .byte 0 + .section .debug_aranges,"",@progbits + .long 0x1c # Length of Address Ranges Info + .value 0x2 # DWARF Version + .long .Ldebug_info0 # Offset of Compilation Unit Info + .byte 0x4 # Size of Address + .byte 0 # Size of Segment Descriptor + .value 0 # Pad to 8 byte boundary + .value 0 + .long .Ltext0 # Address + .long .Letext0-.Ltext0 # Length + .long 0 + .long 0 + .section .debug_line,"",@progbits +.Ldebug_line0: + .section .debug_str,"MS",@progbits,1 +.LASF3: + .string "fun4" +.LASF4: + .string "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=i686 -g" +.LASF7: + .string "main" +.LASF1: + .string "fun2" +.LASF5: + .string "record_goto.c" +.LASF0: + .string "fun1" +.LASF6: + .string "" +.LASF2: + .string "fun3" + .ident "GCC: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-7)" + .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.btrace/i686-tailcall.S b/gdb/testsuite/gdb.btrace/i686-tailcall.S new file mode 100644 index 0000000000..87311fccc3 --- /dev/null +++ b/gdb/testsuite/gdb.btrace/i686-tailcall.S @@ -0,0 +1,351 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013-2015 Free Software Foundation, Inc. + + Contributed by Intel Corp. + + 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 has been generated using: + gcc -S -O2 -dA -g tailcall.c -o i686-tailcall.S */ + + .file "tailcall.c" + .text +.Ltext0: + .p2align 4,,15 + .type bar, @function +bar: +.LFB0: + .file 1 "tailcall.c" + # tailcall.c:22 + .loc 1 22 0 + .cfi_startproc +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:24 + .loc 1 24 0 + movl $42, %eax +# SUCC: EXIT [100.0%] + ret + .cfi_endproc +.LFE0: + .size bar, .-bar + .p2align 4,,15 + .type foo, @function +foo: +.LFB1: + # tailcall.c:28 + .loc 1 28 0 + .cfi_startproc +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:29 + .loc 1 29 0 + jmp bar +# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL) +.LVL0: + .cfi_endproc +.LFE1: + .size foo, .-foo + .section .text.startup,"ax",@progbits + .p2align 4,,15 + .globl main + .type main, @function +main: +.LFB2: + # tailcall.c:34 + .loc 1 34 0 + .cfi_startproc +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:37 + .loc 1 37 0 + call foo +.LVL1: + # tailcall.c:38 + .loc 1 38 0 + addl $1, %eax +.LVL2: +# SUCC: EXIT [100.0%] + # tailcall.c:41 + .loc 1 41 0 + ret + .cfi_endproc +.LFE2: + .size main, .-main + .text +.Letext0: + .section .debug_info,"",@progbits +.Ldebug_info0: + .long 0x8f # Length of Compilation Unit Info + .value 0x4 # DWARF version number + .long .Ldebug_abbrev0 # Offset Into Abbrev. Section + .byte 0x4 # Pointer Size (in bytes) + .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) + .long .LASF0 # DW_AT_producer: "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=i686 -g -O2" + .byte 0x1 # DW_AT_language + .long .LASF1 # DW_AT_name: "tailcall.c" + .long .LASF2 # DW_AT_comp_dir: "" + .long .Ldebug_ranges0+0 # DW_AT_ranges + .long 0 # DW_AT_low_pc + .long .Ldebug_line0 # DW_AT_stmt_list + .uleb128 0x2 # (DIE (0x25) DW_TAG_subprogram) + .ascii "bar\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (tailcall.c) + .byte 0x15 # DW_AT_decl_line + # DW_AT_prototyped + .long 0x3a # DW_AT_type + .long .LFB0 # DW_AT_low_pc + .long .LFE0-.LFB0 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_call_sites + .uleb128 0x3 # (DIE (0x3a) DW_TAG_base_type) + .byte 0x4 # DW_AT_byte_size + .byte 0x5 # DW_AT_encoding + .ascii "int\0" # DW_AT_name + .uleb128 0x4 # (DIE (0x41) DW_TAG_subprogram) + .ascii "foo\0" # DW_AT_name + .byte 0x1 # DW_AT_decl_file (tailcall.c) + .byte 0x1b # DW_AT_decl_line + # DW_AT_prototyped + .long 0x3a # DW_AT_type + .long .LFB1 # DW_AT_low_pc + .long .LFE1-.LFB1 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_call_sites + .long 0x64 # DW_AT_sibling + .uleb128 0x5 # (DIE (0x5a) DW_TAG_GNU_call_site) + .long .LVL0 # DW_AT_low_pc + # DW_AT_GNU_tail_call + .long 0x25 # DW_AT_abstract_origin + .byte 0 # end of children of DIE 0x41 + .uleb128 0x6 # (DIE (0x64) DW_TAG_subprogram) + # DW_AT_external + .long .LASF3 # DW_AT_name: "main" + .byte 0x1 # DW_AT_decl_file (tailcall.c) + .byte 0x21 # DW_AT_decl_line + # DW_AT_prototyped + .long 0x3a # DW_AT_type + .long .LFB2 # DW_AT_low_pc + .long .LFE2-.LFB2 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base + .byte 0x9c # DW_OP_call_frame_cfa + # DW_AT_GNU_all_call_sites + .uleb128 0x7 # (DIE (0x79) DW_TAG_variable) + .long .LASF4 # DW_AT_name: "answer" + .byte 0x1 # DW_AT_decl_file (tailcall.c) + .byte 0x23 # DW_AT_decl_line + .long 0x3a # DW_AT_type + .long .LLST0 # DW_AT_location + .uleb128 0x8 # (DIE (0x88) DW_TAG_GNU_call_site) + .long .LVL1 # DW_AT_low_pc + .long 0x41 # DW_AT_abstract_origin + .byte 0 # end of children of DIE 0x64 + .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 0x17 # (DW_FORM_sec_offset) + .uleb128 0x11 # (DW_AT_low_pc) + .uleb128 0x1 # (DW_FORM_addr) + .uleb128 0x10 # (DW_AT_stmt_list) + .uleb128 0x17 # (DW_FORM_sec_offset) + .byte 0 + .byte 0 + .uleb128 0x2 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .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 0x27 # (DW_AT_prototyped) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 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 0x19 # (DW_FORM_flag_present) + .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 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x1 # (DW_AT_sibling) + .uleb128 0x13 # (DW_FORM_ref4) + .byte 0 + .byte 0 + .uleb128 0x5 # (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 0x2115 # (DW_AT_GNU_tail_call) + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x31 # (DW_AT_abstract_origin) + .uleb128 0x13 # (DW_FORM_ref4) + .byte 0 + .byte 0 + .uleb128 0x6 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .byte 0x1 # DW_children_yes + .uleb128 0x3f # (DW_AT_external) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 0x19 # (DW_FORM_flag_present) + .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 0x6 # (DW_FORM_data4) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .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 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 0x49 # (DW_AT_type) + .uleb128 0x13 # (DW_FORM_ref4) + .uleb128 0x2 # (DW_AT_location) + .uleb128 0x17 # (DW_FORM_sec_offset) + .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 + .byte 0 + .section .debug_loc,"",@progbits +.Ldebug_loc0: +.LLST0: + .long .LVL1 # Location list begin address (*.LLST0) + .long .LVL2 # Location list end address (*.LLST0) + .value 0x3 # Location expression size + .byte 0x70 # DW_OP_breg0 + .sleb128 1 + .byte 0x9f # DW_OP_stack_value + .long .LVL2 # Location list begin address (*.LLST0) + .long .LFE2 # Location list end address (*.LLST0) + .value 0x1 # Location expression size + .byte 0x50 # DW_OP_reg0 + .long 0 # Location list terminator begin (*.LLST0) + .long 0 # Location list terminator end (*.LLST0) + .section .debug_aranges,"",@progbits + .long 0x24 # Length of Address Ranges Info + .value 0x2 # DWARF Version + .long .Ldebug_info0 # Offset of Compilation Unit Info + .byte 0x4 # Size of Address + .byte 0 # Size of Segment Descriptor + .value 0 # Pad to 8 byte boundary + .value 0 + .long .Ltext0 # Address + .long .Letext0-.Ltext0 # Length + .long .LFB2 # Address + .long .LFE2-.LFB2 # Length + .long 0 + .long 0 + .section .debug_ranges,"",@progbits +.Ldebug_ranges0: + .long .Ltext0 # Offset 0 + .long .Letext0 + .long .LFB2 # Offset 0x8 + .long .LFE2 + .long 0 + .long 0 + .section .debug_line,"",@progbits +.Ldebug_line0: + .section .debug_str,"MS",@progbits,1 +.LASF1: + .string "tailcall.c" +.LASF3: + .string "main" +.LASF0: + .string "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=i686 -g -O2" +.LASF4: + .string "answer" +.LASF2: + .string "" + .ident "GCC: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-7)" + .section .note.GNU-stack,"",@progbits diff --git a/gdb/testsuite/gdb.btrace/next.exp b/gdb/testsuite/gdb.btrace/next.exp deleted file mode 100644 index 3d2fa10107..0000000000 --- a/gdb/testsuite/gdb.btrace/next.exp +++ /dev/null @@ -1,78 +0,0 @@ -# This testcase is part of GDB, the GNU debugger. -# -# Copyright 2013-2015 Free Software Foundation, Inc. -# -# Contributed by Intel Corp. -# -# 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 . - -# check for btrace support -if { [skip_btrace_tests] } { return -1 } - -# start inferior -standard_testfile x86-record_goto.S -if [prepare_for_testing next.exp $testfile $srcfile] { - return -1 -} - -if ![runto_main] { - return -1 -} - -# trace the call to the test function -gdb_test_no_output "record btrace" -gdb_test "next" - -proc check_replay_at { insn } { - gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ - "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] -} - -# we start with stepping to make sure that the trace is fetched automatically -# the call is outside of our trace -gdb_test "reverse-next" ".*main\.2.*" -with_test_prefix "reverse-next - 1" { check_replay_at 1 } - -# we can't reverse-step any further -gdb_test "reverse-next" "No more reverse-execution history\.\r\n.*main\.2.*" -with_test_prefix "reverse-next - 2" { check_replay_at 1 } - -# but we can step back again -gdb_test "next" ".*main\.3.*" -gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "next back" - -# let's go somewhere where we can step some more -gdb_test "record goto 22" ".*fun3\.2.*" -with_test_prefix "goto 22" { check_replay_at 22 } - -gdb_test "next" ".*fun3\.3.*" -with_test_prefix "next to 27" { check_replay_at 27 } - -gdb_test "next" ".*fun3\.4.*" -with_test_prefix "next to 37" { check_replay_at 37 } - -# and back again -gdb_test "reverse-next" ".*fun3\.3.*" -with_test_prefix "reverse-next to 27" { check_replay_at 27 } - -gdb_test "reverse-next" ".*fun3\.2.*" -with_test_prefix "reverse-next to 22" { check_replay_at 22 } diff --git a/gdb/testsuite/gdb.btrace/nexti.exp b/gdb/testsuite/gdb.btrace/nexti.exp deleted file mode 100644 index 911ad868b7..0000000000 --- a/gdb/testsuite/gdb.btrace/nexti.exp +++ /dev/null @@ -1,78 +0,0 @@ -# This testcase is part of GDB, the GNU debugger. -# -# Copyright 2013-2015 Free Software Foundation, Inc. -# -# Contributed by Intel Corp. -# -# 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 . - -# check for btrace support -if { [skip_btrace_tests] } { return -1 } - -# start inferior -standard_testfile x86-record_goto.S -if [prepare_for_testing nexti.exp $testfile $srcfile] { - return -1 -} - -if ![runto_main] { - return -1 -} - -# trace the call to the test function -gdb_test_no_output "record btrace" -gdb_test "next" - -proc check_replay_at { insn } { - gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ - "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] -} - -# we start with stepping to make sure that the trace is fetched automatically -# the call is outside of our trace -gdb_test "reverse-nexti" ".*main\.2.*" -with_test_prefix "reverse-nexti - 1" { check_replay_at 1 } - -# we can't reverse-step any further -gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" -with_test_prefix "reverse-nexti - 1" { check_replay_at 1 } - -# but we can step back again -gdb_test "nexti" ".*main\.3.*" "next, 1.5" -gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "nexti back" - -# let's go somewhere where we can step some more -gdb_test "record goto 22" ".*fun3\.2.*" -with_test_prefix "goto 22" { check_replay_at 22 } - -gdb_test "nexti" ".*fun3\.3.*" -with_test_prefix "nexti to 27" { check_replay_at 27 } - -gdb_test "nexti" ".*fun3\.4.*" -with_test_prefix "nexti to 37" { check_replay_at 37 } - -# and back again -gdb_test "reverse-nexti" ".*fun3\.3.*" -with_test_prefix "reverse-nexti to 27" { check_replay_at 27 } - -gdb_test "reverse-nexti" ".*fun3\.2.*" -with_test_prefix "reverse-nexti to 22" { check_replay_at 22 } diff --git a/gdb/testsuite/gdb.btrace/nohist.exp b/gdb/testsuite/gdb.btrace/nohist.exp index f26725002d..0084f5a058 100644 --- a/gdb/testsuite/gdb.btrace/nohist.exp +++ b/gdb/testsuite/gdb.btrace/nohist.exp @@ -21,7 +21,7 @@ if { [skip_btrace_tests] } { return -1 } # start inferior -standard_testfile x86-record_goto.S +standard_testfile record_goto.c if [prepare_for_testing nohist.exp $testfile $srcfile] { return -1 } diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp index c9329009ae..7485fc7908 100644 --- a/gdb/testsuite/gdb.btrace/record_goto.exp +++ b/gdb/testsuite/gdb.btrace/record_goto.exp @@ -20,17 +20,26 @@ # check for btrace support if { [skip_btrace_tests] } { return -1 } -# start inferior -standard_testfile x86-record_goto.S - +# The "record goto" command jumps to a specific instruction in the execution +# trace. To guarantee that we always get the same execution trace, we use +# an assembly source file. +# +# We use different assembly sources based on the target architecture. +# +# Luckily, they are similar enough that a single test script can handle +# both. set opts {} if [info exists COMPILE] { # make check RUNTESTFLAGS="gdb.btrace/record_goto.exp COMPILE=1" standard_testfile record_goto.c lappend opts debug -} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { +} elseif {[istarget "x86_64-*-*"]} { + standard_testfile x86_64-record_goto.S +} elseif {[istarget "i?86-*-*"]} { + standard_testfile i686-record_goto.S +} else { verbose "Skipping ${testfile}." - return + return -1 } if [prepare_for_testing record_goto.exp $testfile $srcfile $opts] { diff --git a/gdb/testsuite/gdb.btrace/step.exp b/gdb/testsuite/gdb.btrace/step.exp index 22aded8194..c1c862be29 100644 --- a/gdb/testsuite/gdb.btrace/step.exp +++ b/gdb/testsuite/gdb.btrace/step.exp @@ -20,8 +20,9 @@ # check for btrace support if { [skip_btrace_tests] } { return -1 } +standard_testfile record_goto.c + # start inferior -standard_testfile x86-record_goto.S if [prepare_for_testing step.exp $testfile $srcfile] { return -1 } @@ -34,58 +35,13 @@ if ![runto_main] { gdb_test_no_output "record btrace" gdb_test "next" -proc check_replay_at { insn } { - gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ - "Replay in progress\. At instruction $insn\." \ - ] "\r\n"] -} - -# let's start by stepping back into the function we just returned from -gdb_test "reverse-step" ".*fun4\.5.*" -with_test_prefix "reverse-step to 39" { check_replay_at 39 } - -# again -gdb_test "reverse-step" ".*fun3\.4.*" -with_test_prefix "reverse-step to 37" { check_replay_at 37 } - -# and again -gdb_test "reverse-step" ".*fun2\.3.*" -with_test_prefix "reverse-step to 35" { check_replay_at 35 } - -# once more -gdb_test "reverse-step" ".*fun1\.2.*" -with_test_prefix "reverse-step to 33" { check_replay_at 33 } - -# and out again the other side -gdb_test "reverse-step" ".*fun2\.2.*" -with_test_prefix "reverse-step to 30" { check_replay_at 30 } - -# once again -gdb_test "reverse-step" ".*fun3\.3.*" -with_test_prefix "reverse-step to 27" { check_replay_at 27 } - -# and back the way we came +# let's step around a bit +gdb_test "reverse-next" ".*main\.2.*" +gdb_test "step" ".*fun4\.2.*" +gdb_test "next" ".*fun4\.3.*" gdb_test "step" ".*fun2\.2.*" -with_test_prefix "step to 30" { check_replay_at 30 } - -gdb_test "step" ".*fun1\.2.*" -with_test_prefix "step to 33" { check_replay_at 33 } - -gdb_test "step" ".*fun2\.3.*" -with_test_prefix "step to 35" { check_replay_at 35 } - -gdb_test "step" ".*fun3\.4.*" -with_test_prefix "step to 37" { check_replay_at 37 } - -gdb_test "step" ".*fun4\.5.*" -with_test_prefix "step to 39" { check_replay_at 39 } - -gdb_test "step" ".*main\.3.*" -gdb_test "info record" [join [list \ - "Active record target: record-btrace" \ - "Recording format: .*" \ - "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ - ] "\r\n"] "step to live" +gdb_test "finish" ".*fun4\.4.*" +gdb_test "reverse-step" ".*fun2\.3.*" +gdb_test "reverse-finish" ".*fun4\.3.*" +gdb_test "reverse-next" ".*fun4\.2.*" +gdb_test "reverse-finish" ".*main\.2.*" diff --git a/gdb/testsuite/gdb.btrace/stepi.exp b/gdb/testsuite/gdb.btrace/stepi.exp index a663f87fbc..fd018acdf0 100644 --- a/gdb/testsuite/gdb.btrace/stepi.exp +++ b/gdb/testsuite/gdb.btrace/stepi.exp @@ -20,8 +20,22 @@ # check for btrace support if { [skip_btrace_tests] } { return -1 } +# This test is stepping on instruction level. To guarantee that we always +# get the same execution trace, we use an assembly source file. +# +# We use different assembly sources based on the target architecture. +# +# Luckily, they are similar enough that a single test script can handle +# both. +if {[istarget "x86_64-*-*"]} { + standard_testfile x86_64-record_goto.S +} elseif {[istarget "i?86-*-*"]} { + standard_testfile i686-record_goto.S +} else { + return -1 +} + # start inferior -standard_testfile x86-record_goto.S if [prepare_for_testing stepi.exp $testfile $srcfile] { return -1 } @@ -35,7 +49,7 @@ if ![runto_main] { proc check_replay_at { insn } { gdb_test "info record" [join [list \ "Active record target: record-btrace" \ - "Recording format: .*" \ + ".*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \ "Replay in progress\. At instruction $insn\." \ ] "\r\n"] @@ -60,10 +74,26 @@ with_test_prefix "stepi to 40" { check_replay_at 40 } gdb_test "stepi" ".*main\.3.*" gdb_test "info record" [join [list \ "Active record target: record-btrace" \ - "Recording format: .*" \ + ".*" \ "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ ] "\r\n"] "stepi to live" +# let's try nexti +gdb_test "reverse-nexti" ".*main\.2.*" +with_test_prefix "reverse-nexti - 1" { check_replay_at 1 } + +# we can't reverse-nexti any further +gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" +with_test_prefix "reverse-nexti - 1" { check_replay_at 1 } + +# but we can step back again +gdb_test "nexti" ".*main\.3.*" "next, 1.5" +gdb_test "info record" [join [list \ + "Active record target: record-btrace" \ + ".*" \ + "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \ + ] "\r\n"] "nexti back" + # let's step from a goto position somewhere in the middle gdb_test "record goto 22" ".*fun3\.2.*" with_test_prefix "goto 22" { check_replay_at 22 } @@ -71,10 +101,14 @@ with_test_prefix "goto 22" { check_replay_at 22 } gdb_test "stepi" ".*fun1\.1.*" with_test_prefix "stepi to 23" { check_replay_at 23 } -# and back again gdb_test "reverse-stepi" ".*fun3\.2.*" -gdb_test "reverse-stepi" ".*fun3\.1.*" -with_test_prefix "reverse-stepi to 21" { check_replay_at 21 } +with_test_prefix "reverse-stepi to 22" { check_replay_at 22 } + +gdb_test "nexti" ".*fun3\.3.*" +with_test_prefix "nexti to 27" { check_replay_at 27 } + +gdb_test "reverse-nexti" ".*fun3\.2.*" +with_test_prefix "reverse-nexti to 22" { check_replay_at 22 } # let's try to step off the left end gdb_test "record goto begin" ".*main\.2.*" @@ -84,6 +118,10 @@ gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" with_test_prefix "reverse-stepi at begin" { check_replay_at 1 } +gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" +gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*" +with_test_prefix "reverse-nexti at begin" { check_replay_at 1 } + # we can step forward, though gdb_test "stepi" ".*fun4\.1.*" with_test_prefix "stepi to 2" { check_replay_at 2 } diff --git a/gdb/testsuite/gdb.btrace/x86-tailcall.c b/gdb/testsuite/gdb.btrace/tailcall.c similarity index 96% rename from gdb/testsuite/gdb.btrace/x86-tailcall.c rename to gdb/testsuite/gdb.btrace/tailcall.c index f0e54dde3b..6c7b580bb5 100644 --- a/gdb/testsuite/gdb.btrace/x86-tailcall.c +++ b/gdb/testsuite/gdb.btrace/tailcall.c @@ -35,5 +35,7 @@ main (void) int answer; answer = foo (); - return ++answer; + answer += 1; + + return answer; } diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp index 30acffc02a..b2ce415ca2 100644 --- a/gdb/testsuite/gdb.btrace/tailcall.exp +++ b/gdb/testsuite/gdb.btrace/tailcall.exp @@ -20,15 +20,23 @@ # check for btrace support if { [skip_btrace_tests] } { return -1 } -# start inferior -standard_testfile x86-tailcall.S - +# This test requires the compiler to generate a tail call. To guarantee that +# we always get one, we use an assembly source file. +# +# We use different assembly sources based on the target architecture. +# +# Luckily, they are similar enough that a single test script can handle +# both. set opts {} if [info exists COMPILE] { # make check RUNTESTFLAGS="gdb.btrace/tailcall.exp COMPILE=1" - standard_testfile x86-tailcall.c + standard_testfile tailcall.c lappend opts debug optimize=-O2 -} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { +} elseif {[istarget "x86_64-*-*"]} { + standard_testfile x86_64-tailcall.S +} elseif {[istarget "i?86-*-*"]} { + standard_testfile i686-tailcall.S +} else { verbose "Skipping ${testfile}." return } @@ -45,7 +53,7 @@ gdb_test_no_output "set record function-call-history-size 0" # trace the call to foo gdb_test_no_output "record btrace" -gdb_test "next" +gdb_test "next 2" # show the flat branch trace gdb_test "record function-call-history 1" [join [list \ @@ -64,29 +72,29 @@ gdb_test "record function-call-history /c 1" [join [list \ ] "\r\n"] "indented" # go into bar -gdb_test "record goto 4" ".*bar \\(\\) at .*x86-tailcall.c:24\r\n.*" +gdb_test "record goto 4" ".*bar \\(\\) at .*tailcall.c:24\r\n.*" # check the backtrace gdb_test "backtrace" [join [list \ - "#0.*bar \\(\\) at x86-tailcall.c:24" \ - "#1.*foo \\(\\) at x86-tailcall.c:29" \ - "#2.*main \\(\\) at x86-tailcall.c:37" \ + "#0.*bar \\(\\) at tailcall.c:24" \ + "#1.*foo \\(\\) at tailcall.c:29" \ + "#2.*main \\(\\) at tailcall.c:37" \ "Backtrace stopped: not enough registers or memory available to unwind further" \ ] "\r\n"] # walk the backtrace -gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "up to foo" -gdb_test "up" "#2\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" "up to main" -gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" "down to foo" +gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "up to foo" +gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main" +gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo" # test stepping into and out of tailcalls. -gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at x86-tailcall.c:24\r\n.*" -gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" -gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" -gdb_test "next" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:39\r\n.*" -gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" -gdb_test "step" "\[^\r\n\]*foo \\(\\) at x86-tailcall.c:29\r\n.*" -gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" -gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at x86-tailcall.c:24\r\n.*" -gdb_test "finish" "\[^\r\n\]*main \\(\\) at x86-tailcall.c:37\r\n.*" +gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" +gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" +gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" +gdb_test "next" "\[^\r\n\]*38.*" +gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" +gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" +gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" +gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" +gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" diff --git a/gdb/testsuite/gdb.btrace/x86-record_goto.S b/gdb/testsuite/gdb.btrace/x86_64-record_goto.S similarity index 99% rename from gdb/testsuite/gdb.btrace/x86-record_goto.S rename to gdb/testsuite/gdb.btrace/x86_64-record_goto.S index 5a716fe995..04ad2a8a7d 100644 --- a/gdb/testsuite/gdb.btrace/x86-record_goto.S +++ b/gdb/testsuite/gdb.btrace/x86_64-record_goto.S @@ -19,7 +19,7 @@ This file has been generated using: - gcc -S -dA -g record_goto.c -o x86-record_goto.S */ + gcc -S -dA -g record_goto.c -o x86_64-record_goto.S */ .file "record_goto.c" .section .debug_abbrev,"",@progbits diff --git a/gdb/testsuite/gdb.btrace/x86-tailcall.S b/gdb/testsuite/gdb.btrace/x86_64-tailcall.S similarity index 50% rename from gdb/testsuite/gdb.btrace/x86-tailcall.S rename to gdb/testsuite/gdb.btrace/x86_64-tailcall.S index 4f3c6b5689..cf094ceb4c 100644 --- a/gdb/testsuite/gdb.btrace/x86-tailcall.S +++ b/gdb/testsuite/gdb.btrace/x86_64-tailcall.S @@ -19,29 +19,25 @@ This file has been generated using: - gcc -S -O2 -dA -g x86-tailcall.c -o x86-tailcall.S */ + gcc -S -O2 -dA -g tailcall.c -o x86_64-tailcall.S */ - .file "x86-tailcall.c" - .section .debug_abbrev,"",@progbits -.Ldebug_abbrev0: - .section .debug_info,"",@progbits -.Ldebug_info0: - .section .debug_line,"",@progbits -.Ldebug_line0: + .file "tailcall.c" .text .Ltext0: .p2align 4,,15 .type bar, @function bar: .LFB0: - .file 1 "x86-tailcall.c" - # x86-tailcall.c:22 + .file 1 "tailcall.c" + # tailcall.c:22 .loc 1 22 0 .cfi_startproc - # basic block 2 - # x86-tailcall.c:24 +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:24 .loc 1 24 0 movl $42, %eax +# SUCC: EXIT [100.0%] ret .cfi_endproc .LFE0: @@ -50,110 +46,118 @@ bar: .type foo, @function foo: .LFB1: - # x86-tailcall.c:28 + # tailcall.c:28 .loc 1 28 0 .cfi_startproc - # basic block 2 - # x86-tailcall.c:29 +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:29 .loc 1 29 0 jmp bar +# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL) +.LVL0: .cfi_endproc .LFE1: .size foo, .-foo + .section .text.startup,"ax",@progbits .p2align 4,,15 -.globl main + .globl main .type main, @function main: .LFB2: - # x86-tailcall.c:34 + # tailcall.c:34 .loc 1 34 0 .cfi_startproc - # basic block 2 - # x86-tailcall.c:37 +# BLOCK 2 freq:10000 seq:0 +# PRED: ENTRY [100.0%] (FALLTHRU) + # tailcall.c:37 .loc 1 37 0 call foo -.LVL0: - addl $1, %eax .LVL1: - # x86-tailcall.c:39 - .loc 1 39 0 + # tailcall.c:38 + .loc 1 38 0 + addl $1, %eax +.LVL2: +# SUCC: EXIT [100.0%] + # tailcall.c:41 + .loc 1 41 0 ret .cfi_endproc .LFE2: .size main, .-main + .text .Letext0: - .section .debug_loc,"",@progbits -.Ldebug_loc0: -.LLST0: - .quad .LVL0-.Ltext0 # Location list begin address (*.LLST0) - .quad .LVL1-.Ltext0 # Location list end address (*.LLST0) - .value 0x3 # Location expression size - .byte 0x70 # DW_OP_breg0 - .sleb128 1 - .byte 0x9f # DW_OP_stack_value - .quad .LVL1-.Ltext0 # Location list begin address (*.LLST0) - .quad .LFE2-.Ltext0 # Location list end address (*.LLST0) - .value 0x1 # Location expression size - .byte 0x50 # DW_OP_reg0 - .quad 0x0 # Location list terminator begin (*.LLST0) - .quad 0x0 # Location list terminator end (*.LLST0) - .section .debug_info - .long 0x9c # Length of Compilation Unit Info - .value 0x3 # DWARF version number + .section .debug_info,"",@progbits +.Ldebug_info0: + .long 0xb3 # Length of Compilation Unit Info + .value 0x4 # 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.4.4 20100726 (Red Hat 4.4.4-13)" + .long .LASF0 # DW_AT_producer: "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=x86-64 -g -O2" .byte 0x1 # DW_AT_language - .long .LASF1 # DW_AT_name: "x86-tailcall.c" + .long .LASF1 # DW_AT_name: "tailcall.c" .long .LASF2 # DW_AT_comp_dir: "" - .quad .Ltext0 # DW_AT_low_pc - .quad .Letext0 # DW_AT_high_pc + .long .Ldebug_ranges0+0 # DW_AT_ranges + .quad 0 # DW_AT_low_pc .long .Ldebug_line0 # DW_AT_stmt_list - .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) + .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram) .ascii "bar\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (x86-tailcall.c) + .byte 0x1 # DW_AT_decl_file (tailcall.c) .byte 0x15 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x4b # DW_AT_type + # DW_AT_prototyped + .long 0x46 # DW_AT_type .quad .LFB0 # DW_AT_low_pc - .quad .LFE0 # DW_AT_high_pc - .byte 0x1 # DW_AT_frame_base + .quad .LFE0-.LFB0 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base .byte 0x9c # DW_OP_call_frame_cfa - .uleb128 0x3 # (DIE (0x4b) DW_TAG_base_type) + # DW_AT_GNU_all_call_sites + .uleb128 0x3 # (DIE (0x46) DW_TAG_base_type) .byte 0x4 # DW_AT_byte_size .byte 0x5 # DW_AT_encoding .ascii "int\0" # DW_AT_name - .uleb128 0x2 # (DIE (0x52) DW_TAG_subprogram) + .uleb128 0x4 # (DIE (0x4d) DW_TAG_subprogram) .ascii "foo\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (x86-tailcall.c) + .byte 0x1 # DW_AT_decl_file (tailcall.c) .byte 0x1b # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x4b # DW_AT_type + # DW_AT_prototyped + .long 0x46 # DW_AT_type .quad .LFB1 # DW_AT_low_pc - .quad .LFE1 # DW_AT_high_pc - .byte 0x1 # DW_AT_frame_base + .quad .LFE1-.LFB1 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base .byte 0x9c # DW_OP_call_frame_cfa - .uleb128 0x4 # (DIE (0x70) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external + # DW_AT_GNU_all_call_sites + .long 0x7c # DW_AT_sibling + .uleb128 0x5 # (DIE (0x6e) DW_TAG_GNU_call_site) + .quad .LVL0 # DW_AT_low_pc + # DW_AT_GNU_tail_call + .long 0x29 # DW_AT_abstract_origin + .byte 0 # end of children of DIE 0x4d + .uleb128 0x6 # (DIE (0x7c) DW_TAG_subprogram) + # DW_AT_external .long .LASF3 # DW_AT_name: "main" - .byte 0x1 # DW_AT_decl_file (x86-tailcall.c) + .byte 0x1 # DW_AT_decl_file (tailcall.c) .byte 0x21 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x4b # DW_AT_type + # DW_AT_prototyped + .long 0x46 # DW_AT_type .quad .LFB2 # DW_AT_low_pc - .quad .LFE2 # DW_AT_high_pc - .byte 0x1 # DW_AT_frame_base + .quad .LFE2-.LFB2 # DW_AT_high_pc + .uleb128 0x1 # DW_AT_frame_base .byte 0x9c # DW_OP_call_frame_cfa - .uleb128 0x5 # (DIE (0x8f) DW_TAG_variable) + # DW_AT_GNU_all_call_sites + .uleb128 0x7 # (DIE (0x99) DW_TAG_variable) .long .LASF4 # DW_AT_name: "answer" - .byte 0x1 # DW_AT_decl_file (x86-tailcall.c) + .byte 0x1 # DW_AT_decl_file (tailcall.c) .byte 0x23 # DW_AT_decl_line - .long 0x4b # DW_AT_type + .long 0x46 # DW_AT_type .long .LLST0 # DW_AT_location - .byte 0x0 # end of children of DIE 0x70 - .byte 0x0 # end of children of DIE 0xb - .section .debug_abbrev + .uleb128 0x8 # (DIE (0xa8) DW_TAG_GNU_call_site) + .quad .LVL1 # DW_AT_low_pc + .long 0x4d # DW_AT_abstract_origin + .byte 0 # end of children of DIE 0x7c + .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 @@ -165,17 +169,17 @@ main: .uleb128 0xe # (DW_FORM_strp) .uleb128 0x1b # (DW_AT_comp_dir) .uleb128 0xe # (DW_FORM_strp) + .uleb128 0x55 # (DW_AT_ranges) + .uleb128 0x17 # (DW_FORM_sec_offset) .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 0x0 - .byte 0x0 + .uleb128 0x17 # (DW_FORM_sec_offset) + .byte 0 + .byte 0 .uleb128 0x2 # (abbrev code) .uleb128 0x2e # (TAG: DW_TAG_subprogram) - .byte 0x0 # DW_children_no + .byte 0 # DW_children_no .uleb128 0x3 # (DW_AT_name) .uleb128 0x8 # (DW_FORM_string) .uleb128 0x3a # (DW_AT_decl_file) @@ -183,33 +187,71 @@ main: .uleb128 0x3b # (DW_AT_decl_line) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x27 # (DW_AT_prototyped) - .uleb128 0xc # (DW_FORM_flag) + .uleb128 0x19 # (DW_FORM_flag_present) .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 0x7 # (DW_FORM_data8) .uleb128 0x40 # (DW_AT_frame_base) - .uleb128 0xa # (DW_FORM_block1) - .byte 0x0 - .byte 0x0 + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .byte 0 + .byte 0 .uleb128 0x3 # (abbrev code) .uleb128 0x24 # (TAG: DW_TAG_base_type) - .byte 0x0 # DW_children_no + .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 0x0 - .byte 0x0 + .byte 0 + .byte 0 .uleb128 0x4 # (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 0x19 # (DW_FORM_flag_present) + .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 0x7 # (DW_FORM_data8) + .uleb128 0x40 # (DW_AT_frame_base) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x1 # (DW_AT_sibling) + .uleb128 0x13 # (DW_FORM_ref4) + .byte 0 + .byte 0 + .uleb128 0x5 # (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 0x2115 # (DW_AT_GNU_tail_call) + .uleb128 0x19 # (DW_FORM_flag_present) + .uleb128 0x31 # (DW_AT_abstract_origin) + .uleb128 0x13 # (DW_FORM_ref4) + .byte 0 + .byte 0 + .uleb128 0x6 # (abbrev code) + .uleb128 0x2e # (TAG: DW_TAG_subprogram) + .byte 0x1 # DW_children_yes .uleb128 0x3f # (DW_AT_external) - .uleb128 0xc # (DW_FORM_flag) + .uleb128 0x19 # (DW_FORM_flag_present) .uleb128 0x3 # (DW_AT_name) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x3a # (DW_AT_decl_file) @@ -217,20 +259,22 @@ main: .uleb128 0x3b # (DW_AT_decl_line) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x27 # (DW_AT_prototyped) - .uleb128 0xc # (DW_FORM_flag) + .uleb128 0x19 # (DW_FORM_flag_present) .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 0x7 # (DW_FORM_data8) .uleb128 0x40 # (DW_AT_frame_base) - .uleb128 0xa # (DW_FORM_block1) - .byte 0x0 - .byte 0x0 - .uleb128 0x5 # (abbrev code) + .uleb128 0x18 # (DW_FORM_exprloc) + .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) + .uleb128 0x19 # (DW_FORM_flag_present) + .byte 0 + .byte 0 + .uleb128 0x7 # (abbrev code) .uleb128 0x34 # (TAG: DW_TAG_variable) - .byte 0x0 # DW_children_no + .byte 0 # DW_children_no .uleb128 0x3 # (DW_AT_name) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x3a # (DW_AT_decl_file) @@ -240,40 +284,68 @@ main: .uleb128 0x49 # (DW_AT_type) .uleb128 0x13 # (DW_FORM_ref4) .uleb128 0x2 # (DW_AT_location) - .uleb128 0x6 # (DW_FORM_data4) - .byte 0x0 - .byte 0x0 - .byte 0x0 - .section .debug_pubnames,"",@progbits - .long 0x17 # Length of Public Names Info - .value 0x2 # DWARF Version - .long .Ldebug_info0 # Offset of Compilation Unit Info - .long 0xa0 # Compilation Unit Length - .long 0x70 # DIE offset - .ascii "main\0" # external name - .long 0x0 + .uleb128 0x17 # (DW_FORM_sec_offset) + .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 + .byte 0 + .section .debug_loc,"",@progbits +.Ldebug_loc0: +.LLST0: + .quad .LVL1 # Location list begin address (*.LLST0) + .quad .LVL2 # Location list end address (*.LLST0) + .value 0x3 # Location expression size + .byte 0x70 # DW_OP_breg0 + .sleb128 1 + .byte 0x9f # DW_OP_stack_value + .quad .LVL2 # Location list begin address (*.LLST0) + .quad .LFE2 # Location list end address (*.LLST0) + .value 0x1 # Location expression size + .byte 0x50 # DW_OP_reg0 + .quad 0 # Location list terminator begin (*.LLST0) + .quad 0 # Location list terminator end (*.LLST0) .section .debug_aranges,"",@progbits - .long 0x2c # Length of Address Ranges Info + .long 0x3c # Length of Address Ranges Info .value 0x2 # DWARF Version .long .Ldebug_info0 # Offset of Compilation Unit Info .byte 0x8 # Size of Address - .byte 0x0 # Size of Segment Descriptor - .value 0x0 # Pad to 16 byte boundary - .value 0x0 + .byte 0 # Size of Segment Descriptor + .value 0 # Pad to 16 byte boundary + .value 0 .quad .Ltext0 # Address .quad .Letext0-.Ltext0 # Length - .quad 0x0 - .quad 0x0 + .quad .LFB2 # Address + .quad .LFE2-.LFB2 # Length + .quad 0 + .quad 0 + .section .debug_ranges,"",@progbits +.Ldebug_ranges0: + .quad .Ltext0 # Offset 0 + .quad .Letext0 + .quad .LFB2 # Offset 0x10 + .quad .LFE2 + .quad 0 + .quad 0 + .section .debug_line,"",@progbits +.Ldebug_line0: .section .debug_str,"MS",@progbits,1 -.LASF0: - .string "GNU C 4.4.4 20100726 (Red Hat 4.4.4-13)" .LASF3: .string "main" +.LASF1: + .string "tailcall.c" +.LASF0: + .string "GNU C 4.8.3 20140911 (Red Hat 4.8.3-7) -mtune=generic -march=x86-64 -g -O2" .LASF4: .string "answer" .LASF2: .string "" -.LASF1: - .string "x86-tailcall.c" - .ident "GCC: (GNU) 4.4.4 20100726 (Red Hat 4.4.4-13)" + .ident "GCC: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-7)" .section .note.GNU-stack,"",@progbits -- 2.34.1