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