1# Test handling of DWARF5 line tables. In particular, test that we handle files 2# which are present in the line table more than once. 3 4# REQUIRES: x86 5 6# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-pc-linux %s 7# RUN: %lldb %t -o "source info -f file0.c" -o "source info -f file1.c" \ 8# RUN: -o "breakpoint set -f file0.c -l 42" \ 9# RUN: -o "breakpoint set -f file0.c -l 47" \ 10# RUN: -o exit | FileCheck %s 11 12# CHECK-LABEL: source info -f file0.c 13# CHECK: [0x0000000000000000-0x0000000000000001): /file0.c:42 14# CHECK-LABEL: source info -f file1.c 15# CHECK: [0x0000000000000001-0x0000000000000002): /file1.c:47 16# CHECK-LABEL: breakpoint set -f file0.c -l 42 17# CHECK: Breakpoint 1: {{.*}}`foo, 18# CHECK-LABEL: breakpoint set -f file0.c -l 47 19# CHECK: Breakpoint 2: {{.*}}`foo + 2, 20 21 .text 22 .globl foo 23foo: 24 nop 25 nop 26 nop 27.Lfoo_end: 28 29 .section .debug_abbrev,"",@progbits 30 .byte 1 # Abbreviation Code 31 .byte 17 # DW_TAG_compile_unit 32 .byte 0 # DW_CHILDREN_no 33 .byte 37 # DW_AT_producer 34 .byte 8 # DW_FORM_string 35 .byte 19 # DW_AT_language 36 .byte 5 # DW_FORM_data2 37 .byte 3 # DW_AT_name 38 .byte 8 # DW_FORM_string 39 .byte 16 # DW_AT_stmt_list 40 .byte 23 # DW_FORM_sec_offset 41 .byte 27 # DW_AT_comp_dir 42 .byte 8 # DW_FORM_string 43 .byte 17 # DW_AT_low_pc 44 .byte 1 # DW_FORM_addr 45 .byte 18 # DW_AT_high_pc 46 .byte 6 # DW_FORM_data4 47 .byte 0 # EOM(1) 48 .byte 0 # EOM(2) 49 .byte 0 # EOM(3) 50 51 .section .debug_info,"",@progbits 52.Lcu_begin0: 53 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 54.Ldebug_info_start0: 55 .short 5 # DWARF version number 56 .byte 1 # DWARF Unit Type 57 .byte 8 # Address Size (in bytes) 58 .long .debug_abbrev # Offset Into Abbrev. Section 59 .byte 1 # Abbrev [1] 0xc:0x23 DW_TAG_compile_unit 60 .asciz "Hand-written DWARF" # DW_AT_producer 61 .short 12 # DW_AT_language 62 .asciz "file0.c" # DW_AT_name 63 .long .Lline_table_begin # DW_AT_stmt_list 64 .asciz "/" # DW_AT_comp_dir 65 .quad foo # DW_AT_low_pc 66 .long .Lfoo_end-foo # DW_AT_high_pc 67.Ldebug_info_end0: 68 69 .section .debug_line,"",@progbits 70.Lline_table_begin: 71 .long .Lline_end-.Lline_start 72.Lline_start: 73 .short 5 # DWARF version number 74 .byte 8 # Address Size (in bytes) 75 .byte 0 # Segment Selector Size 76 .long .Lheader_end-.Lheader_start 77.Lheader_start: 78 .byte 1 # Minimum Instruction Length 79 .byte 1 # Maximum Operations per Instruction 80 .byte 1 # Default is_stmt 81 .byte 0 # Line Base 82 .byte 0 # Line Range 83 .byte 5 # Opcode Base 84 .byte 0, 1, 1, 1 # Standard Opcode Lengths 85 86 # Directory table format 87 .byte 1 # One element per directory entry 88 .byte 1 # DW_LNCT_path 89 .byte 0x08 # DW_FORM_string 90 91 # Directory table entries 92 .byte 1 # 1 directory 93 .asciz "/" 94 95 # File table format 96 .byte 2 # 2 elements per file entry 97 .byte 1 # DW_LNCT_path 98 .byte 0x08 # DW_FORM_string 99 .byte 2 # DW_LNCT_directory_index 100 .byte 0x0b # DW_FORM_data1 101 102 # File table entries 103 .byte 3 # 3 files 104 .asciz "file0.c" 105 .byte 0 106 .asciz "file1.c" 107 .byte 0 108 .asciz "file0.c" 109 .byte 0 110.Lheader_end: 111 112 .byte 4, 0 # DW_LNS_set_file 0 113 .byte 0, 9, 2 # DW_LNE_set_address 114 .quad foo 115 .byte 3, 41 # DW_LNS_advance_line 41 116 .byte 1 # DW_LNS_copy 117 118 .byte 4, 1 # DW_LNS_set_file 1 119 .byte 2, 1 # DW_LNS_advance_pc 1 120 .byte 3, 5 # DW_LNS_advance_line 5 121 .byte 1 # DW_LNS_copy 122 123 .byte 4, 2 # DW_LNS_set_file 2 124 .byte 2, 1 # DW_LNS_advance_pc 1 125 .byte 1 # DW_LNS_copy 126 127 .byte 2, 1 # DW_LNS_advance_pc 1 128 .byte 0, 1, 1 # DW_LNE_end_sequence 129.Lline_end: 130