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