summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-09-07 23:21:33 +0000
committerZachary Turner <zturner@google.com>2018-09-07 23:21:33 +0000
commitda4b63ab9afede44bb063adf26d5e9e5f14818c2 (patch)
tree161b138a94040692344529a1273b55928b8e4975 /llvm/tools
parent28655081a476d8808e9e2c0900d4ca87fb17abe3 (diff)
downloadbcm5719-llvm-da4b63ab9afede44bb063adf26d5e9e5f14818c2.tar.gz
bcm5719-llvm-da4b63ab9afede44bb063adf26d5e9e5f14818c2.zip
[PDB] Support pointer types in the native reader.
In order to start testing this, I've added a new mode to llvm-pdbutil which is only really useful for writing tests. It just dumps the value of raw fields in record format. This isn't really ideal and it won't allow us to test some important cases, but it's better than nothing for now. llvm-svn: 341729
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index bd77ee05e8c..0a4fb49284d 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -101,6 +101,9 @@ namespace opts {
cl::SubCommand DumpSubcommand("dump", "Dump MSF and CodeView debug info");
cl::SubCommand BytesSubcommand("bytes", "Dump raw bytes from the PDB file");
+cl::SubCommand DiaDumpSubcommand("diadump",
+ "Dump debug information using a DIA-like API");
+
cl::SubCommand
PrettySubcommand("pretty",
"Dump semantic information about types and symbols");
@@ -154,6 +157,23 @@ cl::ValuesClass ChunkValues = cl::values(
"Any subsection not covered by another option"),
clEnumValN(ModuleSubsection::All, "all", "All known subsections"));
+namespace diadump {
+cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore, cl::sub(DiaDumpSubcommand));
+
+cl::opt<bool> Native("native", cl::desc("Use native PDB reader instead of DIA"),
+ cl::sub(DiaDumpSubcommand));
+
+static cl::opt<bool> Enums("enums", cl::desc("Dump enum types"),
+ cl::sub(DiaDumpSubcommand));
+static cl::opt<bool> Pointers("pointers", cl::desc("Dump enum types"),
+ cl::sub(DiaDumpSubcommand));
+static cl::opt<bool> Compilands("compilands",
+ cl::desc("Dump compiland information"),
+ cl::sub(DiaDumpSubcommand));
+} // namespace diadump
+
namespace pretty {
cl::list<std::string> InputFilenames(cl::Positional,
cl::desc("<input PDB files>"),
@@ -923,6 +943,34 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) {
}
}
+static void dumpDia(StringRef Path) {
+ std::unique_ptr<IPDBSession> Session;
+
+ const auto ReaderType =
+ opts::diadump::Native ? PDB_ReaderType::Native : PDB_ReaderType::DIA;
+ ExitOnErr(loadDataForPDB(ReaderType, Path, Session));
+
+ auto GlobalScope = Session->getGlobalScope();
+
+ std::vector<PDB_SymType> SymTypes;
+
+ if (opts::diadump::Compilands)
+ SymTypes.push_back(PDB_SymType::Compiland);
+ if (opts::diadump::Enums)
+ SymTypes.push_back(PDB_SymType::Enum);
+ if (opts::diadump::Pointers)
+ SymTypes.push_back(PDB_SymType::PointerType);
+
+ for (PDB_SymType ST : SymTypes) {
+ auto Children = GlobalScope->findAllChildren(ST);
+ while (auto Child = Children->getNext()) {
+ outs() << "{";
+ Child->defaultDump(outs(), 2);
+ outs() << "\n}\n";
+ }
+ }
+}
+
static void dumpPretty(StringRef Path) {
std::unique_ptr<IPDBSession> Session;
@@ -1385,6 +1433,8 @@ int main(int Argc, const char **Argv) {
yamlToPdb(opts::yaml2pdb::InputFilename);
} else if (opts::AnalyzeSubcommand) {
dumpAnalysis(opts::analyze::InputFilename.front());
+ } else if (opts::DiaDumpSubcommand) {
+ llvm::for_each(opts::diadump::InputFilenames, dumpDia);
} else if (opts::PrettySubcommand) {
if (opts::pretty::Lines)
opts::pretty::Compilands = true;
OpenPOWER on IntegriCloud