222 lines · plain
1# REQUIRES: x86-registered-target2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o3# RUN: llvm-symbolizer 0x0 0x2 0x3 0x4 --obj=%t.o | FileCheck %s4# This test makes sure we don't attempt to access out of the line table boundaries5# if the last range is empty.6# Produced from the following program:7# int func(int a) {8# return 1 + a;9# }10# compiled with clang -O3 -g -S11# Edited by adding a redundant, empty last range.12# The line table (llvm-dwarfdump --debug-line) looks like:13#14# Address Line Column File ISA Discriminator OpIndex Flags15# ------------------ ------ ------ ------ --- ------------- ------- -------------16# 0x0000000000000000 1 0 1 0 0 0 is_stmt17# 0x0000000000000000 2 12 1 0 0 0 is_stmt prologue_end18# 0x0000000000000003 2 3 1 0 0 019# 0x0000000000000003 3 3 1 0 0 020# 0x0000000000000004 3 3 1 0 0 0 end_sequence21#22# 0x0 should pick the second line in the table - line 2, col 1223# CHECK: func24# CHECK: /scratch/a.cpp:2:1225# 0x2 does not exist in the table, so we should pick the line with a26# lower address that describes the range - in this case, the second line.27# CHECK: func28# CHECK: /scratch/a.cpp:2:1229# 0x3 also has a sequence of empty ranges, so we should pick the first range after30# skipping the empty ones.31# This also verifies we don't attempt to access outside boundaries.32# CHECK: func33# CHECK: /scratch/a.cpp:3:334# CHECK: ??35# CHECK: ??:0:036 37 .text38 .file "a.cpp"39 .globl _Z4funci # -- Begin function _Z4funci40 .p2align 4, 0x9041 .type _Z4funci,@function42_Z4funci: # @_Z4funci43.Lfunc_begin0:44 .file 1 "/llvm-project" "/scratch/a.cpp"45 .loc 1 1 0 # /scratch/a.cpp:1:046 .cfi_startproc47# %bb.0:48 #DEBUG_VALUE: func:a <- $edi49 # kill: def $edi killed $edi def $rdi50 #DEBUG_VALUE: func:a <- $edi51 .loc 1 2 12 prologue_end # /scratch/a.cpp:2:1252 leal 1(%rdi), %eax53 .loc 1 2 3 # /scratch/a.cpp:2:354 .loc 1 3 3 is_stmt 0 # this forms an empty range torgether with the previous.55 retq56.Ltmp0:57.Lfunc_end0:58 .size _Z4funci, .Lfunc_end0-_Z4funci59 .cfi_endproc60 # -- End function61 .section .debug_str,"MS",@progbits,162.Linfo_string0:63 .asciz "clang version 7.0.1-6 (tags/RELEASE_701/final)" # string offset=064.Linfo_string1:65 .asciz "/scratch/a.cpp" # string offset=4766.Linfo_string2:67 .asciz "/llvm-project" # string offset=9768.Linfo_string3:69 .asciz "_Z4funci" # string offset=14670.Linfo_string4:71 .asciz "func" # string offset=15572.Linfo_string5:73 .asciz "int" # string offset=16074.Linfo_string6:75 .asciz "a" # string offset=16476 .section .debug_loc,"",@progbits77.Ldebug_loc0:78 .quad .Lfunc_begin0-.Lfunc_begin079 .quad .Lfunc_end0-.Lfunc_begin080 .short 1 # Loc expr size81 .byte 85 # super-register DW_OP_reg582 .quad 083 .quad 084 .section .debug_abbrev,"",@progbits85 .byte 1 # Abbreviation Code86 .byte 17 # DW_TAG_compile_unit87 .byte 1 # DW_CHILDREN_yes88 .byte 37 # DW_AT_producer89 .byte 14 # DW_FORM_strp90 .byte 19 # DW_AT_language91 .byte 5 # DW_FORM_data292 .byte 3 # DW_AT_name93 .byte 14 # DW_FORM_strp94 .byte 16 # DW_AT_stmt_list95 .byte 23 # DW_FORM_sec_offset96 .byte 27 # DW_AT_comp_dir97 .byte 14 # DW_FORM_strp98 .ascii "\264B" # DW_AT_GNU_pubnames99 .byte 25 # DW_FORM_flag_present100 .byte 17 # DW_AT_low_pc101 .byte 1 # DW_FORM_addr102 .byte 18 # DW_AT_high_pc103 .byte 6 # DW_FORM_data4104 .byte 0 # EOM(1)105 .byte 0 # EOM(2)106 .byte 2 # Abbreviation Code107 .byte 46 # DW_TAG_subprogram108 .byte 1 # DW_CHILDREN_yes109 .byte 17 # DW_AT_low_pc110 .byte 1 # DW_FORM_addr111 .byte 18 # DW_AT_high_pc112 .byte 6 # DW_FORM_data4113 .byte 64 # DW_AT_frame_base114 .byte 24 # DW_FORM_exprloc115 .byte 110 # DW_AT_linkage_name116 .byte 14 # DW_FORM_strp117 .byte 3 # DW_AT_name118 .byte 14 # DW_FORM_strp119 .byte 58 # DW_AT_decl_file120 .byte 11 # DW_FORM_data1121 .byte 59 # DW_AT_decl_line122 .byte 11 # DW_FORM_data1123 .byte 73 # DW_AT_type124 .byte 19 # DW_FORM_ref4125 .byte 63 # DW_AT_external126 .byte 25 # DW_FORM_flag_present127 .byte 0 # EOM(1)128 .byte 0 # EOM(2)129 .byte 3 # Abbreviation Code130 .byte 5 # DW_TAG_formal_parameter131 .byte 0 # DW_CHILDREN_no132 .byte 2 # DW_AT_location133 .byte 23 # DW_FORM_sec_offset134 .byte 3 # DW_AT_name135 .byte 14 # DW_FORM_strp136 .byte 58 # DW_AT_decl_file137 .byte 11 # DW_FORM_data1138 .byte 59 # DW_AT_decl_line139 .byte 11 # DW_FORM_data1140 .byte 73 # DW_AT_type141 .byte 19 # DW_FORM_ref4142 .byte 0 # EOM(1)143 .byte 0 # EOM(2)144 .byte 4 # Abbreviation Code145 .byte 36 # DW_TAG_base_type146 .byte 0 # DW_CHILDREN_no147 .byte 3 # DW_AT_name148 .byte 14 # DW_FORM_strp149 .byte 62 # DW_AT_encoding150 .byte 11 # DW_FORM_data1151 .byte 11 # DW_AT_byte_size152 .byte 11 # DW_FORM_data1153 .byte 0 # EOM(1)154 .byte 0 # EOM(2)155 .byte 0 # EOM(3)156 .section .debug_info,"",@progbits157.Lcu_begin0:158 .long 91 # Length of Unit159 .short 4 # DWARF version number160 .long .debug_abbrev # Offset Into Abbrev. Section161 .byte 8 # Address Size (in bytes)162 .byte 1 # Abbrev [1] 0xb:0x54 DW_TAG_compile_unit163 .long .Linfo_string0 # DW_AT_producer164 .short 4 # DW_AT_language165 .long .Linfo_string1 # DW_AT_name166 .long .Lline_table_start0 # DW_AT_stmt_list167 .long .Linfo_string2 # DW_AT_comp_dir168 # DW_AT_GNU_pubnames169 .quad .Lfunc_begin0 # DW_AT_low_pc170 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc171 .byte 2 # Abbrev [2] 0x2a:0x2d DW_TAG_subprogram172 .quad .Lfunc_begin0 # DW_AT_low_pc173 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc174 .byte 1 # DW_AT_frame_base175 .byte 87176 .long .Linfo_string3 # DW_AT_linkage_name177 .long .Linfo_string4 # DW_AT_name178 .byte 1 # DW_AT_decl_file179 .byte 1 # DW_AT_decl_line180 .long 87 # DW_AT_type181 # DW_AT_external182 .byte 3 # Abbrev [3] 0x47:0xf DW_TAG_formal_parameter183 .long .Ldebug_loc0 # DW_AT_location184 .long .Linfo_string6 # DW_AT_name185 .byte 1 # DW_AT_decl_file186 .byte 1 # DW_AT_decl_line187 .long 87 # DW_AT_type188 .byte 0 # End Of Children Mark189 .byte 4 # Abbrev [4] 0x57:0x7 DW_TAG_base_type190 .long .Linfo_string5 # DW_AT_name191 .byte 5 # DW_AT_encoding192 .byte 4 # DW_AT_byte_size193 .byte 0 # End Of Children Mark194 .section .debug_macinfo,"",@progbits195 .byte 0 # End Of Macro List Mark196 .section .debug_pubnames,"",@progbits197 .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info198.LpubNames_begin0:199 .short 2 # DWARF Version200 .long .Lcu_begin0 # Offset of Compilation Unit Info201 .long 95 # Compilation Unit Length202 .long 42 # DIE offset203 .asciz "func" # External Name204 .long 0 # End Mark205.LpubNames_end0:206 .section .debug_pubtypes,"",@progbits207 .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info208.LpubTypes_begin0:209 .short 2 # DWARF Version210 .long .Lcu_begin0 # Offset of Compilation Unit Info211 .long 95 # Compilation Unit Length212 .long 87 # DIE offset213 .asciz "int" # External Name214 .long 0 # End Mark215.LpubTypes_end0:216 217 .ident "clang version 7.0.1-6 (tags/RELEASE_701/final)"218 .section ".note.GNU-stack","",@progbits219 .addrsig220 .section .debug_line,"",@progbits221.Lline_table_start0:222