1 ## Test how we dump the .debug_addr section.
3 ## a) Dumping address tables from various object files.
5 ## Dumping address tables from a little endian 64-bit object file.
6 # RUN: yaml2obj --docnum=1 %s -DADDRESS=0xFFFFFFFFFFFFFFFF \
7 # RUN: -DADDRSIZE=4 | obj2yaml | \
8 # RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
9 # RUN: -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
10 # RUN: -DLENGTH2=0xC -DADDRSIZE2=0x4
12 ## Dumping address tables from a big endian 64-bit object file.
13 # RUN: yaml2obj --docnum=1 %s -DENDIAN=MSB -DADDRESS=0xFFFFFFFFFFFFFFFF \
14 # RUN: -DADDRSIZE=4 | obj2yaml | \
15 # RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
16 # RUN: -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
17 # RUN: -DLENGTH2=0xC -DADDRSIZE2=0x4
19 ## Dumping address tables from a little endian 32-bit object file.
20 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DADDRESS=0xFFFFFFFF \
21 # RUN: -DADDRSIZE=8 | obj2yaml | \
22 # RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
23 # RUN: -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
24 # RUN: -DLENGTH2=0x14 -DADDRSIZE2=0x8
26 ## Dumping address tables from a big endian 32-bit object file.
27 # RUN: yaml2obj --docnum=1 %s -DBITS=32 -DENDIAN=MSB -DADDRESS=0xFFFFFFFF \
28 # RUN: -DADDRSIZE=8 | obj2yaml | \
29 # RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
30 # RUN: -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
31 # RUN: -DLENGTH2=0x14 -DADDRSIZE2=0x8
34 # BASIC-NEXT: debug_addr:
35 # BASIC-NEXT: - Length: [[LENGTH1]]
36 # BASIC-NEXT: Version: 0x5
37 # BASIC-NEXT: AddressSize: [[ADDRSIZE1]]
38 # BASIC-NEXT: Entries:
39 # BASIC-NEXT: - Address: 0x1234
40 # BASIC-NEXT: - Address: 0x5678
41 # BASIC-NEXT: - Format: DWARF64
42 # BASIC-NEXT: Length: [[LENGTH1]]
43 # BASIC-NEXT: Version: 0x5
44 # BASIC-NEXT: AddressSize: [[ADDRSIZE1]]
45 # BASIC-NEXT: Entries:
46 # BASIC-NEXT: - Address: 0x1234
47 # BASIC-NEXT: - Address: [[ADDR]]
48 # BASIC-NEXT: - Length: [[LENGTH2]]
49 # BASIC-NEXT: Version: 0x5
50 # BASIC-NEXT: AddressSize: [[ADDRSIZE2]]
51 # BASIC-NEXT: Entries:
52 # BASIC-NEXT: - Address: 0x1234
53 # BASIC-NEXT: - Address: 0x5678
54 # BASIC-NEXT: - Format: DWARF64
55 # BASIC-NEXT: Length: [[LENGTH2]]
56 # BASIC-NEXT: Version: 0x5
57 # BASIC-NEXT: AddressSize: [[ADDRSIZE2]]
58 # BASIC-NEXT: Entries:
59 # BASIC-NEXT: - Address: 0x1234
60 # BASIC-NEXT: - Address: 0x5678
65 Class: ELFCLASS[[BITS=64]]
66 Data: ELFDATA2[[ENDIAN=LSB]]
70 ## A DWARF32 address table.
75 ## A DWARF64 address table.
80 - Address: [[ADDRESS]]
81 ## A DWARF32 address table with a mutable address size.
83 AddressSize: [[ADDRSIZE]]
87 ## A DWARF64 address table with a mutable address size.
90 AddressSize: [[ADDRSIZE]]
95 ## b) Test dumping a .debug_addr section whose section header properties are
98 ## Override the sh_type field.
99 # RUN: yaml2obj --docnum=2 %s -DTYPE=SHT_STRTAB | obj2yaml | \
100 # RUN: FileCheck %s -DTYPE=SHT_STRTAB --check-prefix=COMMON
102 ## Override the sh_flags field.
103 # RUN: yaml2obj --docnum=2 %s -DFLAGS='[ SHF_ALLOC ]' | obj2yaml | \
104 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,FLAGS
106 ## Override the sh_link field.
107 # RUN: yaml2obj --docnum=2 %s -DLINK=.sec | obj2yaml | \
108 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,LINK
110 ## Override the sh_addr field.
111 # RUN: yaml2obj --docnum=2 %s -DADDRESS=0x2020 | obj2yaml | \
112 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDR
114 ## Override the sh_addralign field.
115 # RUN: yaml2obj --docnum=2 %s -DADDRALIGN=3 | obj2yaml | \
116 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDRALIGN
118 ## Override the sh_entsize field.
119 # RUN: yaml2obj --docnum=2 %s -DENTSIZE=3 | obj2yaml | \
120 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ENTSIZE
122 ## Override the sh_info field.
123 # RUN: yaml2obj --docnum=2 %s -DINFO=3 | obj2yaml | \
124 # RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,INFO
127 # COMMON-NEXT: - Name: .debug_addr
128 # COMMON-NEXT: Type: [[TYPE]]
129 # FLAGS-NEXT: Flags: [ SHF_ALLOC ]
130 # LINK-NEXT: Link: .sec
131 # ADDR-NEXT: Address: 0x2020
132 # ADDRALIGN-NEXT: AddressAlign: 0x3
133 # ENTSIZE-NEXT: EntSize: 0x3
134 # INFO-NEXT: Info: 0x3
135 # COMMON-NEXT: - Name: .sec
136 # COMMON-NEXT: Type: SHT_PROGBITS
137 # COMMON-NEXT: DWARF:
138 # COMMON-NEXT: debug_addr:
139 # COMMON-NEXT: - Length: 0x14
140 # COMMON-NEXT: Version: 0x5
141 # COMMON-NEXT: AddressSize: 0x8
142 # COMMON-NEXT: Entries:
143 # COMMON-NEXT: - Address: 0x1234
144 # COMMON-NEXT: - Address: 0x5678
154 Type: [[TYPE=SHT_PROGBITS]]
155 Flags: [[FLAGS=<none>]]
156 Link: [[LINK=<none>]]
157 EntSize: [[ENTSIZE=<none>]]
158 Info: [[INFO=<none>]]
159 AddressAlign: [[ADDRALIGN=0]]
160 Address: [[ADDRESS=<none>]]
170 ## c) Test dumping an address table whose version isn't 5.
171 ## This causes the DWARF parser to fail to parse it and we will dump it as a raw
174 # RUN: yaml2obj --docnum=3 %s -DCONTENT="AABBCC" | obj2yaml | \
175 # RUN: FileCheck %s --check-prefix=RAW --implicit-check-not=DWARF:
178 # RAW-NEXT: - Name: .debug_addr
179 # RAW-NEXT: Type: SHT_PROGBITS
180 # RAW-NEXT: AddressAlign: 0x1
181 # RAW-NEXT: Content: AABBCC
193 Size: [[SIZE=<none>]]
194 Content: [[CONTENT=<none>]]
196 ## d) Test dumping an empty .debug_addr section.
198 # RUN: yaml2obj --docnum=3 %s -DSIZE=0 | obj2yaml | \
199 # RUN: FileCheck %s --check-prefix=EMPTY --implicit-check-not=Sections:
202 # EMPTY-NEXT: debug_addr: []