[PATCH] D59502: [DebugInfo][PDB] Don't write empty debug streams

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 11:38:20 PDT 2019


aganea created this revision.
aganea added reviewers: rnk, zturner, mstorsjo.
Herald added subscribers: llvm-commits, aprantl.
Herald added a project: LLVM.

Before, empty debug streams were written as 8 bytes (4 bytes signature + 4 bytes for the GlobalRefs count), see here <https://github.com/llvm/llvm-project/blob/2946cd701067404b99c39fb29dc9c74bd7193eb3/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp#L34>.

With this patch, unused empty streams aren't emitted anymore. Modules now encode 65535 as an 'unused stream' value, by convention.
Also fix the `* Linker *` contrib section which wasn't correctly emitted previously.

As a side-effect, MinGW PDBs are now much smaller. Tested with Martin's dataset <https://martin.st/temp/vlc-qt-plugin-repro.zip>, using `lld-link @response.txt /debug`
libqt_plugin.pdb:

| trunk      | 21 MB   |
| this patch | 13.3 MB |
|

This was previously caused by the large amount of MinGW sections which create a separate module, each with its own debug stream:

                            Summary                           
  ============================================================
    Block Size: 4096
    Number of blocks: 5491
    Number of streams: 2151 <----------
    Signature: 382173742
    Age: 1
    GUID: {2E82C716-1297-3F14-4C4C-44205044422E}
    Features: 0x0
    Has Debug Info: true
    Has Types: true
    Has IDs: false
    Has Globals: true
    Has Publics: true
    Is incrementally linked: false
    Has conflicting types: false
    Is stripped: false
  ...
    Stream   13 (      8 bytes): [Module "C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o"]
                 Blocks: [1775]
  ...
  Mod 0003 | `C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o`: 
    Stream 13, 8 bytes
    
      Symbols
                                         Total:       0 entries (       0 bytes)
      --------------------------------------------------------------------------
    
      Chunks
                                         Total:       0 entries (       0 bytes)
      --------------------------------------------------------------------------

With this patch:

                            Summary                           
  ============================================================
    Block Size: 4096
    Number of blocks: 3397
    Number of streams: 45 <----------
    Signature: 4031447796
    Age: 1
    GUID: {F4024BF0-D475-9E33-4C4C-44205044422E}
    Features: 0x0
    Has Debug Info: true
    Has Types: true
    Has IDs: false
    Has Globals: true
    Has Publics: true
    Is incrementally linked: false
    Has conflicting types: false
    Is stripped: false
  ...
  Mod 0003 | `C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o`: 
    Mod    3 (debug info not present): [C:\Users\aganea\Downloads\vlc-qt-plugin-repro\home\martin\fate\vlc\src\build-x86_64\modules\gui\qt\.libs\libqt_plugin_la-qt.o]


https://reviews.llvm.org/D59502

Files:
  lld/trunk/COFF/PDB.cpp
  lld/trunk/test/COFF/pdb-global-gc.yaml
  lld/trunk/test/COFF/pdb-lib.s
  lld/trunk/test/COFF/pdb.test
  llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
  llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
  llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59502.191132.patch
Type: text/x-patch
Size: 7730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190318/379f957e/attachment.bin>


More information about the llvm-commits mailing list