RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -f -o - -y - | llvm-dwarfdump - | FileCheck %s

CHECK: file format Mach-O 64-bit x86-64

CHECK: debug_info contents

CHECK:  Compile Unit:

CHECK:  DW_TAG_compile_unit [1] *
CHECK:    DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
CHECK:    DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
CHECK:    DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000040] = "basic1.c")
CHECK:    DW_AT_stmt_list [DW_FORM_data4]   (0x00000000)
CHECK:    DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f40)
CHECK:    DW_TAG_subprogram [2] *
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000051] = "main")
CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
CHECK:      DW_AT_decl_line [DW_FORM_data1]	(23)
CHECK:      DW_AT_prototyped [DW_FORM_flag]	(0x01)
CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0063 => {0x00000063})
CHECK:      DW_AT_external [DW_FORM_flag]	(0x01)
CHECK:      DW_AT_accessibility [DW_FORM_data1]	(DW_ACCESS_public)
CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f40)
CHECK:      DW_AT_high_pc [DW_FORM_addr]     (0x0000000100000f4b)
CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
CHECK:      DW_TAG_formal_parameter [3]
CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000056] = "argc")
CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0063 => {0x00000063})
CHECK:        DW_AT_location [DW_FORM_block1]	(<0x03> 55 93 04 )
CHECK:      DW_TAG_formal_parameter [3]
CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x0000005b] = "argv")
CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x006a => {0x0000006a})
CHECK:        DW_AT_location [DW_FORM_block1]	(<0x01> 54 )
CHECK:      NULL
CHECK:    DW_TAG_base_type [4]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000060] = "int")
CHECK:      DW_AT_encoding [DW_FORM_data1]	(DW_ATE_signed)
CHECK:      DW_AT_byte_size [DW_FORM_data1]	(0x04)
CHECK:    DW_TAG_pointer_type [5]
CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x006f => {0x0000006f})
CHECK:    DW_TAG_pointer_type [5]
CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0074 => {0x00000074})
CHECK:    DW_TAG_const_type [6]
CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x0079 => {0x00000079})
CHECK:    DW_TAG_base_type [4]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000064] = "char")
CHECK:      DW_AT_encoding [DW_FORM_data1]	(DW_ATE_signed_char)
CHECK:      DW_AT_byte_size [DW_FORM_data1]	(0x01)
CHECK:    NULL

CHECK:  Compile Unit:

CHECK:  DW_TAG_compile_unit [1] *
CHECK:    DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
CHECK:    DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000069] = "basic2.c")
CHECK:    DW_AT_stmt_list [DW_FORM_data4]   (0x0000003e)
CHECK:    DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
CHECK:   DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f50)
CHECK:    DW_TAG_variable [7]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000072] = "private_int")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 )
CHECK:    DW_TAG_variable [7]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000007e] = "baz")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 )
CHECK:    DW_TAG_subprogram [8] *
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000082] = "foo")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f50)
CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000f89)
CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
CHECK:      DW_TAG_formal_parameter [9]
CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000000)
CHECK:      DW_TAG_inlined_subroutine [10]
CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x00a7 => {0x00000128} "inc")
CHECK:        DW_AT_low_pc [DW_FORM_addr]   (0x0000000100000f63)
CHECK:        DW_AT_high_pc [DW_FORM_addr]  (0x0000000100000f72)
CHECK:        DW_AT_call_line [DW_FORM_data1]	(20)
CHECK:      NULL
CHECK:    DW_TAG_subprogram [11]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:      DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)
CHECK:    NULL

CHECK:  Compile Unit:

