1 ## This file contains test cases for generating .debug_pubnames/.debug_pubtypes
2 ## section in object files from the DWARF entry of Mach-O YAML inputs
4 ## a) Test that yaml2obj emits the .debug_pubnames and .debug_pubtypes sections and
5 ## obj2yaml converts them back.
7 # RUN: yaml2obj %s | obj2yaml | FileCheck %s
13 cpusubtype: 0x00000003
32 - sectname: __debug_pubnames
34 addr: 0x0000000000000000
44 - sectname: __debug_pubtypes
46 addr: 0x0000000000000000
63 - DieOffset: 0x0000002A
71 - DieOffset: 0x00000060
73 - DieOffset: 0x00000071
77 # CHECK: debug_pubnames:
78 # CHECK-NEXT: Length: 0x17
79 # CHECK-NEXT: Version: 2
80 # CHECK-NEXT: UnitOffset: 0
81 # CHECK-NEXT: UnitSize: 121
82 # CHECK-NEXT: Entries:
83 # CHECK-NEXT: - DieOffset: 0x2A
84 # CHECK-NEXT: Name: main
85 # CHECK-NEXT: debug_pubtypes:
86 # CHECK-NEXT: Length: 0x1F
87 # CHECK-NEXT: Version: 2
88 # CHECK-NEXT: UnitOffset: 0
89 # CHECK-NEXT: UnitSize: 121
90 # CHECK-NEXT: Entries:
91 # CHECK-NEXT: - DieOffset: 0x60
92 # CHECK-NEXT: Name: int
93 # CHECK-NEXT: - DieOffset: 0x71
94 # CHECK-NEXT: Name: char
97 ## b) Test that yaml2obj will not emit the .debug_pubnames/.debug_pubtypes section's
98 ## contents, if the "debug_pubnames"/"debug_pubtypes" entry doesn't exist in the
101 # RUN: yaml2obj --docnum=2 %s -o %t2
102 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=EMPTY
105 # EMPTY-NEXT: - sectname: __debug_pubnames
106 # EMPTY-NEXT: segname: __DWARF
107 # EMPTY-NEXT: addr: 0x0
108 # EMPTY-NEXT: size: 0
109 # EMPTY-NEXT: offset: 0x0
110 # EMPTY-NEXT: align: 0
111 # EMPTY-NEXT: reloff: 0x0
112 # EMPTY-NEXT: nreloc: 0
113 # EMPTY-NEXT: flags: 0x0
114 # EMPTY-NEXT: reserved1: 0x0
115 # EMPTY-NEXT: reserved2: 0x0
116 # EMPTY-NEXT: reserved3: 0x0
117 # EMPTY-NEXT: - sectname: __debug_pubtypes
118 # EMPTY-NEXT: segname: __DWARF
119 # EMPTY-NEXT: addr: 0x0
120 # EMPTY-NEXT: size: 0
121 # EMPTY-NEXT: offset: 0x720
122 # EMPTY-NEXT: align: 0
123 # EMPTY-NEXT: reloff: 0x0
124 # EMPTY-NEXT: nreloc: 0
125 # EMPTY-NEXT: flags: 0x0
126 # EMPTY-NEXT: reserved1: 0x0
127 # EMPTY-NEXT: reserved2: 0x0
128 # EMPTY-NEXT: reserved3: 0x0
135 cpusubtype: 0x00000003
154 - sectname: __debug_pubnames
156 addr: 0x0000000000000000
163 reserved1: 0x00000000
164 reserved2: 0x00000000
165 reserved3: 0x00000000
166 - sectname: __debug_pubtypes
168 addr: 0x0000000000000000
175 reserved1: 0x00000000
176 reserved2: 0x00000000
177 reserved3: 0x00000000
180 ## c) Test that obj2yaml is able to dump a __debug_pubnames section whose length field is greater than the section size.
182 # RUN: yaml2obj --docnum=3 %s | obj2yaml | FileCheck %s --check-prefix=INVALID-LENGTH
184 # INVALID-LENGTH: DWARF:
185 # INVALID-LENGTH-NEXT: debug_pubnames:
186 # INVALID-LENGTH-NEXT: Length: 0xDEADBEEF
187 # INVALID-LENGTH-NEXT: Version: 2
188 # INVALID-LENGTH-NEXT: UnitOffset: 0
189 # INVALID-LENGTH-NEXT: UnitSize: 121
190 # INVALID-LENGTH-NEXT: Entries:
191 # INVALID-LENGTH-NEXT: - DieOffset: 0x2A
192 # INVALID-LENGTH-NEXT: Name: main
198 cpusubtype: 0x00000003
217 - sectname: __debug_pubnames
219 addr: 0x0000000000000000
226 reserved1: 0x00000000
227 reserved2: 0x00000000
228 reserved3: 0x00000000
236 - DieOffset: 0x0000002A