diff options
| author | Zachary Turner <zturner@google.com> | 2017-06-05 21:40:33 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-06-05 21:40:33 +0000 |
| commit | 349c18f8377aa46af024e0ba7d312304ad2ac28a (patch) | |
| tree | 1bbd719c419cb69fa87cd037de57ab206216741e /llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp | |
| parent | 5b0bf2ff0d80998804871ab151ec2f00ff2dee8b (diff) | |
| download | bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.tar.gz bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.zip | |
[CodeView] Handle Cross Module Imports and Exports.
While it's not entirely clear why a compiler or linker might
put this information into an object or PDB file, one has been
spotted in the wild which was causing llvm-pdbdump to crash.
This patch adds support for reading-writing these sections.
Since I don't know how to get one of the native tools to
generate this kind of debug info, the only test here is one
in which we feed YAML into the tool to produce a PDB and
then spit out YAML from the resulting PDB and make sure that
it matches.
llvm-svn: 304738
Diffstat (limited to 'llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp')
| -rw-r--r-- | llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp index 31c342cd0f5..cd5bf8a095d 100644 --- a/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp +++ b/llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp @@ -16,6 +16,8 @@ #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h" +#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h" +#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h" #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h" #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h" @@ -174,6 +176,32 @@ public: return Error::success(); } + Error handleCrossModuleExports() override { + for (const auto &M : CrossExports) { + DictScope D(P, "CrossModuleExports"); + for (const auto &E : M) { + P.printHex("Local", E.Local); + P.printHex("Global", E.Global); + } + } + return Error::success(); + } + + Error handleCrossModuleImports() override { + for (const auto &M : CrossImports) { + DictScope D(P, "CrossModuleImports"); + for (const auto &ImportGroup : M) { + auto Name = + getNameFromStringTable(ImportGroup.Header->ModuleNameOffset); + if (!Name) + return Name.takeError(); + P.printString("Module", *Name); + P.printHexList("Imports", ImportGroup.Imports); + } + } + return Error::success(); + } + private: Error dumpTypeRecord(StringRef Label, TypeIndex Index) { CompactTypeDumpVisitor CTDV(IPI, Index, &P); |

