diff options
author | Zachary Turner <zturner@google.com> | 2017-08-21 14:53:25 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-08-21 14:53:25 +0000 |
commit | d1de2f4f5e965d70053b0c0d20d99ad4a105f428 (patch) | |
tree | ee90fa721e95e1dfc93217e26d8eeaec8ab1f0a0 /llvm/tools/llvm-pdbutil/Diff.cpp | |
parent | 48c67c99651d431ec03edc2bdf11abdd24089d2c (diff) | |
download | bcm5719-llvm-d1de2f4f5e965d70053b0c0d20d99ad4a105f428.tar.gz bcm5719-llvm-d1de2f4f5e965d70053b0c0d20d99ad4a105f428.zip |
[llvm-pdbutil] Add support for dumping detailed module stats.
This adds support for dumping a summary of module symbols
and CodeView debug chunks. This option prints a table for
each module of all of the symbols that occurred in the module
and the number of times it occurred and total byte size. Then
at the end it prints the totals for the entire file.
Additionally, this patch adds the -jmc (just my code) option,
which suppresses modules which are from external libraries or
linker imports, so that you can focus only on the object files
and libraries that originate from your own source code.
llvm-svn: 311338
Diffstat (limited to 'llvm/tools/llvm-pdbutil/Diff.cpp')
-rw-r--r-- | llvm/tools/llvm-pdbutil/Diff.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/llvm/tools/llvm-pdbutil/Diff.cpp b/llvm/tools/llvm-pdbutil/Diff.cpp index fb52545df0f..bd070499a5b 100644 --- a/llvm/tools/llvm-pdbutil/Diff.cpp +++ b/llvm/tools/llvm-pdbutil/Diff.cpp @@ -135,29 +135,28 @@ struct BinaryPathProvider { struct StreamPurposeProvider { explicit StreamPurposeProvider(uint32_t MaxLen) : MaxLen(MaxLen) {} - DiffResult compare(const std::pair<StreamPurpose, std::string> &L, - const std::pair<StreamPurpose, std::string> &R) { - if (L.first != R.first) + DiffResult compare(const StreamInfo &L, const StreamInfo &R) { + if (L.getPurpose() != R.getPurpose()) return DiffResult::DIFFERENT; - if (L.first == StreamPurpose::ModuleStream) { + if (L.getPurpose() == StreamPurpose::ModuleStream) { BinaryPathProvider PathProvider(MaxLen); - return PathProvider.compare(L.second, R.second); + return PathProvider.compare(L.getShortName(), R.getShortName()); } - return (L.second == R.second) ? DiffResult::IDENTICAL - : DiffResult::DIFFERENT; + return (L.getShortName() == R.getShortName()) ? DiffResult::IDENTICAL + : DiffResult::DIFFERENT; } - std::string format(const std::pair<StreamPurpose, std::string> &P, - bool Right) { - if (P.first == StreamPurpose::Other) - return truncateStringBack(P.second, MaxLen); - if (P.first == StreamPurpose::NamedStream) - return truncateQuotedNameBack("Named Stream", P.second, MaxLen); + std::string format(const StreamInfo &P, bool Right) { + if (P.getPurpose() == StreamPurpose::Other || + P.getPurpose() == StreamPurpose::Symbols) + return truncateStringBack(P.getShortName(), MaxLen); + if (P.getPurpose() == StreamPurpose::NamedStream) + return truncateQuotedNameBack("Named Stream", P.getShortName(), MaxLen); - assert(P.first == StreamPurpose::ModuleStream); + assert(P.getPurpose() == StreamPurpose::ModuleStream); uint32_t ExtraChars = strlen("Module \"\""); BinaryPathProvider PathProvider(MaxLen - ExtraChars); - std::string Result = PathProvider.format(P.second, Right); + std::string Result = PathProvider.format(P.getShortName(), Right); return formatv("Module \"{0}\"", Result); } @@ -256,8 +255,8 @@ Error DiffStyle::diffStreamDirectory() { truncateStringFront(File1.getFilePath(), 18), truncateStringFront(File2.getFilePath(), 18)); - SmallVector<std::pair<StreamPurpose, std::string>, 32> P; - SmallVector<std::pair<StreamPurpose, std::string>, 32> Q; + SmallVector<StreamInfo, 32> P; + SmallVector<StreamInfo, 32> Q; discoverStreamPurposes(File1, P); discoverStreamPurposes(File2, Q); D.print("Stream Count", File1.getNumStreams(), File2.getNumStreams()); @@ -486,10 +485,10 @@ static void diffOneModule(DiffPrinter &D, const IndexedModuleDescriptor &Item, IndexedModuleDescriptorList &Other, bool ItemIsRight) { StreamPurposeProvider HeaderProvider(70); - std::pair<StreamPurpose, std::string> Header; - Header.first = StreamPurpose::ModuleStream; - Header.second = Item.second.getModuleName(); - D.printFullRow(HeaderProvider.format(Header, ItemIsRight)); + StreamInfo Info = StreamInfo::createModuleStream( + Item.second.getModuleName(), Item.second.getModuleStreamIndex(), + Item.first); + D.printFullRow(HeaderProvider.format(Info, ItemIsRight)); const auto *L = &Item; |