1# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ 2# RUN: | not llvm-dwarfdump -lookup=0xffffffff - | \ 3# RUN: FileCheck %s --check-prefix=EMPTY --allow-empty 4# EMPTY: {{^$}} 5 6# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ 7# RUN: | not llvm-dwarfdump -lookup=0xffffffffffffffff - | \ 8# RUN: FileCheck %s --check-prefix=EMPTY --allow-empty 9# EMPTY: {{^$}} 10 11# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ 12# RUN: | llvm-dwarfdump -lookup=0x4 - | \ 13# RUN: FileCheck %s -check-prefixes=CHECK,LEX,A 14 15# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ 16# RUN: | llvm-dwarfdump -lookup=0xb - | \ 17# RUN: FileCheck %s -check-prefixes=CHECK,LEX,B 18 19# RUN: llvm-mc %s -filetype obj -triple x86_64-apple-darwin -o - \ 20# RUN: | llvm-dwarfdump -lookup=0x14 - | \ 21# RUN: FileCheck %s -check-prefixes=CHECK,C 22 23# CHECK: Compile Unit: length = 0x00000060, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000064) 24 25# CHECK: DW_TAG_compile_unit 26# CHECK: DW_AT_name ("foo.c") 27# CHECK: DW_AT_stmt_list (0x00000000) 28# CHECK: DW_AT_low_pc (0x0000000000000000) 29# CHECK: DW_AT_high_pc (0x0000000000000016) 30 31# CHECK: DW_TAG_subprogram 32# CHECK: DW_AT_low_pc (0x0000000000000000) 33# CHECK: DW_AT_high_pc (0x0000000000000016) 34# CHECK: DW_AT_name ("foo") 35 36# LEX: DW_TAG_lexical_block 37# LEX: DW_AT_low_pc (0x0000000000000004) 38# LEX: DW_AT_high_pc (0x0000000000000014) 39 40# A: Line info: file 'foo.c', line 3, column 9, start file 'foo.c', start line 1 41# B: Line info: file 'foo.c', line 4, column 6, start file 'foo.c', start line 1 42# C: Line info: file 'foo.c', line 6, column 1, start file 'foo.c', start line 1 43 44 .section __TEXT,__text,regular,pure_instructions 45 .macosx_version_min 10, 13 46 .globl _foo ## -- Begin function foo 47 .p2align 4, 0x90 48_foo: ## @foo 49Lfunc_begin0: 50 .file 1 "foo.c" 51 .loc 1 1 0 ## foo.c:1:0 52 .cfi_startproc 53## %bb.0: ## %entry 54 pushq %rbp 55Lcfi0: 56 .cfi_def_cfa_offset 16 57Lcfi1: 58 .cfi_offset %rbp, -16 59 movq %rsp, %rbp 60Lcfi2: 61 .cfi_def_cfa_register %rbp 62Ltmp0: 63 .loc 1 3 9 prologue_end ## foo.c:3:9 64 movl $1, -4(%rbp) 65 .loc 1 4 6 ## foo.c:4:6 66 movl -4(%rbp), %eax 67 addl $1, %eax 68 movl %eax, -4(%rbp) 69Ltmp1: 70 .loc 1 6 1 ## foo.c:6:1 71 popq %rbp 72 retq 73Ltmp2: 74Lfunc_end0: 75 .cfi_endproc 76 ## -- End function 77 .section __DWARF,__debug_str,regular,debug 78Linfo_string: 79 .asciz "clang version 6.0.0 (trunk 314509) (llvm/trunk 314517)" ## string offset=0 80 .asciz "foo.c" ## string offset=55 81 .asciz "/private/tmp" ## string offset=61 82 .asciz "foo" ## string offset=74 83 .asciz "i" ## string offset=78 84 .asciz "int" ## string offset=80 85 .section __DWARF,__debug_abbrev,regular,debug 86Lsection_abbrev: 87 .byte 1 ## Abbreviation Code 88 .byte 17 ## DW_TAG_compile_unit 89 .byte 1 ## DW_CHILDREN_yes 90 .byte 37 ## DW_AT_producer 91 .byte 14 ## DW_FORM_strp 92 .byte 19 ## DW_AT_language 93 .byte 5 ## DW_FORM_data2 94 .byte 3 ## DW_AT_name 95 .byte 14 ## DW_FORM_strp 96 .byte 16 ## DW_AT_stmt_list 97 .byte 23 ## DW_FORM_sec_offset 98 .byte 27 ## DW_AT_comp_dir 99 .byte 14 ## DW_FORM_strp 100 .byte 17 ## DW_AT_low_pc 101 .byte 1 ## DW_FORM_addr 102 .byte 18 ## DW_AT_high_pc 103 .byte 6 ## DW_FORM_data4 104 .byte 0 ## EOM(1) 105 .byte 0 ## EOM(2) 106 .byte 2 ## Abbreviation Code 107 .byte 46 ## DW_TAG_subprogram 108 .byte 1 ## DW_CHILDREN_yes 109 .byte 17 ## DW_AT_low_pc 110 .byte 1 ## DW_FORM_addr 111 .byte 18 ## DW_AT_high_pc 112 .byte 6 ## DW_FORM_data4 113 .byte 64 ## DW_AT_frame_base 114 .byte 24 ## DW_FORM_exprloc 115 .byte 3 ## DW_AT_name 116 .byte 14 ## DW_FORM_strp 117 .byte 58 ## DW_AT_decl_file 118 .byte 11 ## DW_FORM_data1 119 .byte 59 ## DW_AT_decl_line 120 .byte 11 ## DW_FORM_data1 121 .byte 63 ## DW_AT_external 122 .byte 25 ## DW_FORM_flag_present 123 .byte 0 ## EOM(1) 124 .byte 0 ## EOM(2) 125 .byte 3 ## Abbreviation Code 126 .byte 11 ## DW_TAG_lexical_block 127 .byte 1 ## DW_CHILDREN_yes 128 .byte 17 ## DW_AT_low_pc 129 .byte 1 ## DW_FORM_addr 130 .byte 18 ## DW_AT_high_pc 131 .byte 6 ## DW_FORM_data4 132 .byte 0 ## EOM(1) 133 .byte 0 ## EOM(2) 134 .byte 4 ## Abbreviation Code 135 .byte 52 ## DW_TAG_variable 136 .byte 0 ## DW_CHILDREN_no 137 .byte 2 ## DW_AT_location 138 .byte 24 ## DW_FORM_exprloc 139 .byte 3 ## DW_AT_name 140 .byte 14 ## DW_FORM_strp 141 .byte 58 ## DW_AT_decl_file 142 .byte 11 ## DW_FORM_data1 143 .byte 59 ## DW_AT_decl_line 144 .byte 11 ## DW_FORM_data1 145 .byte 73 ## DW_AT_type 146 .byte 19 ## DW_FORM_ref4 147 .byte 0 ## EOM(1) 148 .byte 0 ## EOM(2) 149 .byte 5 ## Abbreviation Code 150 .byte 36 ## DW_TAG_base_type 151 .byte 0 ## DW_CHILDREN_no 152 .byte 3 ## DW_AT_name 153 .byte 14 ## DW_FORM_strp 154 .byte 62 ## DW_AT_encoding 155 .byte 11 ## DW_FORM_data1 156 .byte 11 ## DW_AT_byte_size 157 .byte 11 ## DW_FORM_data1 158 .byte 0 ## EOM(1) 159 .byte 0 ## EOM(2) 160 .byte 0 ## EOM(3) 161 .section __DWARF,__debug_info,regular,debug 162Lsection_info: 163Lcu_begin0: 164 .long 96 ## Length of Unit 165 .short 4 ## DWARF version number 166Lset0 = Lsection_abbrev-Lsection_abbrev ## Offset Into Abbrev. Section 167 .long Lset0 168 .byte 8 ## Address Size (in bytes) 169 .byte 1 ## Abbrev [1] 0xb:0x59 DW_TAG_compile_unit 170 .long 0 ## DW_AT_producer 171 .short 12 ## DW_AT_language 172 .long 55 ## DW_AT_name 173Lset1 = Lline_table_start0-Lsection_line ## DW_AT_stmt_list 174 .long Lset1 175 .long 61 ## DW_AT_comp_dir 176 .quad Lfunc_begin0 ## DW_AT_low_pc 177Lset2 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc 178 .long Lset2 179 .byte 2 ## Abbrev [2] 0x2a:0x32 DW_TAG_subprogram 180 .quad Lfunc_begin0 ## DW_AT_low_pc 181Lset3 = Lfunc_end0-Lfunc_begin0 ## DW_AT_high_pc 182 .long Lset3 183 .byte 1 ## DW_AT_frame_base 184 .byte 86 185 .long 74 ## DW_AT_name 186 .byte 1 ## DW_AT_decl_file 187 .byte 1 ## DW_AT_decl_line 188 ## DW_AT_external 189 .byte 3 ## Abbrev [3] 0x3f:0x1c DW_TAG_lexical_block 190 .quad Ltmp0 ## DW_AT_low_pc 191Lset4 = Ltmp1-Ltmp0 ## DW_AT_high_pc 192 .long Lset4 193 .byte 4 ## Abbrev [4] 0x4c:0xe DW_TAG_variable 194 .byte 2 ## DW_AT_location 195 .byte 145 196 .byte 124 197 .long 78 ## DW_AT_name 198 .byte 1 ## DW_AT_decl_file 199 .byte 3 ## DW_AT_decl_line 200 .long 92 ## DW_AT_type 201 .byte 0 ## End Of Children Mark 202 .byte 0 ## End Of Children Mark 203 .byte 5 ## Abbrev [5] 0x5c:0x7 DW_TAG_base_type 204 .long 80 ## DW_AT_name 205 .byte 5 ## DW_AT_encoding 206 .byte 4 ## DW_AT_byte_size 207 .byte 0 ## End Of Children Mark 208 .section __DWARF,__debug_ranges,regular,debug 209Ldebug_range: 210 .section __DWARF,__debug_macinfo,regular,debug 211Ldebug_macinfo: 212Lcu_macro_begin0: 213 .byte 0 ## End Of Macro List Mark 214 .section __DWARF,__apple_names,regular,debug 215Lnames_begin: 216 .long 1212240712 ## Header Magic 217 .short 1 ## Header Version 218 .short 0 ## Header Hash Function 219 .long 1 ## Header Bucket Count 220 .long 1 ## Header Hash Count 221 .long 12 ## Header Data Length 222 .long 0 ## HeaderData Die Offset Base 223 .long 1 ## HeaderData Atom Count 224 .short 1 ## DW_ATOM_die_offset 225 .short 6 ## DW_FORM_data4 226 .long 0 ## Bucket 0 227 .long 193491849 ## Hash in Bucket 0 228 .long LNames0-Lnames_begin ## Offset in Bucket 0 229LNames0: 230 .long 74 ## foo 231 .long 1 ## Num DIEs 232 .long 42 233 .long 0 234 .section __DWARF,__apple_objc,regular,debug 235Lobjc_begin: 236 .long 1212240712 ## Header Magic 237 .short 1 ## Header Version 238 .short 0 ## Header Hash Function 239 .long 1 ## Header Bucket Count 240 .long 0 ## Header Hash Count 241 .long 12 ## Header Data Length 242 .long 0 ## HeaderData Die Offset Base 243 .long 1 ## HeaderData Atom Count 244 .short 1 ## DW_ATOM_die_offset 245 .short 6 ## DW_FORM_data4 246 .long -1 ## Bucket 0 247 .section __DWARF,__apple_namespac,regular,debug 248Lnamespac_begin: 249 .long 1212240712 ## Header Magic 250 .short 1 ## Header Version 251 .short 0 ## Header Hash Function 252 .long 1 ## Header Bucket Count 253 .long 0 ## Header Hash Count 254 .long 12 ## Header Data Length 255 .long 0 ## HeaderData Die Offset Base 256 .long 1 ## HeaderData Atom Count 257 .short 1 ## DW_ATOM_die_offset 258 .short 6 ## DW_FORM_data4 259 .long -1 ## Bucket 0 260 .section __DWARF,__apple_types,regular,debug 261Ltypes_begin: 262 .long 1212240712 ## Header Magic 263 .short 1 ## Header Version 264 .short 0 ## Header Hash Function 265 .long 1 ## Header Bucket Count 266 .long 1 ## Header Hash Count 267 .long 20 ## Header Data Length 268 .long 0 ## HeaderData Die Offset Base 269 .long 3 ## HeaderData Atom Count 270 .short 1 ## DW_ATOM_die_offset 271 .short 6 ## DW_FORM_data4 272 .short 3 ## DW_ATOM_die_tag 273 .short 5 ## DW_FORM_data2 274 .short 4 ## DW_ATOM_type_flags 275 .short 11 ## DW_FORM_data1 276 .long 0 ## Bucket 0 277 .long 193495088 ## Hash in Bucket 0 278 .long Ltypes0-Ltypes_begin ## Offset in Bucket 0 279Ltypes0: 280 .long 80 ## int 281 .long 1 ## Num DIEs 282 .long 92 283 .short 36 284 .byte 0 285 .long 0 286 287.subsections_via_symbols 288 .section __DWARF,__debug_line,regular,debug 289Lsection_line: 290Lline_table_start0: 291