diff options
| author | Zachary Turner <zturner@google.com> | 2016-06-02 20:11:22 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-06-02 20:11:22 +0000 |
| commit | 7eb6d358afb1461990939b9b364e86f9b1c41eaf (patch) | |
| tree | 0242b917eef3693fa9c68c7ba1f59ec53b72b27a /llvm/tools | |
| parent | 43578ec2a853b5dc98d63d3fd4c42cd1083ff909 (diff) | |
| download | bcm5719-llvm-7eb6d358afb1461990939b9b364e86f9b1c41eaf.tar.gz bcm5719-llvm-7eb6d358afb1461990939b9b364e86f9b1c41eaf.zip | |
[llvm-pdbdump] Dump CodeView line information.
This first pass only splits apart the records and dumps the line
info kinds and binary data. Subsequent patches will parse out
the binary data into more useful information and dump it in
detail.
llvm-svn: 271576
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp index b295876da39..0e7003d0f53 100644 --- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp +++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -144,6 +144,9 @@ cl::opt<bool> DumpPublics("raw-publics", cl::desc("dump Publics stream data"), cl::opt<bool> DumpSectionContribs("raw-section-contribs", cl::desc("dump section contributions"), cl::cat(NativeOptions)); +cl::opt<bool> DumpLineInfo("raw-line-info", + cl::desc("dump file and line information"), + cl::cat(NativeOptions)); cl::opt<bool> DumpSectionMap("raw-section-map", cl::desc("dump section map"), cl::cat(NativeOptions)); cl::opt<bool> @@ -429,8 +432,8 @@ static Error dumpNamedStream(ScopedPrinter &P, PDBFile &File) { static Error dumpDbiStream(ScopedPrinter &P, PDBFile &File, codeview::CVTypeDumper &TD) { - bool DumpModules = - opts::DumpModules || opts::DumpModuleSyms || opts::DumpModuleFiles; + bool DumpModules = opts::DumpModules || opts::DumpModuleSyms || + opts::DumpModuleFiles || opts::DumpLineInfo; if (!opts::DumpHeaders && !DumpModules) return Error::success(); @@ -487,25 +490,45 @@ static Error dumpDbiStream(ScopedPrinter &P, PDBFile &File, (Modi.Info.getModuleStreamIndex() < File.getNumStreams()); bool ShouldDumpSymbols = (opts::DumpModuleSyms || opts::DumpSymRecordBytes); - if (HasModuleDI && ShouldDumpSymbols) { - ListScope SS(P, "Symbols"); + if (HasModuleDI && (ShouldDumpSymbols || opts::DumpLineInfo)) { ModStream ModS(File, Modi.Info); if (auto EC = ModS.reload()) return EC; - codeview::CVSymbolDumper SD(P, TD, nullptr, false); - bool HadError = false; - for (auto &S : ModS.symbols(&HadError)) { - DictScope DD(P, ""); - - if (opts::DumpModuleSyms) - SD.dump(S); - if (opts::DumpSymRecordBytes) - P.printBinaryBlock("Bytes", S.Data); + if (ShouldDumpSymbols) { + ListScope SS(P, "Symbols"); + codeview::CVSymbolDumper SD(P, TD, nullptr, false); + bool HadError = false; + for (auto &S : ModS.symbols(&HadError)) { + DictScope DD(P, ""); + + if (opts::DumpModuleSyms) + SD.dump(S); + if (opts::DumpSymRecordBytes) + P.printBinaryBlock("Bytes", S.Data); + } + if (HadError) + return make_error<RawError>( + raw_error_code::corrupt_file, + "DBI stream contained corrupt symbol record"); + } + if (opts::DumpLineInfo) { + ListScope SS(P, "LineInfo"); + bool HadError = false; + for (auto &L : ModS.lines(&HadError)) { + DictScope DD(P, ""); + P.printEnum("Kind", uint32_t(L.getSubstreamKind()), + codeview::getModuleSubstreamKindNames()); + ArrayRef<uint8_t> Data; + codeview::StreamReader R(L.getRecordData()); + if (auto EC = R.readBytes(Data, R.bytesRemaining())) { + return make_error<RawError>( + raw_error_code::corrupt_file, + "DBI stream contained corrupt line info record"); + } + P.printBinaryBlock("Data", Data); + } } - if (HadError) - return make_error<RawError>(raw_error_code::corrupt_file, - "DBI stream contained corrupt record"); } } } @@ -805,6 +828,8 @@ bool isRawDumpEnabled() { return true; if (opts::DumpSectionMap) return true; + if (opts::DumpLineInfo) + return true; return false; } @@ -972,6 +997,7 @@ int main(int argc_, const char *argv_[]) { opts::DumpIpiRecords = true; opts::DumpSectionMap = true; opts::DumpSectionContribs = true; + opts::DumpLineInfo = true; } // When adding filters for excluded compilands and types, we need to remember |

