brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.7 KiB · 6638f2f Raw
238 lines · yaml
1## This file contains test cases for generating .debug_pubnames/.debug_pubtypes2## section in object files from the DWARF entry of Mach-O YAML inputs3 4## a) Test that yaml2obj emits the .debug_pubnames and .debug_pubtypes sections and5## obj2yaml converts them back.6 7# RUN: yaml2obj %s | obj2yaml | FileCheck %s8 9--- !mach-o10FileHeader:      11  magic:           0xFEEDFACF12  cputype:         0x0100000713  cpusubtype:      0x0000000314  filetype:        0x0000000A15  ncmds:           116  sizeofcmds:      180017  flags:           0x0000000018  reserved:        0x0000000019LoadCommands:    20  - cmd:             LC_SEGMENT_6421    cmdsize:         23222    segname:         __DWARF23    vmaddr:          024    vmsize:          025    fileoff:         15226    filesize:        0xffff27    maxprot:         028    initprot:        029    nsects:          230    flags:           031    Sections:        32      - sectname:  __debug_pubnames33        segname:   __DWARF34        addr:      0x000000000000000035        size:      2736        offset:    0x0000015237        align:     038        reloff:    0x0000000039        nreloc:    040        flags:     0x0000000041        reserved1: 0x0000000042        reserved2: 0x0000000043        reserved3: 0x0000000044      - sectname:  __debug_pubtypes45        segname:   __DWARF46        addr:      0x000000000000000047        size:      3548        offset:    0x0000072049        align:     050        reloff:    0x0000000051        nreloc:    052        flags:     0x0000000053        reserved1: 0x0000000054        reserved2: 0x0000000055        reserved3: 0x0000000056DWARF:           57  debug_pubnames:  58    Length:          2359    Version:         260    UnitOffset:      061    UnitSize:        12162    Entries:         63      - DieOffset:       0x0000002A64        Name:            main65  debug_pubtypes:  66    Length:          3167    Version:         268    UnitOffset:      069    UnitSize:        12170    Entries:         71      - DieOffset:       0x0000006072        Name:            int73      - DieOffset:       0x0000007174        Name:            char75 76#      CHECK: DWARF:77#      CHECK:   debug_pubnames:78# CHECK-NEXT:     Length:          0x1779# CHECK-NEXT:     Version:         280# CHECK-NEXT:     UnitOffset:      081# CHECK-NEXT:     UnitSize:        12182# CHECK-NEXT:     Entries:83# CHECK-NEXT:       - DieOffset:       0x2A84# CHECK-NEXT:         Name:            main85# CHECK-NEXT:   debug_pubtypes:86# CHECK-NEXT:     Length:          0x1F87# CHECK-NEXT:     Version:         288# CHECK-NEXT:     UnitOffset:      089# CHECK-NEXT:     UnitSize:        12190# CHECK-NEXT:     Entries:91# CHECK-NEXT:       - DieOffset:       0x6092# CHECK-NEXT:         Name:            int93# CHECK-NEXT:       - DieOffset:       0x7194# CHECK-NEXT:         Name:            char95# CHECK-NEXT: ...96 97## b) Test that yaml2obj will not emit the .debug_pubnames/.debug_pubtypes section's98## contents, if the "debug_pubnames"/"debug_pubtypes" entry doesn't exist in the99## "DWARF" entry.100 101# RUN: yaml2obj --docnum=2 %s -o %t2102# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=EMPTY103 104#      EMPTY: Sections:105# EMPTY-NEXT:   - sectname:        __debug_pubnames106# EMPTY-NEXT:     segname:         __DWARF107# EMPTY-NEXT:     addr:            0x0108# EMPTY-NEXT:     size:            0109# EMPTY-NEXT:     offset:          0x0110# EMPTY-NEXT:     align:           0111# EMPTY-NEXT:     reloff:          0x0112# EMPTY-NEXT:     nreloc:          0113# EMPTY-NEXT:     flags:           0x0114# EMPTY-NEXT:     reserved1:       0x0115# EMPTY-NEXT:     reserved2:       0x0116# EMPTY-NEXT:     reserved3:       0x0117# EMPTY-NEXT:   - sectname:        __debug_pubtypes118# EMPTY-NEXT:     segname:         __DWARF119# EMPTY-NEXT:     addr:            0x0120# EMPTY-NEXT:     size:            0121# EMPTY-NEXT:     offset:          0x720122# EMPTY-NEXT:     align:           0123# EMPTY-NEXT:     reloff:          0x0124# EMPTY-NEXT:     nreloc:          0125# EMPTY-NEXT:     flags:           0x0126# EMPTY-NEXT:     reserved1:       0x0127# EMPTY-NEXT:     reserved2:       0x0128# EMPTY-NEXT:     reserved3:       0x0129# EMPTY-NEXT: ...130 131--- !mach-o132FileHeader:133  magic:      0xFEEDFACF134  cputype:    0x01000007135  cpusubtype: 0x00000003136  filetype:   0x0000000A137  ncmds:      1138  sizeofcmds: 1772139  flags:      0x00000000140  reserved:   0x00000000141LoadCommands:142  - cmd:      LC_SEGMENT_64143    cmdsize:  232144    segname:  __DWARF145    vmaddr:   0x00000000146    vmsize:   0x00000000147    fileoff:  0148    filesize: 0149    maxprot:  0150    initprot: 0151    nsects:   2152    flags:    0153    Sections:154      - sectname:  __debug_pubnames155        segname:   __DWARF156        addr:      0x0000000000000000157        size:      0158        offset:    0x00000000159        align:     0160        reloff:    0x00000000161        nreloc:    0162        flags:     0x00000000163        reserved1: 0x00000000164        reserved2: 0x00000000165        reserved3: 0x00000000166      - sectname:  __debug_pubtypes167        segname:   __DWARF168        addr:      0x0000000000000000169        size:      0170        offset:    0x00000720171        align:     0172        reloff:    0x00000000173        nreloc:    0174        flags:     0x00000000175        reserved1: 0x00000000176        reserved2: 0x00000000177        reserved3: 0x00000000178DWARF:179 180## c) Test that obj2yaml is able to dump a __debug_pubnames section whose length field is greater than the section size.181 182# RUN: yaml2obj --docnum=3 %s | obj2yaml | FileCheck %s --check-prefix=INVALID-LENGTH183 184#      INVALID-LENGTH: DWARF:185# INVALID-LENGTH-NEXT:   debug_pubnames:186# INVALID-LENGTH-NEXT:     Length:          0xDEADBEEF187# INVALID-LENGTH-NEXT:     Version:         2188# INVALID-LENGTH-NEXT:     UnitOffset:      0189# INVALID-LENGTH-NEXT:     UnitSize:        121190# INVALID-LENGTH-NEXT:     Entries:191# INVALID-LENGTH-NEXT:       - DieOffset:       0x2A192# INVALID-LENGTH-NEXT:         Name:            main193 194--- !mach-o195FileHeader:196  magic:      0xFEEDFACF197  cputype:    0x01000007198  cpusubtype: 0x00000003199  filetype:   0x0000000A200  ncmds:      1201  sizeofcmds: 1888202  flags:      0x00000000203  reserved:   0x00000000204LoadCommands:205  - cmd:      LC_SEGMENT_64206    cmdsize:  152207    segname:  __DWARF208    vmaddr:   0x00000000209    vmsize:   0x00000000210    fileoff:  0211    filesize: 0xffff212    maxprot:  0213    initprot: 0214    nsects:   1215    flags:    0216    Sections:217      - sectname:  __debug_pubnames218        segname:   __DWARF219        addr:      0x0000000000000000220        size:      24221        offset:    0x000000b8222        align:     0223        reloff:    0x00000000224        nreloc:    0225        flags:     0x00000000226        reserved1: 0x00000000227        reserved2: 0x00000000228        reserved3: 0x00000000229DWARF:230  debug_pubnames:231    Length:     0xdeadbeef232    Version:    2233    UnitOffset: 0234    UnitSize:   121235    Entries:236      - DieOffset: 0x0000002A237        Name:      main238