1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
|
## Test how we dump the .debug_addr section.
## a) Dumping address tables from various object files.
## Dumping address tables from a little endian 64-bit object file.
# RUN: yaml2obj --docnum=1 %s -DADDRESS=0xFFFFFFFFFFFFFFFF \
# RUN: -DADDRSIZE=4 | obj2yaml | \
# RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
# RUN: -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
# RUN: -DLENGTH2=0xC -DADDRSIZE2=0x4
## Dumping address tables from a big endian 64-bit object file.
# RUN: yaml2obj --docnum=1 %s -DENDIAN=MSB -DADDRESS=0xFFFFFFFFFFFFFFFF \
# RUN: -DADDRSIZE=4 | obj2yaml | \
# RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
# RUN: -DLENGTH1=0x14 -DADDRSIZE1=0x8 -DADDR=0xFFFFFFFFFFFFFFFF \
# RUN: -DLENGTH2=0xC -DADDRSIZE2=0x4
## Dumping address tables from a little endian 32-bit object file.
# RUN: yaml2obj --docnum=1 %s -DBITS=32 -DADDRESS=0xFFFFFFFF \
# RUN: -DADDRSIZE=8 | obj2yaml | \
# RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
# RUN: -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
# RUN: -DLENGTH2=0x14 -DADDRSIZE2=0x8
## Dumping address tables from a big endian 32-bit object file.
# RUN: yaml2obj --docnum=1 %s -DBITS=32 -DENDIAN=MSB -DADDRESS=0xFFFFFFFF \
# RUN: -DADDRSIZE=8 | obj2yaml | \
# RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not=Sections: \
# RUN: -DLENGTH1=0xC -DADDRSIZE1=0x4 -DADDR=0xFFFFFFFF \
# RUN: -DLENGTH2=0x14 -DADDRSIZE2=0x8
# BASIC: DWARF:
# BASIC-NEXT: debug_addr:
# BASIC-NEXT: - Length: [[LENGTH1]]
# BASIC-NEXT: Version: 0x5
# BASIC-NEXT: AddressSize: [[ADDRSIZE1]]
# BASIC-NEXT: Entries:
# BASIC-NEXT: - Address: 0x1234
# BASIC-NEXT: - Address: 0x5678
# BASIC-NEXT: - Format: DWARF64
# BASIC-NEXT: Length: [[LENGTH1]]
# BASIC-NEXT: Version: 0x5
# BASIC-NEXT: AddressSize: [[ADDRSIZE1]]
# BASIC-NEXT: Entries:
# BASIC-NEXT: - Address: 0x1234
# BASIC-NEXT: - Address: [[ADDR]]
# BASIC-NEXT: - Length: [[LENGTH2]]
# BASIC-NEXT: Version: 0x5
# BASIC-NEXT: AddressSize: [[ADDRSIZE2]]
# BASIC-NEXT: Entries:
# BASIC-NEXT: - Address: 0x1234
# BASIC-NEXT: - Address: 0x5678
# BASIC-NEXT: - Format: DWARF64
# BASIC-NEXT: Length: [[LENGTH2]]
# BASIC-NEXT: Version: 0x5
# BASIC-NEXT: AddressSize: [[ADDRSIZE2]]
# BASIC-NEXT: Entries:
# BASIC-NEXT: - Address: 0x1234
# BASIC-NEXT: - Address: 0x5678
# BASIC-NEXT: ...
--- !ELF
FileHeader:
Class: ELFCLASS[[BITS=64]]
Data: ELFDATA2[[ENDIAN=LSB]]
Type: ET_EXEC
DWARF:
debug_addr:
## A DWARF32 address table.
- Version: 5
Entries:
- Address: 0x1234
- Address: 0x5678
## A DWARF64 address table.
- Format: DWARF64
Version: 5
Entries:
- Address: 0x1234
- Address: [[ADDRESS]]
## A DWARF32 address table with a mutable address size.
- Version: 5
AddressSize: [[ADDRSIZE]]
Entries:
- Address: 0x1234
- Address: 0x5678
## A DWARF64 address table with a mutable address size.
- Format: DWARF64
Version: 5
AddressSize: [[ADDRSIZE]]
Entries:
- Address: 0x1234
- Address: 0x5678
## b) Test dumping a .debug_addr section whose section header properties are
## overridden.
## Override the sh_type field.
# RUN: yaml2obj --docnum=2 %s -DTYPE=SHT_STRTAB | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_STRTAB --check-prefix=COMMON
## Override the sh_flags field.
# RUN: yaml2obj --docnum=2 %s -DFLAGS='[ SHF_ALLOC ]' | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,FLAGS
## Override the sh_link field.
# RUN: yaml2obj --docnum=2 %s -DLINK=.sec | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,LINK
## Override the sh_addr field.
# RUN: yaml2obj --docnum=2 %s -DADDRESS=0x2020 | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDR
## Override the sh_addralign field.
# RUN: yaml2obj --docnum=2 %s -DADDRALIGN=3 | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ADDRALIGN
## Override the sh_entsize field.
# RUN: yaml2obj --docnum=2 %s -DENTSIZE=3 | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,ENTSIZE
## Override the sh_info field.
# RUN: yaml2obj --docnum=2 %s -DINFO=3 | obj2yaml | \
# RUN: FileCheck %s -DTYPE=SHT_PROGBITS --check-prefixes=COMMON,INFO
# COMMON: Sections:
# COMMON-NEXT: - Name: .debug_addr
# COMMON-NEXT: Type: [[TYPE]]
# FLAGS-NEXT: Flags: [ SHF_ALLOC ]
# LINK-NEXT: Link: .sec
# ADDR-NEXT: Address: 0x2020
# ADDRALIGN-NEXT: AddressAlign: 0x3
# ENTSIZE-NEXT: EntSize: 0x3
# INFO-NEXT: Info: 0x3
# COMMON-NEXT: - Name: .sec
# COMMON-NEXT: Type: SHT_PROGBITS
# COMMON-NEXT: DWARF:
# COMMON-NEXT: debug_addr:
# COMMON-NEXT: - Length: 0x14
# COMMON-NEXT: Version: 0x5
# COMMON-NEXT: AddressSize: 0x8
# COMMON-NEXT: Entries:
# COMMON-NEXT: - Address: 0x1234
# COMMON-NEXT: - Address: 0x5678
# COMMON-NEXT: ...
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .debug_addr
Type: [[TYPE=SHT_PROGBITS]]
Flags: [[FLAGS=<none>]]
Link: [[LINK=<none>]]
EntSize: [[ENTSIZE=<none>]]
Info: [[INFO=<none>]]
AddressAlign: [[ADDRALIGN=0]]
Address: [[ADDRESS=<none>]]
- Name: .sec
Type: SHT_PROGBITS
DWARF:
debug_addr:
- Version: 5
Entries:
- Address: 0x1234
- Address: 0x5678
## c) Test dumping an address table whose version isn't 5.
## This causes the DWARF parser to fail to parse it and we will dump it as a raw
## content section.
# RUN: yaml2obj --docnum=3 %s -DCONTENT="AABBCC" | obj2yaml | \
# RUN: FileCheck %s --check-prefix=RAW --implicit-check-not=DWARF:
# RAW: Sections:
# RAW-NEXT: - Name: .debug_addr
# RAW-NEXT: Type: SHT_PROGBITS
# RAW-NEXT: AddressAlign: 0x1
# RAW-NEXT: Content: AABBCC
# RAW-NEXT: ...
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .debug_addr
Type: SHT_PROGBITS
AddressAlign: 1
Size: [[SIZE=<none>]]
Content: [[CONTENT=<none>]]
## d) Test dumping an empty .debug_addr section.
# RUN: yaml2obj --docnum=3 %s -DSIZE=0 | obj2yaml | \
# RUN: FileCheck %s --check-prefix=EMPTY --implicit-check-not=Sections:
# EMPTY: DWARF:
# EMPTY-NEXT: debug_addr: []
# EMPTY-NEXT: ...
|