[PATCH] D33785: [CodeView] Fix alignment / padding when writing symbol records

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 13:16:05 PDT 2017


zturner updated this revision to Diff 101093.
zturner added a comment.

Updated with suggestions from inglorion.  Note that I actually fixed a bug with this update of the patch.  We weren't respecting the PDB / Object File alignment difference when writing the debug subsections, only when writing symbol records.  We still had the padding hardcoded to 4 in the debug subsections.  This definitely isn't true though, as I currently have this from a dump of an MSVC generated object file.

  CodeViewDebugInfo [
    Section: .debug$S (2)
    Magic: 0x4
    Subsection [
      SubSectionType: Symbols (0xF1)
      SubSectionSize: 0x71
      SubSectionContents (
        0000: 33000111 00000000 443A5C73 72635C6C  |3.......D:\src\l|
        0010: 6C766D62 75696C64 5C6E696E 6A615C63  |lvmbuild\ninja\c|
        0020: 6F646576 6965772D 74797065 732D636C  |odeview-types-cl|
        0030: 2E6F626A 003A003C 11012000 00070013  |.obj.:.<.. .....|
        0040: 000A00BB 61000013 000A00BB 6100004D  |....a.......a..M|
        0050: 6963726F 736F6674 20285229 204F7074  |icrosoft (R) Opt|
        0060: 696D697A 696E6720 436F6D70 696C6572  |imizing Compiler|
        0070: 00                                   |.|
      )
  ...
  
  So in this patch I also update the `DebugSubsectionRecordBuilder` to use the appropriate
  alignment when computing its size and when writing itself.


https://reviews.llvm.org/D33785

Files:
  lld/COFF/PDB.cpp
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
  llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolDumper.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecordMapping.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h
  llvm/include/llvm/ObjectYAML/CodeViewYAMLSymbols.h
  llvm/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
  llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/SymbolSerializer.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
  llvm/test/DebugInfo/PDB/pdbdump-write.test
  llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
  llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
  llvm/tools/llvm-readobj/COFFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33785.101093.patch
Type: text/x-patch
Size: 23220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/99296eec/attachment-0001.bin>


More information about the llvm-commits mailing list