CHECK:  DW_TAG_compile_unit [1] *
CHECK:    DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
CHECK:    DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008e] = "basic3.c")
CHECK:    DW_AT_stmt_list [DW_FORM_data4]   (0x0000007e)
CHECK:    DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x00000049] = "/Inputs")
CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f90)
CHECK:    DW_TAG_variable [12]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x00000097] = "val")
CHECK:      DW_AT_type [DW_FORM_ref4]       (cu + 0x003c => {0x00000176})
CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
CHECK:      DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 )
CHECK:    DW_TAG_volatile_type [13]
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:    DW_TAG_subprogram [8] *
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000009b] = "bar")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:      DW_AT_low_pc [DW_FORM_addr]     (0x0000000100000f90)
CHECK:      DW_AT_high_pc [DW_FORM_addr]    (0x0000000100000fb4)
CHECK:      DW_AT_frame_base [DW_FORM_block1]	(<0x01> 56 )
CHECK:      DW_TAG_formal_parameter [9]
CHECK:        DW_AT_name [DW_FORM_strp]     ( .debug_str[0x00000086] = "arg")
CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK:        DW_AT_location [DW_FORM_data4]        (0x00000025)
CHECK:      DW_TAG_lexical_block [14] *
CHECK:        DW_AT_low_pc [DW_FORM_addr]   (0x0000000100000f94)
CHECK:        DW_AT_high_pc [DW_FORM_addr]  (0x0000000100000fa7)
CHECK:        DW_TAG_inlined_subroutine [15]
CHECK:          DW_AT_abstract_origin [DW_FORM_ref4]        (cu + 0x009a => {0x000001d4} "inc")
CHECK:          DW_AT_ranges [DW_FORM_data4]        (0x00000000
CHECK:             [0x0000000100000f94 - 0x0000000100000f9a)
CHECK:             [0x0000000100000f9f - 0x0000000100000fa7))
CHECK:        NULL
CHECK:      NULL
CHECK:    DW_TAG_subprogram [11]
CHECK:      DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000008a] = "inc")
CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x0000000000000063)
CHECK:    NULL

CHECK:.debug_loc contents:
CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000
CHECK-NEXT:                Ending address offset: 0x000000000000000e
CHECK-NEXT:                 Location description: 55 93 04 
CHECK-NEXT: {{^$}}
CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000
CHECK-NEXT:                Ending address offset: 0x000000000000000f
CHECK-NEXT:                 Location description: 55 93 04 
CHECK-NEXT: {{^$}}
CHECK-NEXT:             Beginning address offset: 0x0000000000000019
CHECK-NEXT:                Ending address offset: 0x000000000000001d
CHECK-NEXT:                 Location description: 55 93 04 

CHECK: .debug_aranges contents:
CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00
CHECK-NEXT: [0x0000000100000f40 - 0x0000000100000f4b)
CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000081, addr_size = 0x08, seg_size = 0x00
CHECK-NEXT: [0x0000000100000f50 - 0x0000000100000f89)
CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x0000013a, addr_size = 0x08, seg_size = 0x00
CHECK-NEXT: [0x0000000100000f90 - 0x0000000100000fb4)


CHECK: .debug_line contents
CHECK:                 Dir  Mod Time   File Len   File Name
CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic1.c
CHECK: Address            Line   Column File   ISA Discriminator Flags
CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
CHECK-NEXT: 0x0000000100000f40     23      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f44     24      0      1   0             0  is_stmt prologue_end
CHECK-NEXT: 0x0000000100000f4b     24      0      1   0             0  is_stmt end_sequence

CHECK:                 Dir  Mod Time   File Len   File Name
CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic2.c
CHECK: Address            Line   Column File   ISA Discriminator Flags
CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
CHECK-NEXT: 0x0000000100000f50     19      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f54     20      0      1   0             0  is_stmt prologue_end
CHECK-NEXT: 0x0000000100000f63     15      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f72     20      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f89     20      0      1   0             0  is_stmt end_sequence

CHECK:                 Dir  Mod Time   File Len   File Name
CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic3.c
CHECK: Address            Line   Column File   ISA Discriminator Flags
CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
CHECK-NEXT: 0x0000000100000f90     16      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f94     12      0      1   0             0  is_stmt prologue_end
CHECK-NEXT: 0x0000000100000f9a     17      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000f9f     12      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000fa7     20      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000fa9     19      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000fb2     20      0      1   0             0  is_stmt
CHECK-NEXT: 0x0000000100000fb4     20      0      1   0             0  is_stmt end_sequence

CHECK: .debug_pubnames contents:
CHECK-NEXT: length = 0x00000017 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081
CHECK-NEXT: Offset     Name
CHECK-NEXT: 0x00000026 "main"
CHECK-NEXT: length = 0x0000002e version = 0x0002 unit_offset = 0x00000081 unit_size = 0x000000b9
CHECK-NEXT: Offset     Name
CHECK-NEXT: 0x00000026 "private_int"
CHECK-NEXT: 0x0000003f "baz"
CHECK-NEXT: 0x00000058 "foo"
CHECK-NEXT: length = 0x0000001e version = 0x0002 unit_offset = 0x0000013a unit_size = 0x000000ac
CHECK-NEXT: Offset     Name
CHECK-NEXT: 0x00000026 "val"
CHECK-NEXT: 0x00000045 "bar"

CHECK: .debug_pubtypes contents:
CHECK-NEXT: length = 0x0000001f version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000081
CHECK-NEXT: Offset     Name
CHECK-NEXT: 0x00000063 "int"
CHECK-NEXT: 0x00000079 "char"