[PATCH] D34257: [PDB] Start emitting source file and line information

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 21:19:01 PDT 2017


zturner added a comment.

I was able to get the first yaml file down to this:

  --- !COFF
  header:          
    Machine:         IMAGE_FILE_MACHINE_AMD64
    Characteristics: [  ]
  sections:        
    - Name:            '.debug$S'
      Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
      Alignment:       1
      Subsections:     
        - !Lines
          CodeSize:        19
          Flags:           [  ]
          RelocOffset:     0
          RelocSegment:    0
          Blocks:          
            - FileName:        'c:\src\llvm-project\build\pdb_lines_1.c'
              Lines:           
                - Offset:          0
                  LineStart:       2
                  IsStatement:     true
                  EndDelta:        0
                - Offset:          4
                  LineStart:       3
                  IsStatement:     true
                  EndDelta:        0
                - Offset:          9
                  LineStart:       4
                  IsStatement:     true
                  EndDelta:        0
                - Offset:          14
                  LineStart:       5
                  IsStatement:     true
                  EndDelta:        0
              Columns:         
        - !FileChecksums
          Checksums:       
            - FileName:        'c:\src\llvm-project\build\pdb_lines_1.c'
              Kind:            MD5
              Checksum:        4EB19DCD86C3BA2238A255C718572E7B
            - FileName:        'c:\src\llvm-project\build\foo.h'
              Kind:            MD5
              Checksum:        061EB73ABB642532857A4F1D9CBAC323
        - !StringTable
          Strings:         
            - 'c:\src\llvm-project\build\pdb_lines_1.c'
            - 'c:\src\llvm-project\build\foo.h'
    - Name:            '.debug$S'
      Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
      Alignment:       1
      Subsections:     
        - !Lines
          CodeSize:        14
          Flags:           [  ]
          RelocOffset:     0
          RelocSegment:    0
          Blocks:          
            - FileName:        'c:\src\llvm-project\build\foo.h'
              Lines:           
                - Offset:          0
                  LineStart:       2
                  IsStatement:     true
                  EndDelta:        0
                - Offset:          4
                  LineStart:       3
                  IsStatement:     true
                  EndDelta:        0
                - Offset:          9
                  LineStart:       4
                  IsStatement:     true
                  EndDelta:        0
              Columns:         
  symbols:         
    - Name:            '.debug$S'
      Value:           0
      SectionNumber:   2
      SimpleType:      IMAGE_SYM_TYPE_NULL
      ComplexType:     IMAGE_SYM_DTYPE_NULL
      StorageClass:    IMAGE_SYM_CLASS_STATIC
      SectionDefinition: 
        Length:          432
        NumberOfRelocations: 4
        NumberOfLinenumbers: 0
        CheckSum:        0
        Number:          0
    - Name:            '.debug$S'
      Value:           0
      SectionNumber:   6
      SimpleType:      IMAGE_SYM_TYPE_NULL
      ComplexType:     IMAGE_SYM_DTYPE_NULL
      StorageClass:    IMAGE_SYM_CLASS_STATIC
      SectionDefinition: 
        Length:          148
        NumberOfRelocations: 4
        NumberOfLinenumbers: 0
        CheckSum:        0
        Number:          5
        Selection:       IMAGE_COMDAT_SELECT_ASSOCIATIVE
  ...

Can we do something like this?  Seems to produce a valid object file and round-trips back.  Will it link?  I don't mind having a separate test that has a more real-world example, but in that case we shouldn't check in the yaml file with instructions on how to generate it, we should just actually compile something as part of the test.  Just seems like we should prefer keeping tests minimal whenever possible so that someone coming along and reading it can understand what all the moving parts are without having to get distracted by irrelevant stuff.


https://reviews.llvm.org/D34257





More information about the llvm-commits mailing list