llvm/llvm/test/tools/llvm-readobj/MachO/stabs-sorted.yaml

## Verify that llvm-readobj can dump files with stabs symbols in a sorted order.

# RUN: yaml2obj --docnum=1 %s -o %t

# RUN: not llvm-readobj --syms --sort-symbols=foo %t 2>&1 | FileCheck %s --check-prefix ERR-KEY
# RUN: not llvm-readobj --syms --sort-symbols=,, %t 2>&1 | FileCheck %s --check-prefix ERR-KEY-EMPT

# RUN: llvm-readobj --syms --sort-symbols=type,name %t | FileCheck %s --check-prefix TYPE-NAME
# RUN: llvm-readobj --syms --sort-symbols=name,type %t | FileCheck %s --check-prefix NAME-TYPE
# RUN: llvm-readobj --syms --sort-symbols=type %t | FileCheck %s --check-prefix TYPE-ONLY

# ERR-KEY: error: --sort-symbols value should be 'name' or 'type', but was 'foo'
# ERR-KEY-EMPT: error: --sort-symbols value should be 'name' or 'type', but was ''

# TYPE-NAME:      Name: _a (19)
# TYPE-NAME-NEXT: Type: Section (0xE)
# TYPE-NAME:      Name: _d (10)
# TYPE-NAME-NEXT: Type: Section (0xE)
# TYPE-NAME:      Name: _f (7)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x2E)
# TYPE-NAME:      Name: _z (1)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x2E)
# TYPE-NAME:      Name: _c (13)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x64)
# TYPE-NAME:      Name: _g (4)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x64)
# TYPE-NAME:      Name: _b (16)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x66)
# TYPE-NAME:      Name: _d2 (22)
# TYPE-NAME-NEXT: Type: SymDebugTable (0x66)

# NAME-TYPE:         Name: _a (19)
# NAME-TYPE-NEXT:    Type: Section (0xE)
# NAME-TYPE:         Name: _b (16)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x66)
# NAME-TYPE:         Name: _c (13)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x64)
# NAME-TYPE:         Name: _d (10)
# NAME-TYPE-NEXT:    Type: Section (0xE)
# NAME-TYPE:         Name: _d2 (22)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x66)
# NAME-TYPE:         Name: _f (7)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x2E)
# NAME-TYPE:         Name: _g (4)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x64)
# NAME-TYPE:         Name: _z (1)
# NAME-TYPE-NEXT:    Type: SymDebugTable (0x2E)

# TYPE-ONLY:        Name: _d (10)
# TYPE-ONLY-NEXT:   Type: Section (0xE)
# TYPE-ONLY:        Name: _a (19)
# TYPE-ONLY-NEXT:   Type: Section (0xE)
# TYPE-ONLY:        Name: _f (7)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x2E)
# TYPE-ONLY:        Name: _z (1)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x2E)
# TYPE-ONLY:        Name: _g (4)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x64)
# TYPE-ONLY:        Name: _c (13)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x64)
# TYPE-ONLY:        Name: _d2 (22)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x66)
# TYPE-ONLY:        Name: _b (16)
# TYPE-ONLY-NEXT:   Type: SymDebugTable (0x66)

--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x1000007
  cpusubtype:      0x3
  filetype:        0x1
  ncmds:           3
  sizeofcmds:      496
  flags:           0x2000
  reserved:        0x0
LoadCommands:
  - cmd:             LC_SEGMENT_64
    cmdsize:         392
    segname:         ''
    vmaddr:          0
    vmsize:          32
    fileoff:         528
    filesize:        28
    maxprot:         7
    initprot:        7
    nsects:          4
    flags:           0
    Sections:
      - sectname:        __text
        segname:         __TEXT
        addr:            0x0
        size:            9
        offset:          0x210
        align:           0
        reloff:          0x230
        nreloc:          1
        flags:           0x80000000
        reserved1:       0x0
        reserved2:       0x0
        reserved3:       0x0
        content:         '000000000000000000'
        relocations:
          - address:         0x0
            symbolnum:       7
            pcrel:           false
            length:          3
            extern:          true
            type:            0
            scattered:       false
            value:           0
      - sectname:        more_data
        segname:         __DATA
        addr:            0x9
        size:            8
        offset:          0x219
        align:           0
        reloff:          0x0
        nreloc:          0
        flags:           0x0
        reserved1:       0x0
        reserved2:       0x0
        reserved3:       0x0
        content:         7B00000000000000
      - sectname:        __data
        segname:         __DATA
        addr:            0x11
        size:            11
        offset:          0x221
        align:           0
        reloff:          0x0
        nreloc:          0
        flags:           0x0
        reserved1:       0x0
        reserved2:       0x0
        reserved3:       0x0
        content:         7B00000000000000000000
      - sectname:        __common
        segname:         __DATA
        addr:            0x1C
        size:            4
        offset:          0x0
        align:           2
        reloff:          0x0
        nreloc:          0
        flags:           0x1
        reserved1:       0x0
        reserved2:       0x0
        reserved3:       0x0
  - cmd:             LC_SYMTAB
    cmdsize:         24
    symoff:          568
    nsyms:           8
    stroff:          696
    strsize:         32
  - cmd:             LC_DYSYMTAB
    cmdsize:         80
    ilocalsym:       0
    nlocalsym:       7
    iextdefsym:      7
    nextdefsym:      0
    iundefsym:       7
    nundefsym:       1
    tocoff:          0
    ntoc:            0
    modtaboff:       0
    nmodtab:         0
    extrefsymoff:    0
    nextrefsyms:     0
    indirectsymoff:  0
    nindirectsyms:   0
    extreloff:       0
    nextrel:         0
    locreloff:       0
    nlocrel:         0
LinkEditData:
  NameList:
    - n_strx:          4
      n_type:          0x64
      n_sect:          1
      n_desc:          0
      n_value:         0
    - n_strx:          10
      n_type:          0xE
      n_sect:          1
      n_desc:          0
      n_value:         8
    - n_strx:          22
      n_type:          0x66
      n_sect:          1
      n_desc:          0
      n_value:         8
    - n_strx:          16
      n_type:          0x66
      n_sect:          2
      n_desc:          0
      n_value:         9
    - n_strx:          19
      n_type:          0xE
      n_sect:          3
      n_desc:          0
      n_value:         17
    - n_strx:          13
      n_type:          0x64
      n_sect:          4
      n_desc:          0
      n_value:         28
    - n_strx:          7
      n_type:          0x2E
      n_sect:          3
      n_desc:          0
      n_value:         25
    - n_strx:          1
      n_type:          0x2E
      n_sect:          0
      n_desc:          0
      n_value:         0
  StringTable:
    - ''
    - _z
    - _g
    - _f
    - _d
    - _c
    - _b
    - _a
    - _d2
    - ''
    - ''
    - ''
    - ''
    - ''
    - ''
...