| ## 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' |