old-cross-binutils/gdb/testsuite/gdb.dwarf2/dw2-single-line-discriminators.S
Doug Evans a05a36a5fc Fix pr 17276.
See the description here:
https://sourceware.org/ml/gdb-patches/2014-08/msg00283.html

This patch keeps track of whether the current line has seen a
non-zero discriminator, and if so coalesces consecutive entries
for the same line (by ignoring all entries after the first).

gdb/ChangeLog:

	PR 17276
	* dwarf2read.c (dwarf_record_line_p): New function.
	(dwarf_decode_lines_1): Ignore subsequent line number entries
	for the same line if any entry had a non-zero discriminator.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-single-line-discriminators.S: New file.
	* gdb.dwarf2/dw2-single-line-discriminators.c: New file.
	* gdb.dwarf2/dw2-single-line-discriminators.exp: New file.
2014-08-22 17:25:59 -07:00

281 lines
11 KiB
ArmAsm

/* This testcase is part of GDB, the GNU debugger.
Copyright 2014 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 was made from dw2-single-line-discriminators.c using
clang -dA -S -g
and then hand-editing the assembly a bit (simplify paths,
tweak so gas accepts it). */
.text
.file "dw2-single-line-discriminators.c"
.section .debug_info,"",@progbits
.Lsection_info:
.section .debug_abbrev,"",@progbits
.Lsection_abbrev:
.section .debug_line,"",@progbits
.Lsection_line:
.section .debug_pubnames,"",@progbits
.section .debug_pubtypes,"",@progbits
.section .debug_str,"MS",@progbits,1
.Linfo_string:
.section .debug_loc,"",@progbits
.Lsection_debug_loc:
.section .debug_ranges,"",@progbits
.Ldebug_range:
.file 1 "gdb.dwarf2/dw2-single-line-discriminators.c"
.text
.globl main
.align 16, 0x90
.type main,@function
main: # @main
.Lfunc_begin0:
.loc 1 22 0 # dw2-single-line-discriminators.c:22:0
.cfi_startproc
# BB#0:
pushq %rbp
.Ltmp0:
.cfi_def_cfa_offset 16
.Ltmp1:
.cfi_offset %rbp, -16
movq %rsp, %rbp
.Ltmp2:
.cfi_def_cfa_register %rbp
movl $0, -4(%rbp)
.loc 1 26 3 prologue_end # dw2-single-line-discriminators.c:26:3
.Ltmp3:
movl $0, x
.loc 1 28 8 # dw2-single-line-discriminators.c:28:8
.Ltmp4:
movl $0, -8(%rbp)
.LBB0_1: # =>This Inner Loop Header: Depth=1
.loc 1 28 8 discriminator 4 # dw2-single-line-discriminators.c:28:8
.Ltmp5:
cmpl $10, -8(%rbp)
jge .LBB0_4
.Ltmp6:
# BB#2: # in Loop: Header=BB0_1 Depth=1
.loc 1 28 28 discriminator 2 # dw2-single-line-discriminators.c:28:28
jmp .LBB0_3
.Ltmp7:
.LBB0_3: # in Loop: Header=BB0_1 Depth=1
.loc 1 28 23 discriminator 3 # dw2-single-line-discriminators.c:28:23
movl -8(%rbp), %eax
addl $1, %eax
movl %eax, -8(%rbp)
jmp .LBB0_1
.Ltmp8:
.LBB0_4:
movl $0, %eax
.loc 1 30 3 # dw2-single-line-discriminators.c:30:3
popq %rbp
retq
.Ltmp9:
.Ltmp10:
.size main, .Ltmp10-main
.Lfunc_end0:
.cfi_endproc
.type x,@object # @x
.comm x,4,4
.Ldebug_end1:
.section .debug_str,"MS",@progbits,1
.Linfo_string0:
.asciz "clang version (trunk r215195)"
.Linfo_string1:
.asciz "dw2-single-line-discriminators.c"
.Linfo_string2:
.asciz "/tmp/obj/gdb/testsuite"
.Linfo_string3:
.asciz "x"
.Linfo_string4:
.asciz "int"
.Linfo_string5:
.asciz "main"
.Linfo_string6:
.asciz "i"
.section .debug_info,"",@progbits
.L.debug_info_begin0:
.long 108 # Length of Unit
.short 4 # DWARF version number
.long .Lsection_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
.byte 1 # Abbrev [1] 0xb:0x65 DW_TAG_compile_unit
.long .Linfo_string0 # DW_AT_producer
.short 12 # DW_AT_language
.long .Linfo_string1 # DW_AT_name
.long .Lline_table_start0 # DW_AT_stmt_list
.long .Linfo_string2 # DW_AT_comp_dir
.quad .Lfunc_begin0 # DW_AT_low_pc
.Lset0 = .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
.long .Lset0
.byte 2 # Abbrev [2] 0x2a:0x15 DW_TAG_variable
.long .Linfo_string3 # DW_AT_name
.long 63 # DW_AT_type
# DW_AT_external
.byte 1 # DW_AT_decl_file
.byte 18 # DW_AT_decl_line
.byte 9 # DW_AT_location
.byte 3
.quad x
.byte 3 # Abbrev [3] 0x3f:0x7 DW_TAG_base_type
.long .Linfo_string4 # DW_AT_name
.byte 5 # DW_AT_encoding
.byte 4 # DW_AT_byte_size
.byte 4 # Abbrev [4] 0x46:0x29 DW_TAG_subprogram
.quad .Lfunc_begin0 # DW_AT_low_pc
.Lset1 = .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
.long .Lset1
.byte 1 # DW_AT_frame_base
.byte 86
.long .Linfo_string5 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 21 # DW_AT_decl_line
.long 63 # DW_AT_type
# DW_AT_external
.byte 1 # DW_AT_accessibility
# DW_ACCESS_public
.byte 5 # Abbrev [5] 0x60:0xe DW_TAG_variable
.byte 2 # DW_AT_location
.byte 145
.byte 120
.long .Linfo_string6 # DW_AT_name
.byte 1 # DW_AT_decl_file
.byte 23 # DW_AT_decl_line
.long 63 # DW_AT_type
.byte 0 # End Of Children Mark
.byte 0 # End Of Children Mark
.L.debug_info_end0:
.section .debug_abbrev,"",@progbits
.byte 1 # Abbreviation Code
.byte 17 # DW_TAG_compile_unit
.byte 1 # DW_CHILDREN_yes
.byte 37 # DW_AT_producer
.byte 14 # DW_FORM_strp
.byte 19 # DW_AT_language
.byte 5 # DW_FORM_data2
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 16 # DW_AT_stmt_list
.byte 23 # DW_FORM_sec_offset
.byte 27 # DW_AT_comp_dir
.byte 14 # DW_FORM_strp
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 2 # Abbreviation Code
.byte 52 # DW_TAG_variable
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 63 # DW_AT_external
.byte 25 # DW_FORM_flag_present
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 2 # DW_AT_location
.byte 24 # DW_FORM_exprloc
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 3 # Abbreviation Code
.byte 36 # DW_TAG_base_type
.byte 0 # DW_CHILDREN_no
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 62 # DW_AT_encoding
.byte 11 # DW_FORM_data1
.byte 11 # DW_AT_byte_size
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 4 # Abbreviation Code
.byte 46 # DW_TAG_subprogram
.byte 1 # DW_CHILDREN_yes
.byte 17 # DW_AT_low_pc
.byte 1 # DW_FORM_addr
.byte 18 # DW_AT_high_pc
.byte 6 # DW_FORM_data4
.byte 64 # DW_AT_frame_base
.byte 24 # DW_FORM_exprloc
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 63 # DW_AT_external
.byte 25 # DW_FORM_flag_present
.byte 50 # DW_AT_accessibility
.byte 11 # DW_FORM_data1
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 5 # Abbreviation Code
.byte 52 # DW_TAG_variable
.byte 0 # DW_CHILDREN_no
.byte 2 # DW_AT_location
.byte 24 # DW_FORM_exprloc
.byte 3 # DW_AT_name
.byte 14 # DW_FORM_strp
.byte 58 # DW_AT_decl_file
.byte 11 # DW_FORM_data1
.byte 59 # DW_AT_decl_line
.byte 11 # DW_FORM_data1
.byte 73 # DW_AT_type
.byte 19 # DW_FORM_ref4
.byte 0 # EOM(1)
.byte 0 # EOM(2)
.byte 0 # EOM(3)
.section .debug_ranges,"",@progbits
.section .debug_loc,"",@progbits
.section .debug_pubnames,"",@progbits
.Lset2 = .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
.long .Lset2
.LpubNames_begin0:
.short 2 # DWARF Version
.long .L.debug_info_begin0 # Offset of Compilation Unit Info
.Lset3 = .L.debug_info_end0-.L.debug_info_begin0 # Compilation Unit Length
.long .Lset3
.long 70 # DIE offset
.asciz "main" # External Name
.long 42 # DIE offset
.asciz "x" # External Name
.long 0 # End Mark
.LpubNames_end0:
.section .debug_pubtypes,"",@progbits
.Lset4 = .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
.long .Lset4
.LpubTypes_begin0:
.short 2 # DWARF Version
.long .L.debug_info_begin0 # Offset of Compilation Unit Info
.Lset5 = .L.debug_info_end0-.L.debug_info_begin0 # Compilation Unit Length
.long .Lset5
.long 63 # DIE offset
.asciz "int" # External Name
.long 0 # End Mark
.LpubTypes_end0:
.ident "clang version (trunk r215195)"
.section ".note.GNU-stack","",@progbits
.section .debug_line,"",@progbits
.Lline_table_start0: