xref: /llvm-project/llvm/test/tools/dsymutil/X86/DWARFLinkerParallel/odr-two-units-in-single-file.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## This test checks debug info for the types located into the
2## different compilation units from the single object file.
3## Type definition for the "class1" should be moved to the
4## artificial type unit from the first and second compilation unit.
5
6# RUN: yaml2obj %s -o %t.o
7# RUN: echo '---' > %t2.map
8# RUN: echo "triple:          'x86_64-apple-darwin'" >> %t2.map
9# RUN: echo 'objects:'  >> %t2.map
10# RUN: echo " -  filename: '%t.o'" >> %t2.map
11# RUN: echo '    symbols:' >> %t2.map
12# RUN: echo '      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map
13# RUN: echo '...' >> %t2.map
14# RUN: dsymutil --linker parallel -y %t2.map -f -o - | llvm-dwarfdump -a - | FileCheck %s
15
16# CHECK: file format Mach-O 64-bit x86-64
17# CHECK: .debug_info contents:
18# CHECK: Compile Unit:
19# CHECK: DW_TAG_compile_unit
20# CHECK: DW_AT_name{{.*}}"__artificial_type_unit"
21# CHECK: 0x[[CLASS1:[0-9a-f]*]]: DW_TAG_class_type{{.*[[:space:]].*}}DW_AT_name{{.*}}"class1"
22
23# CHECK: Compile Unit:
24# CHECK: DW_TAG_compile_unit
25# CHECK: DW_AT_name{{.*}}"CU1"
26# CHECK-NOT: DW_TAG_class_type
27# CHECK: DW_TAG_variable
28# CHECK: DW_AT_name{{.*}}"var1"
29# CHECK: DW_AT_const_value
30# CHECK: DW_AT_type (0x00000000[[CLASS1]]
31
32# CHECK: Compile Unit:
33# CHECK: DW_TAG_compile_unit
34# CHECK: DW_AT_name{{.*}}"CU2"
35# CHECK-NOT: DW_TAG_class_type
36# CHECK-NOT: "class1"
37# CHECK: DW_TAG_variable
38# CHECK: DW_AT_name{{.*}}"var2"
39# CHECK: DW_AT_const_value
40# CHECK: DW_AT_type (0x00000000[[CLASS1]]
41
42
43
44--- !mach-o
45FileHeader:
46  magic:      0xFEEDFACF
47  cputype:    0x01000007
48  cpusubtype: 0x00000003
49  filetype:   0x00000001
50  ncmds:      2
51  sizeofcmds: 376
52  flags:      0x00002000
53  reserved:   0x00000000
54LoadCommands:
55  - cmd:      LC_SEGMENT_64
56    cmdsize:  232
57    segname:  ''
58    vmaddr:   0x00
59    vmsize:   0x300
60    fileoff:  0x300
61    filesize: 0x300
62    maxprot:  7
63    initprot: 7
64    nsects:   2
65    flags:    0
66    Sections:
67      - sectname:  __debug_abbrev
68        segname:   __DWARF
69        addr:      0x000000000000000F
70        size:      0x3c
71        offset:    0x00000380
72        align:     0
73        reloff:    0x00000000
74        nreloc:    0
75        flags:     0x02000000
76        reserved1: 0x00000000
77        reserved2: 0x00000000
78        reserved3: 0x00000000
79      - sectname:  __debug_info
80        segname:   __DWARF
81        addr:      0x000000000000100
82        size:      0x62
83        offset:    0x00000410
84        align:     0
85        reloff:    0x00000600
86        nreloc:    1
87        flags:     0x02000000
88        reserved1: 0x00000000
89        reserved2: 0x00000000
90        reserved3: 0x00000000
91        relocations:
92          - address:         0x1FC
93            symbolnum:       1
94            pcrel:           true
95            length:          3
96            extern:          true
97            type:            0
98            scattered:       false
99            value:           0
100  - cmd:             LC_SYMTAB
101    cmdsize:         24
102    symoff:          0x700
103    nsyms:           2
104    stroff:          0x720
105    strsize:         10
106LinkEditData:
107  NameList:
108    - n_strx:          1
109      n_type:          0x0F
110      n_sect:          1
111      n_desc:          0
112      n_value:         0
113    - n_strx:          1
114      n_type:          0x0F
115      n_sect:          1
116      n_desc:          0
117      n_value:         0
118  StringTable:
119    - ''
120    - '__Z3foov'
121    - ''
122DWARF:
123  debug_abbrev:
124    - Table:
125      - Tag:      DW_TAG_compile_unit
126        Children: DW_CHILDREN_yes
127        Attributes:
128          - Attribute: DW_AT_producer
129            Form:      DW_FORM_string
130          - Attribute: DW_AT_language
131            Form:      DW_FORM_data2
132          - Attribute: DW_AT_name
133            Form:      DW_FORM_string
134      - Tag:      DW_TAG_class_type
135        Children: DW_CHILDREN_no
136        Attributes:
137          - Attribute: DW_AT_name
138            Form:      DW_FORM_string
139      - Tag:      DW_TAG_variable
140        Children: DW_CHILDREN_no
141        Attributes:
142          - Attribute: DW_AT_name
143            Form:      DW_FORM_string
144          - Attribute: DW_AT_const_value
145            Form:      DW_FORM_data4
146          - Attribute: DW_AT_type
147            Form:      DW_FORM_ref4
148    - Table:
149      - Tag:      DW_TAG_compile_unit
150        Children: DW_CHILDREN_yes
151        Attributes:
152          - Attribute: DW_AT_producer
153            Form:      DW_FORM_string
154          - Attribute: DW_AT_language
155            Form:      DW_FORM_data2
156          - Attribute: DW_AT_name
157            Form:      DW_FORM_string
158      - Tag:      DW_TAG_class_type
159        Children: DW_CHILDREN_no
160        Attributes:
161          - Attribute: DW_AT_name
162            Form:      DW_FORM_string
163      - Tag:      DW_TAG_variable
164        Children: DW_CHILDREN_no
165        Attributes:
166          - Attribute: DW_AT_name
167            Form:      DW_FORM_string
168          - Attribute: DW_AT_const_value
169            Form:      DW_FORM_data4
170          - Attribute: DW_AT_type
171            Form:      DW_FORM_ref4
172  debug_info:
173    - Version: 4
174      Entries:
175        - AbbrCode: 1
176          Values:
177            - CStr: by_hand
178            - Value:  0x04
179            - CStr: CU1
180        - AbbrCode: 2
181          Values:
182            - CStr: class1
183        - AbbrCode: 3
184          Values:
185            - CStr: var1
186            - Value:  0x00000000
187            - Value:  0x0000001a
188        - AbbrCode: 0
189    - Version: 4
190      Entries:
191        - AbbrCode: 1
192          Values:
193            - CStr: by_hand
194            - Value:  0x04
195            - CStr: CU2
196        - AbbrCode: 2
197          Values:
198            - CStr: class1
199        - AbbrCode: 3
200          Values:
201            - CStr: var2
202            - Value:  0x00000000
203            - Value:  0x0000001a
204        - AbbrCode: 0
205...
206