| 1 |
# RUN: yaml2obj %s -o %t.o |
| 2 |
# RUN: echo '---' > %t2.map |
| 3 |
# RUN: echo "triple: 'x86_64-apple-darwin'" >> %t2.map |
| 4 |
# RUN: echo 'objects:' >> %t2.map |
| 5 |
# RUN: echo " - filename: '%t.o'" >> %t2.map |
| 6 |
# RUN: echo ' symbols:' >> %t2.map |
| 7 |
# RUN: echo ' - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map |
| 8 |
# RUN: echo '...' >> %t2.map |
| 9 |
# RUN: dsymutil --linker=parallel -y %t2.map -f -o %t1.out |
| 10 |
# RUN: llvm-dwarfdump -a %t1.out | FileCheck %s |
| 11 |
|
| 12 |
## This test checks debug info for the case when one compilation unit |
| 13 |
## contains forward declaration of the type and another compilation unit |
| 14 |
## contains definition for that type. The result should have type table |
| 15 |
## containing definition for that type and corresponding variables should |
| 16 |
## properly reference that type. |
| 17 |
|
| 18 |
## CU1: |
| 19 |
## |
| 20 |
## class class1; |
| 21 |
## template<int> class class2; |
| 22 |
## |
| 23 |
## class1 *var1; |
| 24 |
## class2<int> *var2; |
| 25 |
## |
| 26 |
## CU2: |
| 27 |
## |
| 28 |
## class class1 { |
| 29 |
## char member1; |
| 30 |
## float member2; |
| 31 |
## }; |
| 32 |
## |
| 33 |
## template<int> class class2 { |
| 34 |
## char member1; |
| 35 |
## }; |
| 36 |
## |
| 37 |
## class1 *var1; |
| 38 |
## class2<int> *var2; |
| 39 |
|
| 40 |
# CHECK: file format Mach-O 64-bit x86-64 |
| 41 |
# CHECK: .debug_info contents: |
| 42 |
# CHECK: Compile Unit: |
| 43 |
# CHECK: DW_TAG_compile_unit |
| 44 |
# CHECK: DW_AT_name{{.*}}"__artificial_type_unit" |
| 45 |
|
| 46 |
# CHECK: 0x[[CHAR:[0-9a-f]*]]: DW_TAG_base_type |
| 47 |
# CHECK: DW_AT_name{{.*}}"char" |
| 48 |
|
| 49 |
# CHECK: 0x[[FLOAT:[0-9a-f]*]]: DW_TAG_base_type |
| 50 |
# CHECK: DW_AT_name{{.*}}"float" |
| 51 |
|
| 52 |
# CHECK: 0x[[INT:[0-9a-f]*]]: DW_TAG_base_type |
| 53 |
# CHECK: DW_AT_name{{.*}}"int" |
| 54 |
|
| 55 |
# CHECK: 0x[[CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1" |
| 56 |
# CHECK: DW_TAG_member |
| 57 |
# CHECK: DW_AT_type{{.*}}0x[[CHAR]] "char" |
| 58 |
# CHECK: DW_AT_name{{.*}}"member1" |
| 59 |
|
| 60 |
# CHECK: DW_TAG_member |
| 61 |
# CHECK: DW_AT_type{{.*}}0x[[FLOAT]] "float" |
| 62 |
# CHECK: DW_AT_name{{.*}}"member2" |
| 63 |
|
| 64 |
# CHECK: 0x[[CLASS2:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class2" |
| 65 |
# CHECK: DW_TAG_template_type_parameter{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[INT]] "int" |
| 66 |
# CHECK: DW_TAG_member |
| 67 |
# CHECK: DW_AT_type{{.*}}0x[[CHAR]] "char" |
| 68 |
# CHECK: DW_AT_name{{.*}}"member1" |
| 69 |
|
| 70 |
# CHECK: 0x[[PTR_CLASS1:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CLASS1]] "class1" |
| 71 |
|
| 72 |
# CHECK: 0x[[PTR_CLASS2:[0-9a-f]*]]: DW_TAG_pointer_type{{.*[[:space:]].*}}DW_AT_type{{.*}}0x[[CLASS2]] "class2<int>" |
| 73 |
|
| 74 |
# CHECK: DW_TAG_compile_unit |
| 75 |
# CHECK: DW_AT_name{{.*}}"CU1" |
| 76 |
# CHECK: DW_TAG_variable |
| 77 |
# CHECK: DW_AT_name{{.*}}"var1" |
| 78 |
# CHECK: DW_AT_type{{.*}}0x{{.*}}[[PTR_CLASS1]] "class1 *" |
| 79 |
# CHECK: DW_TAG_variable |
| 80 |
# CHECK: DW_AT_name{{.*}}"var2" |
| 81 |
# CHECK: DW_AT_type{{.*}}0x{{.*}}[[PTR_CLASS2]] "class2<int> *" |
| 82 |
|
| 83 |
# CHECK: DW_TAG_compile_unit |
| 84 |
# CHECK: DW_AT_name{{.*}}"CU2" |
| 85 |
# CHECK: DW_TAG_variable |
| 86 |
# CHECK: DW_AT_name{{.*}}"var1" |
| 87 |
# CHECK: DW_AT_type{{.*}}0x{{.*}}[[PTR_CLASS1]] "class1 *" |
| 88 |
# CHECK: DW_TAG_variable |
| 89 |
# CHECK: DW_AT_name{{.*}}"var2" |
| 90 |
# CHECK: DW_AT_type{{.*}}0x{{.*}}[[PTR_CLASS2]] "class2<int> *" |
| 91 |
|
| 92 |
--- !mach-o |
| 93 |
FileHeader: |
| 94 |
magic: 0xFEEDFACF |
| 95 |
cputype: 0x01000007 |
| 96 |
cpusubtype: 0x00000003 |
| 97 |
filetype: 0x00000001 |
| 98 |
ncmds: 2 |
| 99 |
sizeofcmds: 376 |
| 100 |
flags: 0x00002000 |
| 101 |
reserved: 0x00000000 |
| 102 |
LoadCommands: |
| 103 |
- cmd: LC_SEGMENT_64 |
| 104 |
cmdsize: 232 |
| 105 |
segname: '' |
| 106 |
vmaddr: 0x00 |
| 107 |
vmsize: 0x300 |
| 108 |
fileoff: 0x300 |
| 109 |
filesize: 0x300 |
| 110 |
maxprot: 7 |
| 111 |
initprot: 7 |
| 112 |
nsects: 2 |
| 113 |
flags: 0 |
| 114 |
Sections: |
| 115 |
- sectname: __debug_abbrev |
| 116 |
segname: __DWARF |
| 117 |
addr: 0x000000000000000F |
| 118 |
size: 0x9c |
| 119 |
offset: 0x00000380 |
| 120 |
align: 0 |
| 121 |
reloff: 0x00000000 |
| 122 |
nreloc: 0 |
| 123 |
flags: 0x02000000 |
| 124 |
reserved1: 0x00000000 |
| 125 |
reserved2: 0x00000000 |
| 126 |
reserved3: 0x00000000 |
| 127 |
- sectname: __debug_info |
| 128 |
segname: __DWARF |
| 129 |
addr: 0x000000000000100 |
| 130 |
size: 0xed |
| 131 |
offset: 0x0000041c |
| 132 |
align: 0 |
| 133 |
reloff: 0x00000600 |
| 134 |
nreloc: 1 |
| 135 |
flags: 0x02000000 |
| 136 |
reserved1: 0x00000000 |
| 137 |
reserved2: 0x00000000 |
| 138 |
reserved3: 0x00000000 |
| 139 |
relocations: |
| 140 |
- address: 0x000001FC |
| 141 |
symbolnum: 1 |
| 142 |
pcrel: true |
| 143 |
length: 3 |
| 144 |
extern: false |
| 145 |
type: 0 |
| 146 |
scattered: false |
| 147 |
value: 0 |
| 148 |
- cmd: LC_SYMTAB |
| 149 |
cmdsize: 24 |
| 150 |
symoff: 0x700 |
| 151 |
nsyms: 1 |
| 152 |
stroff: 0x710 |
| 153 |
strsize: 10 |
| 154 |
LinkEditData: |
| 155 |
NameList: |
| 156 |
- n_strx: 1 |
| 157 |
n_type: 0x0F |
| 158 |
n_sect: 1 |
| 159 |
n_desc: 0 |
| 160 |
n_value: 0 |
| 161 |
StringTable: |
| 162 |
- '' |
| 163 |
- '__Z3foov' |
| 164 |
- '' |
| 165 |
DWARF: |
| 166 |
debug_abbrev: |
| 167 |
- Table: |
| 168 |
- Tag: DW_TAG_compile_unit |
| 169 |
Children: DW_CHILDREN_yes |
| 170 |
Attributes: |
| 171 |
- Attribute: DW_AT_producer |
| 172 |
Form: DW_FORM_string |
| 173 |
- Attribute: DW_AT_language |
| 174 |
Form: DW_FORM_data2 |
| 175 |
- Attribute: DW_AT_name |
| 176 |
Form: DW_FORM_string |
| 177 |
- Tag: DW_TAG_class_type |
| 178 |
Children: DW_CHILDREN_yes |
| 179 |
Attributes: |
| 180 |
- Attribute: DW_AT_name |
| 181 |
Form: DW_FORM_string |
| 182 |
- Tag: DW_TAG_member |
| 183 |
Children: DW_CHILDREN_no |
| 184 |
Attributes: |
| 185 |
- Attribute: DW_AT_type |
| 186 |
Form: DW_FORM_ref_addr |
| 187 |
- Attribute: DW_AT_name |
| 188 |
Form: DW_FORM_string |
| 189 |
- Tag: DW_TAG_class_type |
| 190 |
Children: DW_CHILDREN_no |
| 191 |
Attributes: |
| 192 |
- Attribute: DW_AT_name |
| 193 |
Form: DW_FORM_string |
| 194 |
- Attribute: DW_AT_declaration |
| 195 |
Form: DW_FORM_flag_present |
| 196 |
- Tag: DW_TAG_class_type |
| 197 |
Children: DW_CHILDREN_yes |
| 198 |
Attributes: |
| 199 |
- Attribute: DW_AT_name |
| 200 |
Form: DW_FORM_string |
| 201 |
- Attribute: DW_AT_declaration |
| 202 |
Form: DW_FORM_flag_present |
| 203 |
- Tag: DW_TAG_template_type_parameter |
| 204 |
Children: DW_CHILDREN_no |
| 205 |
Attributes: |
| 206 |
- Attribute: DW_AT_type |
| 207 |
Form: DW_FORM_ref_addr |
| 208 |
- Tag: DW_TAG_base_type |
| 209 |
Children: DW_CHILDREN_no |
| 210 |
Attributes: |
| 211 |
- Attribute: DW_AT_name |
| 212 |
Form: DW_FORM_string |
| 213 |
- Tag: DW_TAG_pointer_type |
| 214 |
Children: DW_CHILDREN_no |
| 215 |
Attributes: |
| 216 |
- Attribute: DW_AT_type |
| 217 |
Form: DW_FORM_ref_addr |
| 218 |
- Tag: DW_TAG_variable |
| 219 |
Children: DW_CHILDREN_no |
| 220 |
Attributes: |
| 221 |
- Attribute: DW_AT_name |
| 222 |
Form: DW_FORM_string |
| 223 |
- Attribute: DW_AT_const_value |
| 224 |
Form: DW_FORM_data4 |
| 225 |
- Attribute: DW_AT_type |
| 226 |
Form: DW_FORM_ref_addr |
| 227 |
- Table: |
| 228 |
- Tag: DW_TAG_compile_unit |
| 229 |
Children: DW_CHILDREN_yes |
| 230 |
Attributes: |
| 231 |
- Attribute: DW_AT_producer |
| 232 |
Form: DW_FORM_string |
| 233 |
- Attribute: DW_AT_language |
| 234 |
Form: DW_FORM_data2 |
| 235 |
- Attribute: DW_AT_name |
| 236 |
Form: DW_FORM_string |
| 237 |
- Tag: DW_TAG_class_type |
| 238 |
Children: DW_CHILDREN_yes |
| 239 |
Attributes: |
| 240 |
- Attribute: DW_AT_name |
| 241 |
Form: DW_FORM_string |
| 242 |
- Tag: DW_TAG_member |
| 243 |
Children: DW_CHILDREN_no |
| 244 |
Attributes: |
| 245 |
- Attribute: DW_AT_type |
| 246 |
Form: DW_FORM_ref_addr |
| 247 |
- Attribute: DW_AT_name |
| 248 |
Form: DW_FORM_string |
| 249 |
- Tag: DW_TAG_class_type |
| 250 |
Children: DW_CHILDREN_no |
| 251 |
Attributes: |
| 252 |
- Attribute: DW_AT_name |
| 253 |
Form: DW_FORM_string |
| 254 |
- Attribute: DW_AT_declaration |
| 255 |
Form: DW_FORM_flag_present |
| 256 |
- Tag: DW_TAG_class_type |
| 257 |
Children: DW_CHILDREN_yes |
| 258 |
Attributes: |
| 259 |
- Attribute: DW_AT_name |
| 260 |
Form: DW_FORM_string |
| 261 |
- Attribute: DW_AT_declaration |
| 262 |
Form: DW_FORM_flag_present |
| 263 |
- Tag: DW_TAG_template_type_parameter |
| 264 |
Children: DW_CHILDREN_no |
| 265 |
Attributes: |
| 266 |
- Attribute: DW_AT_type |
| 267 |
Form: DW_FORM_ref_addr |
| 268 |
- Tag: DW_TAG_base_type |
| 269 |
Children: DW_CHILDREN_no |
| 270 |
Attributes: |
| 271 |
- Attribute: DW_AT_name |
| 272 |
Form: DW_FORM_string |
| 273 |
- Tag: DW_TAG_pointer_type |
| 274 |
Children: DW_CHILDREN_no |
| 275 |
Attributes: |
| 276 |
- Attribute: DW_AT_type |
| 277 |
Form: DW_FORM_ref_addr |
| 278 |
- Tag: DW_TAG_variable |
| 279 |
Children: DW_CHILDREN_no |
| 280 |
Attributes: |
| 281 |
- Attribute: DW_AT_name |
| 282 |
Form: DW_FORM_string |
| 283 |
- Attribute: DW_AT_const_value |
| 284 |
Form: DW_FORM_data4 |
| 285 |
- Attribute: DW_AT_type |
| 286 |
Form: DW_FORM_ref_addr |
| 287 |
debug_info: |
| 288 |
- Version: 4 |
| 289 |
Entries: |
| 290 |
- AbbrCode: 1 |
| 291 |
Values: |
| 292 |
- CStr: by_hand |
| 293 |
- Value: 0x04 |
| 294 |
- CStr: CU1 |
| 295 |
- AbbrCode: 4 |
| 296 |
Values: |
| 297 |
- CStr: class1 |
| 298 |
- AbbrCode: 5 |
| 299 |
Values: |
| 300 |
- CStr: class2 |
| 301 |
- AbbrCode: 6 |
| 302 |
Values: |
| 303 |
- Value: 0x00000030 |
| 304 |
- AbbrCode: 0 |
| 305 |
- AbbrCode: 7 |
| 306 |
Values: |
| 307 |
- CStr: int |
| 308 |
- AbbrCode: 8 |
| 309 |
Values: |
| 310 |
- Value: 0x0000001a |
| 311 |
- AbbrCode: 8 |
| 312 |
Values: |
| 313 |
- Value: 0x00000022 |
| 314 |
- AbbrCode: 9 |
| 315 |
Values: |
| 316 |
- CStr: var1 |
| 317 |
- Value: 0x00000000 |
| 318 |
- Value: 0x00000035 |
| 319 |
- AbbrCode: 9 |
| 320 |
Values: |
| 321 |
- CStr: var2 |
| 322 |
- Value: 0x00000000 |
| 323 |
- Value: 0x0000003a |
| 324 |
- AbbrCode: 0 |
| 325 |
- Version: 4 |
| 326 |
Entries: |
| 327 |
- AbbrCode: 1 |
| 328 |
Values: |
| 329 |
- CStr: by_hand |
| 330 |
- Value: 0x04 |
| 331 |
- CStr: CU2 |
| 332 |
- AbbrCode: 2 |
| 333 |
Values: |
| 334 |
- CStr: class1 |
| 335 |
- AbbrCode: 3 |
| 336 |
Values: |
| 337 |
- Value: 0x000000b9 |
| 338 |
- CStr: member1 |
| 339 |
- AbbrCode: 3 |
| 340 |
Values: |
| 341 |
- Value: 0x000000bf |
| 342 |
- CStr: member2 |
| 343 |
- AbbrCode: 0 |
| 344 |
- AbbrCode: 2 |
| 345 |
Values: |
| 346 |
- CStr: class2 |
| 347 |
- AbbrCode: 6 |
| 348 |
Values: |
| 349 |
- Value: 0x000000b4 |
| 350 |
- AbbrCode: 3 |
| 351 |
Values: |
| 352 |
- Value: 0x000000b9 |
| 353 |
- CStr: member1 |
| 354 |
- AbbrCode: 0 |
| 355 |
- AbbrCode: 7 |
| 356 |
Values: |
| 357 |
- CStr: int |
| 358 |
- AbbrCode: 7 |
| 359 |
Values: |
| 360 |
- CStr: char |
| 361 |
- AbbrCode: 7 |
| 362 |
Values: |
| 363 |
- CStr: float |
| 364 |
- AbbrCode: 8 |
| 365 |
Values: |
| 366 |
- Value: 0x00000076 |
| 367 |
- AbbrCode: 8 |
| 368 |
Values: |
| 369 |
- Value: 0x00000099 |
| 370 |
- AbbrCode: 9 |
| 371 |
Values: |
| 372 |
- CStr: var1 |
| 373 |
- Value: 0x00000000 |
| 374 |
- Value: 0x000000c6 |
| 375 |
- AbbrCode: 9 |
| 376 |
Values: |
| 377 |
- CStr: var2 |
| 378 |
- Value: 0x00000000 |
| 379 |
- Value: 0x000000cb |
| 380 |
- AbbrCode: 0 |
| 381 |
... |