239 lines · plain
1# REQUIRES: x86-registered-target2# Test llvm-symbolizer always uses line info from debug info if present.3 4# It's produced by the following steps.5# 1. Compile with "clang++ test.ll -S -o test.s".6# 2. Replace all "test.ll" with "<invalid>"" except the "test.ll" in first line.7# 3. Replace "/" in Linfo_string2 with "".8# source:9# ; ModuleID = 'test.ll'10# source_filename = "test.ll"11# ; Function Attrs: nounwind12# define void @foo(i32 %i) local_unnamed_addr #0 !dbg !5 {13# entry:14# #dbg_value(i32 0, !9, !DIExpression(), !11)15# switch i32 %i, label %if.end3 [16# i32 5, label %if.end3.sink.split17# i32 7, label %if.end3.sink.split18# ], !dbg !1119# if.end3.sink.split: ; preds = %entry, %entry20# tail call void @bar() #0, !dbg !1221# br label %if.end3, !dbg !1322# if.end3: ; preds = %if.end3.sink.split, %entry23# tail call void @bar() #0, !dbg !1324# ret void, !dbg !1425# }26# declare dso_local void @bar()27# attributes #0 = { nounwind }28# !llvm.dbg.cu = !{!0}29# !llvm.debugify = !{!2, !3}30# !llvm.module.flags = !{!4}31# !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)32# !1 = !DIFile(filename: "test.ll", directory: "/")33# !2 = !{i32 7}34# !3 = !{i32 1}35# !4 = !{i32 2, !"Debug Info Version", i32 3}36# !5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)37# !6 = !DISubroutineType(types: !7)38# !7 = !{}39# !8 = !{!9}40# !9 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !10)41# !10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)42# !11 = !DILocation(line: 1, column: 1, scope: !5)43# !12 = !DILocation(line: 0, scope: !5)44# !13 = !DILocation(line: 6, column: 1, scope: !5)45# !14 = !DILocation(line: 7, column: 1, scope: !5)46 47 48# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t49# RUN: llvm-symbolizer --obj=%t 0xd | FileCheck %s50# RUN: llvm-symbolizer --inlining=false --obj=%t 0xd | FileCheck %s51# CHECK: foo52# CHECK-NEXT: ??:0:053 54 .file "test.ll"55 .text56 .p2align 457 .type foo,@function58foo: # @foo59.Lfunc_begin0:60 .file 1 "<invalid>"61 .loc 1 1 0 # <invalid>:1:062 .cfi_sections .debug_frame63 .cfi_startproc64# %bb.0: # %entry65 pushq %rax66 .cfi_def_cfa_offset 1667 movl %edi, %eax68.Ltmp0:69 #DEBUG_VALUE: foo:1 <- 070 .loc 1 1 1 prologue_end # <invalid>:1:171 orl $2, %eax72 subl $7, %eax73 je .LBB0_174 jmp .LBB0_275.Ltmp1:76.LBB0_1: # %if.end3.sink.split77 #DEBUG_VALUE: foo:1 <- 078 .loc 1 0 0 is_stmt 0 # <invalid>:079 callq bar80.Ltmp2:81.LBB0_2: # %if.end382 #DEBUG_VALUE: foo:1 <- 083 .loc 1 6 1 epilogue_begin is_stmt 1 # <invalid>:6:184 popq %rax85 .cfi_def_cfa_offset 886 jmp bar # TAILCALL87.Ltmp3:88.Lfunc_end0:89 .size foo, .Lfunc_end0-foo90 .cfi_endproc91 # -- End function92 .section .debug_abbrev,"",@progbits93 .byte 1 # Abbreviation Code94 .byte 17 # DW_TAG_compile_unit95 .byte 1 # DW_CHILDREN_yes96 .byte 37 # DW_AT_producer97 .byte 14 # DW_FORM_strp98 .byte 19 # DW_AT_language99 .byte 5 # DW_FORM_data2100 .byte 3 # DW_AT_name101 .byte 14 # DW_FORM_strp102 .byte 16 # DW_AT_stmt_list103 .byte 23 # DW_FORM_sec_offset104 .byte 27 # DW_AT_comp_dir105 .byte 14 # DW_FORM_strp106 .ascii "\264B" # DW_AT_GNU_pubnames107 .byte 25 # DW_FORM_flag_present108 .byte 17 # DW_AT_low_pc109 .byte 1 # DW_FORM_addr110 .byte 18 # DW_AT_high_pc111 .byte 6 # DW_FORM_data4112 .byte 0 # EOM(1)113 .byte 0 # EOM(2)114 .byte 2 # Abbreviation Code115 .byte 46 # DW_TAG_subprogram116 .byte 1 # DW_CHILDREN_yes117 .byte 17 # DW_AT_low_pc118 .byte 1 # DW_FORM_addr119 .byte 18 # DW_AT_high_pc120 .byte 6 # DW_FORM_data4121 .byte 64 # DW_AT_frame_base122 .byte 24 # DW_FORM_exprloc123 .byte 110 # DW_AT_linkage_name124 .byte 14 # DW_FORM_strp125 .byte 3 # DW_AT_name126 .byte 14 # DW_FORM_strp127 .byte 58 # DW_AT_decl_file128 .byte 11 # DW_FORM_data1129 .byte 59 # DW_AT_decl_line130 .byte 11 # DW_FORM_data1131 .byte 63 # DW_AT_external132 .byte 25 # DW_FORM_flag_present133 .byte 0 # EOM(1)134 .byte 0 # EOM(2)135 .byte 3 # Abbreviation Code136 .byte 52 # DW_TAG_variable137 .byte 0 # DW_CHILDREN_no138 .byte 28 # DW_AT_const_value139 .byte 15 # DW_FORM_udata140 .byte 3 # DW_AT_name141 .byte 14 # DW_FORM_strp142 .byte 58 # DW_AT_decl_file143 .byte 11 # DW_FORM_data1144 .byte 59 # DW_AT_decl_line145 .byte 11 # DW_FORM_data1146 .byte 73 # DW_AT_type147 .byte 19 # DW_FORM_ref4148 .byte 0 # EOM(1)149 .byte 0 # EOM(2)150 .byte 4 # Abbreviation Code151 .byte 36 # DW_TAG_base_type152 .byte 0 # DW_CHILDREN_no153 .byte 3 # DW_AT_name154 .byte 14 # DW_FORM_strp155 .byte 62 # DW_AT_encoding156 .byte 11 # DW_FORM_data1157 .byte 11 # DW_AT_byte_size158 .byte 11 # DW_FORM_data1159 .byte 0 # EOM(1)160 .byte 0 # EOM(2)161 .byte 0 # EOM(3)162 .section .debug_info,"",@progbits163.Lcu_begin0:164 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit165.Ldebug_info_start0:166 .short 4 # DWARF version number167 .long .debug_abbrev # Offset Into Abbrev. Section168 .byte 8 # Address Size (in bytes)169 .byte 1 # Abbrev [1] 0xb:0x4d DW_TAG_compile_unit170 .long .Linfo_string0 # DW_AT_producer171 .short 2 # DW_AT_language172 .long .Linfo_string1 # DW_AT_name173 .long .Lline_table_start0 # DW_AT_stmt_list174 .long .Linfo_string2 # DW_AT_comp_dir175 # DW_AT_GNU_pubnames176 .quad .Lfunc_begin0 # DW_AT_low_pc177 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc178 .byte 2 # Abbrev [2] 0x2a:0x26 DW_TAG_subprogram179 .quad .Lfunc_begin0 # DW_AT_low_pc180 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc181 .byte 1 # DW_AT_frame_base182 .byte 87183 .long .Linfo_string3 # DW_AT_linkage_name184 .long .Linfo_string3 # DW_AT_name185 .byte 1 # DW_AT_decl_file186 .byte 1 # DW_AT_decl_line187 # DW_AT_external188 .byte 3 # Abbrev [3] 0x43:0xc DW_TAG_variable189 .byte 0 # DW_AT_const_value190 .long .Linfo_string4 # DW_AT_name191 .byte 1 # DW_AT_decl_file192 .byte 1 # DW_AT_decl_line193 .long 80 # DW_AT_type194 .byte 0 # End Of Children Mark195 .byte 4 # Abbrev [4] 0x50:0x7 DW_TAG_base_type196 .long .Linfo_string5 # DW_AT_name197 .byte 7 # DW_AT_encoding198 .byte 4 # DW_AT_byte_size199 .byte 0 # End Of Children Mark200.Ldebug_info_end0:201 .section .debug_str,"MS",@progbits,1202.Linfo_string0:203 .asciz "debugify" # string offset=0204.Linfo_string1:205 .asciz "<invalid>" # string offset=9206.Linfo_string2:207 .asciz "" # string offset=17208.Linfo_string3:209 .asciz "foo" # string offset=19210.Linfo_string4:211 .asciz "1" # string offset=23212.Linfo_string5:213 .asciz "ty32" # string offset=25214 .section .debug_pubnames,"",@progbits215 .long .LpubNames_end0-.LpubNames_start0 # Length of Public Names Info216.LpubNames_start0:217 .short 2 # DWARF Version218 .long .Lcu_begin0 # Offset of Compilation Unit Info219 .long 88 # Compilation Unit Length220 .long 42 # DIE offset221 .asciz "foo" # External Name222 .long 0 # End Mark223.LpubNames_end0:224 .section .debug_pubtypes,"",@progbits225 .long .LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info226.LpubTypes_start0:227 .short 2 # DWARF Version228 .long .Lcu_begin0 # Offset of Compilation Unit Info229 .long 88 # Compilation Unit Length230 .long 80 # DIE offset231 .asciz "ty32" # External Name232 .long 0 # End Mark233.LpubTypes_end0:234 .section ".note.GNU-stack","",@progbits235 .addrsig236 .addrsig_sym bar237 .section .debug_line,"",@progbits238.Lline_table_start0:239