1RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1 2RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %t1 3RUN: llvm-dwarfdump %t1.dwarf | FileCheck %s 4RUN: llvm-dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 5RUN: llvm-dwarfdump %t2 | FileCheck %s 6RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC 7RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE 8RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -f -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC 9RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -f -o - -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE 10 11CHECK: file format Mach-O 64-bit x86-64 12 13CHECK: debug_info contents 14 15CHECK: Compile Unit: 16 17CHECK: DW_TAG_compile_unit [1] * 18CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)") 19CHECK: DW_AT_language [DW_FORM_data2] (DW_LANG_C99) 20CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000040] = "basic1.c") 21CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x00000000) 22CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000049] = "/Inputs") 23CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ea0) 24CHECK: DW_TAG_subprogram [2] * 25CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000051] = "main") 26CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") 27CHECK: DW_AT_decl_line [DW_FORM_data1] (23) 28CHECK: DW_AT_prototyped [DW_FORM_flag] (0x01) 29CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063}) 30CHECK: DW_AT_external [DW_FORM_flag] (0x01) 31CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) 32CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ea0) 33CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000ec4) 34CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) 35CHECK: DW_TAG_formal_parameter [3] 36CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000056] = "argc") 37CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") 38CHECK: DW_AT_decl_line [DW_FORM_data1] (23) 39CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063}) 40CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 78 ) 41CHECK: DW_TAG_formal_parameter [3] 42CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005b] = "argv") 43CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") 44CHECK: DW_AT_decl_line [DW_FORM_data1] (23) 45CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006a => {0x0000006a}) 46CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 70 ) 47CHECK: NULL 48CHECK: DW_TAG_base_type [4] 49CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int") 50CHECK: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed) 51CHECK: DW_AT_byte_size [DW_FORM_data1] (0x04) 52CHECK: DW_TAG_pointer_type [5] 53CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006f => {0x0000006f}) 54CHECK: DW_TAG_pointer_type [5] 55CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x00000074}) 56CHECK: DW_TAG_const_type [6] 57CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0079 => {0x00000079}) 58CHECK: DW_TAG_base_type [4] 59CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000064] = "char") 60CHECK: DW_AT_encoding [DW_FORM_data1] (DW_ATE_signed_char) 61CHECK: DW_AT_byte_size [DW_FORM_data1] (0x01) 62CHECK: NULL 63 64CHECK: Compile Unit: 65 66CHECK: DW_TAG_compile_unit [1] * 67CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)") 68CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "basic2.c") 69CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x0000003f) 70CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000049] = "/Inputs") 71CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ed0) 72CHECK: DW_TAG_base_type [4] 73CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int") 74CHECK: DW_TAG_variable [7] 75CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000072] = "private_int") 76CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) 77CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") 78BASIC: DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 ) 79ARCHIVE: DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 ) 80CHECK: DW_TAG_variable [7] 81CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "baz") 82CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) 83CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") 84CHECK: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 ) 85CHECK: DW_TAG_subprogram [2] * 86CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000082] = "foo") 87CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") 88CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) 89CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ed0) 90CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f19) 91CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) 92CHECK: DW_TAG_formal_parameter [3] 93CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") 94CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) 95CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 7c ) 96CHECK: NULL 97CHECK: DW_TAG_subprogram [8] 98CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc") 99CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) 100CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f20) 101CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f37) 102CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) 103CHECK: NULL 104 105CHECK: Compile Unit: 106 107CHECK: DW_TAG_compile_unit [1] * 108CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)") 109CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "basic3.c") 110CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x00000093) 111CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000049] = "/Inputs") 112CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) 113CHECK: DW_TAG_variable [9] 114CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000097] = "val") 115CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x003c => {0x00000162}) 116CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c") 117BASIC: DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 ) 118ARCHIVE: DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 ) 119CHECK: DW_TAG_volatile_type [10] 120CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) 121CHECK: DW_TAG_base_type [4] 122CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int") 123CHECK: DW_TAG_subprogram [2] * 124CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000009b] = "bar") 125CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) 126CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) 127CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f84) 128CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) 129CHECK: DW_TAG_formal_parameter [3] 130CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") 131CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) 132CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 78 ) 133CHECK: NULL 134CHECK: DW_TAG_subprogram [8] 135CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc") 136CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) 137CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90) 138CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fa9) 139CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) 140 141CHECK: NULL 142 143CHECK: .debug_loc contents 144CHECK-NOT: Location 145 146CHECK:.debug_aranges contents: 147CHECK-NEXT:Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00 148CHECK-NEXT:[0x0000000100000ea0 - 0x0000000100000ec4) 149CHECK-NEXT:Address Range Header: length = 0x0000003c, version = 0x0002, cu_offset = 0x00000081, addr_size = 0x08, seg_size = 0x00 150CHECK-NEXT:[0x0000000100000ed0 - 0x0000000100000f19) 151CHECK-NEXT:[0x0000000100000f20 - 0x0000000100000f37) 152CHECK-NEXT:Address Range Header: length = 0x0000003c, version = 0x0002, cu_offset = 0x00000126, addr_size = 0x08, seg_size = 0x00 153CHECK-NEXT:[0x0000000100000f40 - 0x0000000100000f84) 154CHECK-NEXT:[0x0000000100000f90 - 0x0000000100000fa9) 155 156CHECK: .debug_line contents: 157CHECK: Dir Mod Time File Len File Name 158CHECK-NEXT: ---- ---------- ---------- --------------------------- 159CHECK-NEXT: file_names[ 1] 0 0x00000000 0x00000000 basic1.c 160CHECK: Address Line Column File ISA Discriminator Flags 161CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- ------------- 162CHECK-NEXT: 0x0000000100000ea0 23 0 1 0 0 is_stmt 163CHECK-NEXT: 0x0000000100000eb6 24 0 1 0 0 is_stmt prologue_end 164CHECK-NEXT: 0x0000000100000ec4 24 0 1 0 0 is_stmt end_sequence 165 166CHECK: Dir Mod Time File Len File Name 167CHECK-NEXT: ---- ---------- ---------- --------------------------- 168CHECK-NEXT: file_names[ 1] 0 0x00000000 0x00000000 basic2.c 169CHECK: Address Line Column File ISA Discriminator Flags 170CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- ------------- 171CHECK-NEXT: 0x0000000100000ed0 19 0 1 0 0 is_stmt 172CHECK-NEXT: 0x0000000100000ee2 20 0 1 0 0 is_stmt prologue_end 173CHECK-NEXT: 0x0000000100000f19 20 0 1 0 0 is_stmt end_sequence 174CHECK-NEXT: 0x0000000100000f20 14 0 1 0 0 is_stmt 175CHECK-NEXT: 0x0000000100000f24 15 0 1 0 0 is_stmt prologue_end 176CHECK-NEXT: 0x0000000100000f37 15 0 1 0 0 is_stmt end_sequence 177 178CHECK: Dir Mod Time File Len File Name 179CHECK-NEXT: ---- ---------- ---------- --------------------------- 180CHECK-NEXT: file_names[ 1] 0 0x00000000 0x00000000 basic3.c 181CHECK: Address Line Column File ISA Discriminator Flags 182CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- ------------- 183CHECK-NEXT: 0x0000000100000f40 16 0 1 0 0 is_stmt 184CHECK-NEXT: 0x0000000100000f4b 17 0 1 0 0 is_stmt prologue_end 185CHECK-NEXT: 0x0000000100000f58 18 0 1 0 0 is_stmt 186CHECK-NEXT: 0x0000000100000f6c 19 0 1 0 0 is_stmt 187CHECK-NEXT: 0x0000000100000f7b 20 0 1 0 0 is_stmt 188CHECK-NEXT: 0x0000000100000f84 20 0 1 0 0 is_stmt end_sequence 189CHECK-NEXT: 0x0000000100000f90 11 0 1 0 0 is_stmt 190CHECK-NEXT: 0x0000000100000f9b 12 0 1 0 0 is_stmt prologue_end 191CHECK-NEXT: 0x0000000100000fa9 12 0 1 0 0 is_stmt end_sequence 192 193CHECK: .debug_pubnames contents: 194CHECK-NEXT: length = 0x00000017 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081 195CHECK-NEXT: Offset Name 196CHECK-NEXT: 0x00000026 "main" 197CHECK-NEXT: length = 0x00000036 version = 0x0002 unit_offset = 0x00000081 unit_size = 0x000000a5 198CHECK-NEXT: Offset Name 199CHECK-NEXT: 0x0000002d "private_int" 200CHECK-NEXT: 0x00000042 "baz" 201CHECK-NEXT: 0x00000057 "foo" 202CHECK-NEXT: 0x00000086 "inc" 203CHECK-NEXT: length = 0x00000026 version = 0x0002 unit_offset = 0x00000126 unit_size = 0x00000096 204CHECK-NEXT: Offset Name 205CHECK-NEXT: 0x00000026 "val" 206CHECK-NEXT: 0x00000048 "bar" 207CHECK-NEXT: 0x00000077 "inc" 208 209CHECK: .debug_pubtypes contents: 210CHECK-NEXT: length = 0x0000001f version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081 211CHECK-NEXT: Offset Name 212CHECK-NEXT: 0x00000063 "int" 213CHECK-NEXT: 0x00000079 "char" 214CHECK-NEXT: length = 0x00000016 version = 0x0002 unit_offset = 0x00000081 unit_size = 0x000000a5 215CHECK-NEXT: Offset Name 216CHECK-NEXT: 0x00000026 "int" 217CHECK-NEXT: length = 0x00000016 version = 0x0002 unit_offset = 0x00000126 unit_size = 0x00000096 218CHECK-NEXT: Offset Name 219CHECK-NEXT: 0x00000041 "int" 220