140 lines · yaml
1## a) Test that we are able to dump the __debug_aranges section.2## The content of the __debug_aranges section should be written in3## the "DWARF" entry and the "content" field should remain empty.4 5# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck -DSEGNAME=DWARF %s --check-prefix=ARANGES6 7# ARANGES: Sections:8# ARANGES-NEXT: - sectname: __debug_aranges9# ARANGES-NEXT: segname: __[[SEGNAME]]10# ARANGES-NEXT: addr: 0x011# ARANGES-NEXT: size: 6412# ARANGES-NEXT: offset: 0x21013# ARANGES-NEXT: align: 014# ARANGES-NEXT: reloff: 0x015# ARANGES-NEXT: nreloc: 016# ARANGES-NEXT: flags: 0x017# ARANGES-NEXT: reserved1: 0x018# ARANGES-NEXT: reserved2: 0x019# ARANGES-NEXT: reserved3: 0x020# ARANGES-NEXT: DWARF:21# ARANGES-NEXT: debug_aranges:22# ARANGES-NEXT: - Length: 0x3C23# ARANGES-NEXT: Version: 224# ARANGES-NEXT: CuOffset: 0x123425# ARANGES-NEXT: AddressSize: 0x826# ARANGES-NEXT: Descriptors:27# ARANGES-NEXT: - Address: 0x123428# ARANGES-NEXT: Length: 0x567829# ARANGES-NEXT: - Address: 0x123430# ARANGES-NEXT: Length: 0x567831 32--- !mach-o33IsLittleEndian: true34FileHeader:35 magic: 0xFEEDFACF36 cputype: 0x0100000737 cpusubtype: 0x0000000338 filetype: 0x0000000A39 ncmds: 140 sizeofcmds: 23241 flags: 0x0000000042 reserved: 0x0000000043LoadCommands:44 - cmd: LC_SEGMENT_6445 cmdsize: 15246 segname: __DWARF47 vmaddr: 0x0048 vmsize: 0x0049 fileoff: 0x0050 filesize: 0x0051 maxprot: 052 initprot: 053 nsects: 154 flags: 055 Sections:56 - sectname: __debug_aranges57 segname: __DWARF58 addr: 0x0059 size: 6460 offset: 52861 align: 062 reloff: 0x0000000063 nreloc: 064 flags: 0x0000000065 reserved1: 0x0000000066 reserved2: 0x0000000067 reserved3: 0x0000000068DWARF:69 debug_aranges:70 - Length: [[LENGTH=<none>]]71 Version: 272 CuOffset: 0x123473 Descriptors:74 - Address: 0x123475 Length: 0x567876 - Address: 0x123477 Length: 0x567878 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-CONTENT83 84# RAW-CONTENT: - sectname: __debug_aranges85# RAW-CONTENT-NEXT: segname: __DWARF86# RAW-CONTENT-NEXT: addr: 0x087# RAW-CONTENT-NEXT: size: 6488# RAW-CONTENT-NEXT: offset: 0x21089# RAW-CONTENT-NEXT: align: 090# RAW-CONTENT-NEXT: reloff: 0x091# RAW-CONTENT-NEXT: nreloc: 092# RAW-CONTENT-NEXT: flags: 0x093# RAW-CONTENT-NEXT: reserved1: 0x094# RAW-CONTENT-NEXT: reserved2: 0x095# RAW-CONTENT-NEXT: reserved3: 0x096# 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=ARANGES102 103--- !mach-o104IsLittleEndian: true105FileHeader:106 magic: 0xFEEDFACF107 cputype: 0x01000007108 cpusubtype: 0x00000003109 filetype: 0x0000000A110 ncmds: 1111 sizeofcmds: 232112 flags: 0x00000000113 reserved: 0x00000000114LoadCommands:115 - cmd: LC_SEGMENT_64116 cmdsize: 152117 segname: __DWARF118 vmaddr: 0x00119 vmsize: 0x00120 fileoff: 0x00121 filesize: 0x00122 maxprot: 0123 initprot: 0124 nsects: 1125 flags: 0126 Sections:127 - sectname: __debug_aranges128 segname: __FOO129 addr: 0x00130 size: 64131 offset: 528132 align: 0133 reloff: 0x00000000134 nreloc: 0135 flags: 0x00000000136 reserved1: 0x00000000137 reserved2: 0x00000000138 reserved3: 0x00000000139 content: '3C000000020034120000080000000000341200000000000078560000000000003412000000000000785600000000000000000000000000000000000000000000'140