aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-pdbdump/YAMLOutputStyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-pdbdump/YAMLOutputStyle.cpp')
-rw-r--r--tools/llvm-pdbdump/YAMLOutputStyle.cpp44
1 files changed, 31 insertions, 13 deletions
diff --git a/tools/llvm-pdbdump/YAMLOutputStyle.cpp b/tools/llvm-pdbdump/YAMLOutputStyle.cpp
index 3f2733d701a8..5b53d2137166 100644
--- a/tools/llvm-pdbdump/YAMLOutputStyle.cpp
+++ b/tools/llvm-pdbdump/YAMLOutputStyle.cpp
@@ -13,18 +13,20 @@
#include "llvm-pdbdump.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
-#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
-#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
-#include "llvm/DebugInfo/PDB/Raw/TpiStream.h"
+#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
+#include "llvm/DebugInfo/PDB/Native/ModStream.h"
+#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
+#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
+#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
using namespace llvm;
using namespace llvm::pdb;
YAMLOutputStyle::YAMLOutputStyle(PDBFile &File)
- : File(File), Out(outs()), Obj(File.getAllocator()) {}
+ : File(File), Out(outs()), Obj(File.getAllocator()) {
+ Out.setWriteDefaultValues(!opts::pdb2yaml::Minimal);
+}
Error YAMLOutputStyle::dump() {
if (opts::pdb2yaml::StreamDirectory)
@@ -45,6 +47,9 @@ Error YAMLOutputStyle::dump() {
if (auto EC = dumpStreamDirectory())
return EC;
+ if (auto EC = dumpStringTable())
+ return EC;
+
if (auto EC = dumpPDBStream())
return EC;
@@ -83,6 +88,24 @@ Error YAMLOutputStyle::dumpFileHeaders() {
return Error::success();
}
+Error YAMLOutputStyle::dumpStringTable() {
+ if (!opts::pdb2yaml::StringTable)
+ return Error::success();
+
+ Obj.StringTable.emplace();
+ auto ExpectedST = File.getStringTable();
+ if (!ExpectedST)
+ return ExpectedST.takeError();
+
+ const auto &ST = ExpectedST.get();
+ for (auto ID : ST.name_ids()) {
+ StringRef S = ST.getStringForID(ID);
+ if (!S.empty())
+ Obj.StringTable->push_back(S);
+ }
+ return Error::success();
+}
+
Error YAMLOutputStyle::dumpStreamMetadata() {
if (!opts::pdb2yaml::StreamMetadata)
return Error::success();
@@ -122,12 +145,7 @@ Error YAMLOutputStyle::dumpPDBStream() {
Obj.PdbStream->Guid = InfoS.getGuid();
Obj.PdbStream->Signature = InfoS.getSignature();
Obj.PdbStream->Version = InfoS.getVersion();
- for (auto &NS : InfoS.named_streams()) {
- yaml::NamedStreamMapping Mapping;
- Mapping.StreamName = NS.getKey();
- Mapping.StreamNumber = NS.getValue();
- Obj.PdbStream->NamedStreams.push_back(Mapping);
- }
+ Obj.PdbStream->Features = InfoS.getFeatureSignatures();
return Error::success();
}