1## a) Test that we are able to dump the __debug_aranges section. 2## The content of the __debug_aranges section should be written in 3## the "DWARF" entry and the "content" field should remain empty. 4 5# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck -DSEGNAME=DWARF %s --check-prefix=ARANGES 6 7# ARANGES: Sections: 8# ARANGES-NEXT: - sectname: __debug_aranges 9# ARANGES-NEXT: segname: __[[SEGNAME]] 10# ARANGES-NEXT: addr: 0x0 11# ARANGES-NEXT: size: 64 12# ARANGES-NEXT: offset: 0x210 13# ARANGES-NEXT: align: 0 14# ARANGES-NEXT: reloff: 0x0 15# ARANGES-NEXT: nreloc: 0 16# ARANGES-NEXT: flags: 0x0 17# ARANGES-NEXT: reserved1: 0x0 18# ARANGES-NEXT: reserved2: 0x0 19# ARANGES-NEXT: reserved3: 0x0 20# ARANGES-NEXT: DWARF: 21# ARANGES-NEXT: debug_aranges: 22# ARANGES-NEXT: - Length: 0x3C 23# ARANGES-NEXT: Version: 2 24# ARANGES-NEXT: CuOffset: 0x1234 25# ARANGES-NEXT: AddressSize: 0x8 26# ARANGES-NEXT: Descriptors: 27# ARANGES-NEXT: - Address: 0x1234 28# ARANGES-NEXT: Length: 0x5678 29# ARANGES-NEXT: - Address: 0x1234 30# ARANGES-NEXT: Length: 0x5678 31 32--- !mach-o 33IsLittleEndian: true 34FileHeader: 35 magic: 0xFEEDFACF 36 cputype: 0x01000007 37 cpusubtype: 0x00000003 38 filetype: 0x0000000A 39 ncmds: 1 40 sizeofcmds: 232 41 flags: 0x00000000 42 reserved: 0x00000000 43LoadCommands: 44 - cmd: LC_SEGMENT_64 45 cmdsize: 152 46 segname: __DWARF 47 vmaddr: 0x00 48 vmsize: 0x00 49 fileoff: 0x00 50 filesize: 0x00 51 maxprot: 0 52 initprot: 0 53 nsects: 1 54 flags: 0 55 Sections: 56 - sectname: __debug_aranges 57 segname: __DWARF 58 addr: 0x00 59 size: 64 60 offset: 528 61 align: 0 62 reloff: 0x00000000 63 nreloc: 0 64 flags: 0x00000000 65 reserved1: 0x00000000 66 reserved2: 0x00000000 67 reserved3: 0x00000000 68DWARF: 69 debug_aranges: 70 - Length: [[LENGTH=<none>]] 71 Version: 2 72 CuOffset: 0x1234 73 Descriptors: 74 - Address: 0x1234 75 Length: 0x5678 76 - Address: 0x1234 77 Length: 0x5678 78 79## b) Test dumping a __debug_aranges section whose length field doesn't match the actual length. 80## This makes the DWARF parser fail to parse it and we will dump it as a raw content section. 81 82# RUN: yaml2obj --docnum=1 -DLENGTH=0x2 %s | obj2yaml | FileCheck %s --check-prefix=RAW-CONTENT 83 84# RAW-CONTENT: - sectname: __debug_aranges 85# RAW-CONTENT-NEXT: segname: __DWARF 86# RAW-CONTENT-NEXT: addr: 0x0 87# RAW-CONTENT-NEXT: size: 64 88# RAW-CONTENT-NEXT: offset: 0x210 89# RAW-CONTENT-NEXT: align: 0 90# RAW-CONTENT-NEXT: reloff: 0x0 91# RAW-CONTENT-NEXT: nreloc: 0 92# RAW-CONTENT-NEXT: flags: 0x0 93# RAW-CONTENT-NEXT: reserved1: 0x0 94# RAW-CONTENT-NEXT: reserved2: 0x0 95# RAW-CONTENT-NEXT: reserved3: 0x0 96# RAW-CONTENT-NEXT: content: '02000000020034120000080000000000341200000000000078560000000000003412000000000000785600000000000000000000000000000000000000000000' 97# RAW-CONTENT-NEXT: ... 98 99## c) Test dumping a __debug_aranges section whose segname is __FOO. 100 101# RUN: yaml2obj --docnum=2 %s | obj2yaml | FileCheck %s -DSEGNAME=FOO --check-prefix=ARANGES 102 103--- !mach-o 104IsLittleEndian: true 105FileHeader: 106 magic: 0xFEEDFACF 107 cputype: 0x01000007 108 cpusubtype: 0x00000003 109 filetype: 0x0000000A 110 ncmds: 1 111 sizeofcmds: 232 112 flags: 0x00000000 113 reserved: 0x00000000 114LoadCommands: 115 - cmd: LC_SEGMENT_64 116 cmdsize: 152 117 segname: __DWARF 118 vmaddr: 0x00 119 vmsize: 0x00 120 fileoff: 0x00 121 filesize: 0x00 122 maxprot: 0 123 initprot: 0 124 nsects: 1 125 flags: 0 126 Sections: 127 - sectname: __debug_aranges 128 segname: __FOO 129 addr: 0x00 130 size: 64 131 offset: 528 132 align: 0 133 reloff: 0x00000000 134 nreloc: 0 135 flags: 0x00000000 136 reserved1: 0x00000000 137 reserved2: 0x00000000 138 reserved3: 0x00000000 139 content: '3C000000020034120000080000000000341200000000000078560000000000003412000000000000785600000000000000000000000000000000000000000000' 140