1RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto-dw4.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
2
3CHECK: file format Mach-O 64-bit x86-64
4
5CHECK: debug_info contents
6
7CHECK:  Compile Unit: {{.*}} version = 0x0004
8CHECK:  DW_TAG_compile_unit [1] *
9CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
10CHECK:    DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
11CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000016] = "basic1.c")
12CHECK:    DW_AT_stmt_list [DW_FORM_sec_offset]      (0x00000000)
13CHECK:    DW_AT_comp_dir [DW_FORM_strp]	( .debug_str[0x0000001f] = "/Inputs")
14CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f40)
15CHECK:    DW_AT_high_pc [DW_FORM_data4]     (0x0000000b)
16CHECK:    DW_TAG_subprogram [2] *
17CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f40)
18CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x0000000b)
19CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
20CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000027] = "main")
21CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
22CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
23CHECK:      DW_AT_type [DW_FORM_ref_addr]   (0x00000000000000a1)
24CHECK:      DW_AT_external [DW_FORM_flag_present]	(true)
25CHECK:      DW_TAG_formal_parameter [3]
26CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x3> 55 93 04 )
27CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000002c] = "argc")
28CHECK:        DW_AT_decl_file [DW_FORM_data1]       ("/Inputs{{[/\\]}}basic1.c")
29CHECK:        DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1)
30CHECK:      DW_TAG_formal_parameter [4]
31CHECK:        DW_AT_location [DW_FORM_exprloc]	(<0x1> 54 )
32CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000031] = "argv")
33CHECK:        DW_AT_type [DW_FORM_ref4]     (cu + 0x0060 => {0x00000060})
34CHECK:      NULL
35CHECK:    DW_TAG_pointer_type [5]
36CHECK:       DW_AT_type [DW_FORM_ref4]       (cu + 0x0065 => {0x00000065})
37CHECK:    DW_TAG_pointer_type [5]
38CHECK:    DW_TAG_const_type [6]
39CHECK:    DW_TAG_base_type [7]
40CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000036] = "char")
41CHECK:      DW_AT_encoding [DW_FORM_data1]	(DW_ATE_signed_char)
42CHECK:      DW_AT_byte_size [DW_FORM_data1]	(0x01)
43CHECK:    NULL
44
45CHECK:  Compile Unit:{{.*}} version = 0x0004
46
47CHECK:  DW_TAG_compile_unit [1] *
48CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
49CHECK:    DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
50CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000003b] = "basic2.c")
51CHECK:    DW_AT_stmt_list [DW_FORM_sec_offset]      (0x00000044)
52CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f50)
53CHECK:    DW_AT_high_pc [DW_FORM_data4]     (0x00000037)
54CHECK:    DW_TAG_base_type [7]
55CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000044] = "int")
56CHECK:    DW_TAG_variable [8]
57CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000048] = "baz")
58CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 00 10 00 00 01 00 00 00 )
59CHECK:    DW_TAG_variable [8]
60CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000004c] = "private_int")
61CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
62CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 08 10 00 00 01 00 00 00 )
63CHECK:    DW_TAG_subprogram [9]
64CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
65CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
66CHECK:      DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)
67CHECK:    DW_TAG_subprogram [10] *
68CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f50)
69CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000037)
70CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
71CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000005c] = "foo")
72CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
73CHECK:      DW_AT_prototyped [DW_FORM_flag_present]	(true)
74CHECK:      DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
75CHECK:      DW_TAG_formal_parameter [11]
76CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000000)
77CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
78CHECK:        DW_AT_type [DW_FORM_ref4]	(cu + 0x002a => {0x000000a1})
79CHECK:      DW_TAG_inlined_subroutine [12]
80CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]	(cu + 0x005b => {0x000000d2} "inc")
81CHECK:        DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f61)
82CHECK:        DW_AT_high_pc [DW_FORM_data4]	(0x0000000f)
83CHECK:      NULL
84CHECK:    NULL
85
86CHECK:  Compile Unit: {{.*}} version = 0x0004
87
88CHECK:  DW_TAG_compile_unit [1] *
89CHECK:    DW_AT_producer [DW_FORM_strp]	( .debug_str[0x00000001] = "clang version 3.7.0 ")
90CHECK:    DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000064] = "basic3.c")
91CHECK:    DW_AT_stmt_list [DW_FORM_sec_offset]      (0x0000009a)
92CHECK:    DW_AT_low_pc [DW_FORM_addr]       (0x0000000100000f90)
93CHECK:    DW_AT_high_pc [DW_FORM_data4]     (0x00000024)
94CHECK:    DW_TAG_variable [13]
95CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x0000006d] = "val")
96CHECK:      DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
97CHECK:      DW_AT_location [DW_FORM_exprloc]	(<0x9> 03 04 10 00 00 01 00 00 00 )
98CHECK:    DW_TAG_volatile_type [14]
99CHECK:    DW_TAG_subprogram [15]
100CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000058] = "inc")
101CHECK:      DW_AT_inline [DW_FORM_data1]	(DW_INL_inlined)
102CHECK:    DW_TAG_subprogram [2] *
103CHECK:      DW_AT_low_pc [DW_FORM_addr]	(0x0000000100000f90)
104CHECK:      DW_AT_high_pc [DW_FORM_data4]	(0x00000024)
105CHECK:      DW_AT_frame_base [DW_FORM_exprloc]	(<0x1> 56 )
106CHECK:      DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000071] = "bar")
107CHECK:      DW_TAG_formal_parameter [16]
108CHECK:        DW_AT_location [DW_FORM_sec_offset]   (0x00000025)
109CHECK:        DW_AT_name [DW_FORM_strp]	( .debug_str[0x00000060] = "arg")
110CHECK:      DW_TAG_inlined_subroutine [17]
111CHECK:        DW_AT_abstract_origin [DW_FORM_ref4]	(cu + 0x0044 => {0x0000015f} "inc")
112CHECK:        DW_AT_ranges [DW_FORM_sec_offset]     (0x00000000
113CHECK:           [0x0000000100000f94 - 0x0000000100000f9a)
114CHECK:           [0x0000000100000f9f - 0x0000000100000fa7))
115
116CHECK:      NULL
117CHECK:    NULL
118
119
120CHECK: .debug_loc contents:
121CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000
122CHECK-NEXT:                Ending address offset: 0x000000000000000c
123CHECK-NEXT:                 Location description: 55 93 04
124CHECK-NEXT: {{^$}}
125CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000
126CHECK-NEXT:                Ending address offset: 0x000000000000000f
127CHECK-NEXT:                 Location description: 55 93 04
128CHECK-NEXT: {{^$}}
129CHECK-NEXT:             Beginning address offset: 0x0000000000000019
130CHECK-NEXT:                Ending address offset: 0x000000000000001d
131CHECK-NEXT:                 Location description: 55 93 04
132
133CHECK: .debug_aranges contents:
134CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00
135CHECK-NEXT: [0x0000000100000f40 - 0x0000000100000f4b)
136CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000077, addr_size = 0x08, seg_size = 0x00
137CHECK-NEXT: [0x0000000100000f50 - 0x0000000100000f87)
138CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x0000011b, addr_size = 0x08, seg_size = 0x00
139CHECK-NEXT: [0x0000000100000f90 - 0x0000000100000fb4)
140
141CHECK: .debug_line contents:
142CHECK:                 Dir  Mod Time   File Len   File Name
143CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
144CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic1.c
145CHECK: Address            Line   Column File   ISA Discriminator Flags
146CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
147CHECK-NEXT: 0x0000000100000f40     26      0      1   0             0  is_stmt
148CHECK-NEXT: 0x0000000100000f44     27     10      1   0             0  is_stmt prologue_end
149CHECK-NEXT: 0x0000000100000f49     27      3      1   0             0
150CHECK-NEXT: 0x0000000100000f4b     27      3      1   0             0  end_sequence
151
152CHECK:                 Dir  Mod Time   File Len   File Name
153CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
154CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic2.c
155CHECK: Address            Line   Column File   ISA Discriminator Flags
156CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
157CHECK-NEXT: 0x0000000100000f50     19      0      1   0             0  is_stmt
158CHECK-NEXT: 0x0000000100000f54     20     18      1   0             0  is_stmt prologue_end
159CHECK-NEXT: 0x0000000100000f5a     20     17      1   0             0
160CHECK-NEXT: 0x0000000100000f5c     20     10      1   0             0
161CHECK-NEXT: 0x0000000100000f61     15     10      1   0             0  is_stmt
162CHECK-NEXT: 0x0000000100000f70     20     23      1   0             0  is_stmt
163CHECK-NEXT: 0x0000000100000f74     20     36      1   0             0
164CHECK-NEXT: 0x0000000100000f83     20     31      1   0             0
165CHECK-NEXT: 0x0000000100000f85     20      3      1   0             0
166CHECK-NEXT: 0x0000000100000f87     20      3      1   0             0  end_sequence
167
168CHECK:                 Dir  Mod Time   File Len   File Name
169CHECK-NEXT:                 ---- ---------- ---------- ---------------------------
170CHECK-NEXT: file_names[  1]    0 0x00000000 0x00000000 basic3.c
171CHECK: Address            Line   Column File   ISA Discriminator Flags
172CHECK-NEXT: ------------------ ------ ------ ------ --- ------------- -------------
173CHECK-NEXT: 0x0000000100000f90     16      0      1   0             0  is_stmt
174CHECK-NEXT: 0x0000000100000f94     12     10      1   0             0  is_stmt prologue_end
175CHECK-NEXT: 0x0000000100000f9a     17      7      1   0             0  is_stmt
176CHECK-NEXT: 0x0000000100000f9f     12     10      1   0             0  is_stmt
177CHECK-NEXT: 0x0000000100000fa7     20      1      1   0             0  is_stmt
178CHECK-NEXT: 0x0000000100000fa9     19     18      1   0             0  is_stmt
179CHECK-NEXT: 0x0000000100000fab     19     10      1   0             0
180CHECK-NEXT: 0x0000000100000fb2     20      1      1   0             0  is_stmt
181CHECK-NEXT: 0x0000000100000fb4     20      1      1   0             0  is_stmt end_sequence
182
183CHECK: .debug_pubnames contents:
184CHECK-NEXT: length = 0x00000017 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000077
185CHECK-NEXT: Offset     Name
186CHECK-NEXT: 0x0000002a "main"
187CHECK-NEXT: length = 0x0000002e version = 0x0002 unit_offset = 0x00000077 unit_size = 0x000000a4
188CHECK-NEXT: Offset     Name
189CHECK-NEXT: 0x00000031 "baz"
190CHECK-NEXT: 0x00000046 "private_int"
191CHECK-NEXT: 0x00000067 "foo"
192CHECK-NEXT: length = 0x0000001e version = 0x0002 unit_offset = 0x0000011b unit_size = 0x00000085
193CHECK-NEXT: Offset     Name
194CHECK-NEXT: 0x0000002a "val"
195CHECK-NEXT: 0x00000050 "bar"
196
197CHECK: .debug_pubtypes contents:
198CHECK-NEXT: length = 0x00000017 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000077
199CHECK-NEXT: Offset     Name
200CHECK-NEXT: 0x0000006f "char"
201CHECK-NEXT: length = 0x00000016 version = 0x0002 unit_offset = 0x00000077 unit_size = 0x000000a4
202CHECK-NEXT: Offset     Name
203CHECK-NEXT: 0x0000002a "int"
204