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
|
## a) Test that we are able to dump the __debug_aranges section.
## The content of the __debug_aranges section should be written in
## the "DWARF" entry and the "content" field should remain empty.
# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck -DSEGNAME=DWARF %s --check-prefix=ARANGES
# ARANGES: Sections:
# ARANGES-NEXT: - sectname: __debug_aranges
# ARANGES-NEXT: segname: __[[SEGNAME]]
# ARANGES-NEXT: addr: 0x0
# ARANGES-NEXT: size: 64
# ARANGES-NEXT: offset: 0x210
# ARANGES-NEXT: align: 0
# ARANGES-NEXT: reloff: 0x0
# ARANGES-NEXT: nreloc: 0
# ARANGES-NEXT: flags: 0x0
# ARANGES-NEXT: reserved1: 0x0
# ARANGES-NEXT: reserved2: 0x0
# ARANGES-NEXT: reserved3: 0x0
# ARANGES-NEXT: DWARF:
# ARANGES-NEXT: debug_aranges:
# ARANGES-NEXT: - Length: 0x3C
# ARANGES-NEXT: Version: 2
# ARANGES-NEXT: CuOffset: 0x1234
# ARANGES-NEXT: AddressSize: 0x8
# ARANGES-NEXT: Descriptors:
# ARANGES-NEXT: - Address: 0x1234
# ARANGES-NEXT: Length: 0x5678
# ARANGES-NEXT: - Address: 0x1234
# ARANGES-NEXT: Length: 0x5678
--- !mach-o
IsLittleEndian: true
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x0000000A
ncmds: 1
sizeofcmds: 232
flags: 0x00000000
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 152
segname: __DWARF
vmaddr: 0x00
vmsize: 0x00
fileoff: 0x00
filesize: 0x00
maxprot: 0
initprot: 0
nsects: 1
flags: 0
Sections:
- sectname: __debug_aranges
segname: __DWARF
addr: 0x00
size: 64
offset: 528
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
DWARF:
debug_aranges:
- Length: [[LENGTH=<none>]]
Version: 2
CuOffset: 0x1234
Descriptors:
- Address: 0x1234
Length: 0x5678
- Address: 0x1234
Length: 0x5678
## b) Test dumping a __debug_aranges section whose length field doesn't match the actual length.
## This makes the DWARF parser fail to parse it and we will dump it as a raw content section.
# RUN: yaml2obj --docnum=1 -DLENGTH=0x2 %s | obj2yaml | FileCheck %s --check-prefix=RAW-CONTENT
# RAW-CONTENT: - sectname: __debug_aranges
# RAW-CONTENT-NEXT: segname: __DWARF
# RAW-CONTENT-NEXT: addr: 0x0
# RAW-CONTENT-NEXT: size: 64
# RAW-CONTENT-NEXT: offset: 0x210
# RAW-CONTENT-NEXT: align: 0
# RAW-CONTENT-NEXT: reloff: 0x0
# RAW-CONTENT-NEXT: nreloc: 0
# RAW-CONTENT-NEXT: flags: 0x0
# RAW-CONTENT-NEXT: reserved1: 0x0
# RAW-CONTENT-NEXT: reserved2: 0x0
# RAW-CONTENT-NEXT: reserved3: 0x0
# RAW-CONTENT-NEXT: content: '02000000020034120000080000000000341200000000000078560000000000003412000000000000785600000000000000000000000000000000000000000000'
# RAW-CONTENT-NEXT: ...
## c) Test dumping a __debug_aranges section whose segname is __FOO.
# RUN: yaml2obj --docnum=2 %s | obj2yaml | FileCheck %s -DSEGNAME=FOO --check-prefix=ARANGES
--- !mach-o
IsLittleEndian: true
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x0000000A
ncmds: 1
sizeofcmds: 232
flags: 0x00000000
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 152
segname: __DWARF
vmaddr: 0x00
vmsize: 0x00
fileoff: 0x00
filesize: 0x00
maxprot: 0
initprot: 0
nsects: 1
flags: 0
Sections:
- sectname: __debug_aranges
segname: __FOO
addr: 0x00
size: 64
offset: 528
align: 0
reloff: 0x00000000
nreloc: 0
flags: 0x00000000
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
content: '3C000000020034120000080000000000341200000000000078560000000000003412000000000000785600000000000000000000000000000000000000000000'
|