1 ## Test how we dump the .debug_ranges section.
3 ## a) Test dumping the .debug_ranges section from various object files with
4 ## different endian and bits.
6 ## Dump the .debug_ranges section from a 32-bit little endian object file where
7 ## the address_size of debug_info is 4.
8 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DLOWOFFSET=0xFFFFFFFF \
9 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
10 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x4 \
11 # RUN: -DOFFSET=0x18 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10
13 ## Dump the .debug_ranges section from a 32-bit big endian object file where the
14 ## address_size of debug_info is 4.
15 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DENDIAN=MSB -DLOWOFFSET=0xFFFFFFFF \
16 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
17 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x4 \
18 # RUN: -DOFFSET=0x18 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10
20 ## Dump the .debug_ranges section from a 32-bit little endian object file where
21 ## the address_size of debug_info is 8.
22 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DADDRSIZE1=8 \
23 # RUN: -DADDRSIZE2=8 -DADDRSIZE3=8 -DADDRSIZE4=8 \
24 # RUN: -DLOWOFFSET=0xFFFFFFFFFFFFFFFF -DHIGHOFFSET=0x10 | obj2yaml | \
25 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x8 \
26 # RUN: -DOFFSET=0x30 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF \
27 # RUN: -DHIGHOFFSET=0x10
29 ## Dump the .debug_ranges section from a 32-bit big endian object file where the
30 ## address_size of debug_info is 8.
31 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DENDIAN=MSB -DADDRSIZE1=8 \
32 # RUN: -DADDRSIZE2=8 -DADDRSIZE3=8 -DADDRSIZE4=8 \
33 # RUN: -DLOWOFFSET=0xFFFFFFFFFFFFFFFF -DHIGHOFFSET=0x10 | obj2yaml | \
34 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x8 \
35 # RUN: -DOFFSET=0x30 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF -DHIGHOFFSET=0x10
37 ## Dump the .debug_ranges section from a 64-bit little endian object file where
38 ## the address_size of debug_info is 8.
39 # RUN: yaml2obj --docnum=1 %s -DLOWOFFSET=0xFFFFFFFFFFFFFFFF \
40 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
41 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x8 \
42 # RUN: -DOFFSET=0x30 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF -DHIGHOFFSET=0x10
44 ## Dump the .debug_ranges section from a 64-bit big endian object file where the
45 ## address_size of debug_info is 8.
46 # RUN: yaml2obj --docnum=1 %s -DENDIAN=MSB -DLOWOFFSET=0xFFFFFFFFFFFFFFFF \
47 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
48 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x8 \
49 # RUN: -DOFFSET=0x30 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF -DHIGHOFFSET=0x10
51 ## Dump the .debug_ranges section from a 64-bit little endian object file where
52 ## the address_size of debug_info is 4.
53 # RUN: yaml2obj --docnum=1 %s -DADDRSIZE1=4 -DADDRSIZE2=4 -DADDRSIZE3=4 \
54 # RUN: -DADDRSIZE4=4 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF \
55 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
56 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x4 \
57 # RUN: -DOFFSET=0x18 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10
59 ## Dump the .debug_ranges section from a 64-bit big endian object file where the
60 ## address_size of debug_info is 4.
61 # RUN: yaml2obj --docnum=1 %s -DADDRSIZE1=4 -DADDRSIZE2=4 -DADDRSIZE3=4 \
62 # RUN: -DADDRSIZE4=4 -DLOWOFFSET=0xFFFFFFFFFFFFFFFF \
63 # RUN: -DHIGHOFFSET=0x10 | obj2yaml | \
64 # RUN: FileCheck %s --check-prefix=BASIC -DADDRSIZE=0x4 \
65 # RUN: -DOFFSET=0x18 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10
68 # BASIC-NOT: debug_ranges
69 # BASIC: debug_ranges:
70 # BASIC-NEXT: - Offset: 0x0
71 # BASIC-NEXT: AddrSize: [[ADDRSIZE]]
72 # BASIC-NEXT: Entries:
73 # BASIC-NEXT: - LowOffset: 0x10
74 # BASIC-NEXT: HighOffset: 0x20
75 # BASIC-NEXT: - LowOffset: 0x30
76 # BASIC-NEXT: HighOffset: 0x40
77 # BASIC-NEXT: - Offset: [[OFFSET]]
78 # BASIC-NEXT: AddrSize: [[ADDRSIZE]]
79 # BASIC-NEXT: Entries:
80 # BASIC-NEXT: - LowOffset: [[LOWOFFSET]]
81 # BASIC-NEXT: HighOffset: [[HIGHOFFSET]]
85 Class: ELFCLASS[[BITS=64]]
86 Data: ELFDATA2[[ENDIAN=LSB]]
89 ## The debug_ranges parser depends on the address_size field
90 ## of compilation units. We add the .debug_info section to
94 AddrSize: [[ADDRSIZE1=<none>]]
96 AddrSize: [[ADDRSIZE2=<none>]]
98 - AddrSize: [[ADDRSIZE3=<none>]]
104 - AddrSize: [[ADDRSIZE4=<none>]]
106 - LowOffset: [[LOWOFFSET=0x10]]
107 HighOffset: [[HIGHOFFSET=0x20]]
109 ## b) Test that obj2yaml dumps the .debug_ranges as a raw content section when
110 ## the parser fails. In this case, the address_size of the two compilation units
113 # RUN: yaml2obj --docnum=1 -DADDRSIZE1=4 -DADDRSIZE2=8 %s | obj2yaml | \
114 # RUN: FileCheck %s --check-prefix=RAW --implicit-check-not=debug_ranges
116 # RAW: - Name: .debug_ranges
117 # RAW-NEXT: Type: SHT_PROGBITS
118 # RAW-NEXT: AddressAlign: 0x1
119 # RAW-NEXT: Content: '1000000000000000
120 ## ^--------------- LowOffset
121 # RAW-SAME: {{^}}2000000000000000
122 ## ^--------------- HighOffset
123 # RAW-SAME: {{^}}3000000000000000
124 ## ^--------------- LowOffset
125 # RAW-SAME: {{^}}4000000000000000
126 ## ^--------------- HighOffset
127 # RAW-SAME: {{^}}0000000000000000
129 # RAW-SAME: {{^}}0000000000000000
130 ## ---------------- terminator
131 # RAW-SAME: {{^}}1000000000000000
132 ## ^--------------- LowOffset
133 # RAW-SAME: {{^}}2000000000000000
134 ## ^--------------- HighOffset
135 # RAW-SAME: {{^}}0000000000000000
137 # RAW-SAME: {{^}}0000000000000000'
138 ## ---------------- terminator
140 ## c) Test dumping an empty .debug_ranges section.
142 # RUN: yaml2obj --docnum=2 %s | obj2yaml | \
143 # RUN: FileCheck %s --check-prefix=EMPTY --implicit-check-not=Sections:
146 # EMPTY-NEXT: debug_ranges: []
156 ## d) Test dumping a .debug_ranges section whose section header properties are
159 ## Override the sh_type field.
160 # RUN: yaml2obj --docnum=3 -DTYPE=SHT_STRTAB %s | obj2yaml | \
161 # RUN: FileCheck %s -DTYPE=STRTAB --check-prefixes=COMMON
163 ## Override the sh_flags field.
164 # RUN: yaml2obj --docnum=3 -DFLAGS=[SHF_ALLOC] %s | obj2yaml | \
165 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,FLAGS
167 ## Override the sh_link field.
168 # RUN: yaml2obj --docnum=3 -DLINK='.sec' %s | obj2yaml | \
169 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,LINK
171 ## Override the sh_entsize field.
172 # RUN: yaml2obj --docnum=3 -DENTSIZE=3 %s | obj2yaml | \
173 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,ENTSIZE
175 ## Override the sh_info field.
176 # RUN: yaml2obj --docnum=3 -DINFO=3 %s | obj2yaml | \
177 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,INFO
179 ## Override the sh_addralign field.
180 # RUN: yaml2obj --docnum=3 -DADDRALIGN=3 %s | obj2yaml | \
181 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,ADDRALIGN
183 ## Override the sh_address field.
184 # RUN: yaml2obj --docnum=3 -DADDRESS=0x2020 %s | obj2yaml | \
185 # RUN: FileCheck %s -DTYPE=PROGBITS --check-prefixes=COMMON,ADDRESS
187 # COMMON: - Name: .debug_ranges
188 # COMMON-NEXT: Type: SHT_[[TYPE]]
189 # FLAGS-NEXT: Flags: [ SHF_ALLOC ]
190 # LINK-NEXT: Link: .sec
191 # ENTSIZE-NEXT: EntSize: 0x3
192 # INFO-NEXT: Info: 0x3
193 # ADDRALIGN-NEXT: AddressAlign: 0x3
194 # ADDRESS-NEXT: Address: 0x2020
196 # COMMON: debug_ranges:
197 # COMMON-NEXT: - Offset: 0x0
198 # COMMON-NEXT: AddrSize: 0x8
199 # COMMON-NEXT: Entries:
200 # COMMON-NEXT: - LowOffset: 0x10
201 # COMMON-NEXT: HighOffset: 0x20
209 - Name: .debug_ranges
210 Type: [[TYPE=SHT_PROGBITS]]
211 Flags: [[FLAGS=<none>]]
212 Link: [[LINK=<none>]]
213 EntSize: [[ENTSIZE=<none>]]
214 Info: [[INFO=<none>]]
215 AddressAlign: [[ADDRALIGN=0]]
216 Address: [[ADDRESS=<none>]]