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