summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp')
-rw-r--r--llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 4e80f413415..e94decce17b 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -1572,8 +1572,40 @@ Error DumpOutputStyle::dumpGlobals() {
ExitOnError Err("Error dumping globals stream: ");
auto &Globals = Err(getPdb().getPDBGlobalsStream());
- const GSIHashTable &Table = Globals.getGlobalsTable();
- Err(dumpSymbolsFromGSI(Table, opts::dump::DumpGlobalExtras));
+ if (opts::dump::DumpGlobalNames.empty()) {
+ const GSIHashTable &Table = Globals.getGlobalsTable();
+ Err(dumpSymbolsFromGSI(Table, opts::dump::DumpGlobalExtras));
+ } else {
+ SymbolStream &SymRecords = cantFail(getPdb().getPDBSymbolStream());
+ auto &Types = File.types();
+ auto &Ids = File.ids();
+
+ SymbolVisitorCallbackPipeline Pipeline;
+ SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);
+ MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Ids, Types);
+
+ Pipeline.addCallbackToPipeline(Deserializer);
+ Pipeline.addCallbackToPipeline(Dumper);
+ CVSymbolVisitor Visitor(Pipeline);
+
+ using ResultEntryType = std::pair<uint32_t, CVSymbol>;
+ for (StringRef Name : opts::dump::DumpGlobalNames) {
+ AutoIndent Indent(P);
+ P.formatLine("Global Name `{0}`", Name);
+ std::vector<ResultEntryType> Results =
+ Globals.findRecordsByName(Name, SymRecords);
+ if (Results.empty()) {
+ AutoIndent Indent(P);
+ P.printLine("(no matching records found)");
+ continue;
+ }
+
+ for (ResultEntryType Result : Results) {
+ if (auto E = Visitor.visitSymbolRecord(Result.second, Result.first))
+ return E;
+ }
+ }
+ }
return Error::success();
}
@@ -1676,7 +1708,10 @@ Error DumpOutputStyle::dumpSymbolsFromGSI(const GSIHashTable &Table,
// Return early if we aren't dumping public hash table and address map info.
if (HashExtras) {
- P.formatBinary("Hash Bitmap", Table.HashBitmap, 0);
+ ArrayRef<uint8_t> BitmapBytes(
+ reinterpret_cast<const uint8_t *>(Table.HashBitmap.data()),
+ Table.HashBitmap.size() * sizeof(uint32_t));
+ P.formatBinary("Hash Bitmap", BitmapBytes, 0);
P.formatLine("Hash Entries");
{
OpenPOWER on IntegriCloud