Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 1 | //===- LLVMOutputStyle.cpp ------------------------------------ *- C++ --*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "LLVMOutputStyle.h" |
| 11 | |
| 12 | #include "llvm-pdbdump.h" |
| 13 | #include "llvm/DebugInfo/CodeView/EnumTables.h" |
| 14 | #include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h" |
| 15 | #include "llvm/DebugInfo/CodeView/SymbolDumper.h" |
Zachary Turner | a3225b0 | 2016-07-29 20:56:36 +0000 | [diff] [blame] | 16 | #include "llvm/DebugInfo/MSF/MappedBlockStream.h" |
| 17 | #include "llvm/DebugInfo/MSF/StreamReader.h" |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 18 | #include "llvm/DebugInfo/PDB/PDBExtras.h" |
| 19 | #include "llvm/DebugInfo/PDB/Raw/DbiStream.h" |
| 20 | #include "llvm/DebugInfo/PDB/Raw/EnumTables.h" |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 21 | #include "llvm/DebugInfo/PDB/Raw/GlobalsStream.h" |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 22 | #include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h" |
| 23 | #include "llvm/DebugInfo/PDB/Raw/InfoStream.h" |
| 24 | #include "llvm/DebugInfo/PDB/Raw/ModInfo.h" |
| 25 | #include "llvm/DebugInfo/PDB/Raw/ModStream.h" |
| 26 | #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" |
| 27 | #include "llvm/DebugInfo/PDB/Raw/PublicsStream.h" |
| 28 | #include "llvm/DebugInfo/PDB/Raw/RawError.h" |
| 29 | #include "llvm/DebugInfo/PDB/Raw/TpiStream.h" |
| 30 | #include "llvm/Object/COFF.h" |
| 31 | |
| 32 | #include <unordered_map> |
| 33 | |
| 34 | using namespace llvm; |
| 35 | using namespace llvm::codeview; |
Zachary Turner | bac69d3 | 2016-07-22 19:56:05 +0000 | [diff] [blame] | 36 | using namespace llvm::msf; |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 37 | using namespace llvm::pdb; |
| 38 | |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 39 | namespace { |
| 40 | struct PageStats { |
| 41 | explicit PageStats(const BitVector &FreePages) |
| 42 | : Upm(FreePages), ActualUsedPages(FreePages.size()), |
| 43 | MultiUsePages(FreePages.size()), UseAfterFreePages(FreePages.size()) { |
| 44 | const_cast<BitVector &>(Upm).flip(); |
| 45 | // To calculate orphaned pages, we start with the set of pages that the |
| 46 | // MSF thinks are used. Each time we find one that actually *is* used, |
| 47 | // we unset it. Whichever bits remain set at the end are orphaned. |
| 48 | OrphanedPages = Upm; |
| 49 | } |
| 50 | |
| 51 | // The inverse of the MSF File's copy of the Fpm. The basis for which we |
| 52 | // determine the allocation status of each page. |
| 53 | const BitVector Upm; |
| 54 | |
| 55 | // Pages which are marked as used in the FPM and are used at least once. |
| 56 | BitVector ActualUsedPages; |
| 57 | |
| 58 | // Pages which are marked as used in the FPM but are used more than once. |
| 59 | BitVector MultiUsePages; |
| 60 | |
| 61 | // Pages which are marked as used in the FPM but are not used at all. |
| 62 | BitVector OrphanedPages; |
| 63 | |
| 64 | // Pages which are marked free in the FPM but are used. |
| 65 | BitVector UseAfterFreePages; |
| 66 | }; |
| 67 | } |
| 68 | |
| 69 | static void recordKnownUsedPage(PageStats &Stats, uint32_t UsedIndex) { |
| 70 | if (Stats.Upm.test(UsedIndex)) { |
| 71 | if (Stats.ActualUsedPages.test(UsedIndex)) |
| 72 | Stats.MultiUsePages.set(UsedIndex); |
| 73 | Stats.ActualUsedPages.set(UsedIndex); |
| 74 | Stats.OrphanedPages.reset(UsedIndex); |
| 75 | } else { |
| 76 | // The MSF doesn't think this page is used, but it is. |
| 77 | Stats.UseAfterFreePages.set(UsedIndex); |
| 78 | } |
| 79 | } |
| 80 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 81 | static void printSectionOffset(llvm::raw_ostream &OS, |
| 82 | const SectionOffset &Off) { |
| 83 | OS << Off.Off << ", " << Off.Isect; |
| 84 | } |
| 85 | |
| 86 | LLVMOutputStyle::LLVMOutputStyle(PDBFile &File) |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 87 | : File(File), P(outs()), Dumper(&P, false) {} |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 88 | |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 89 | Error LLVMOutputStyle::dump() { |
| 90 | if (auto EC = dumpFileHeaders()) |
| 91 | return EC; |
| 92 | |
| 93 | if (auto EC = dumpStreamSummary()) |
| 94 | return EC; |
| 95 | |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 96 | if (auto EC = dumpFreePageMap()) |
| 97 | return EC; |
| 98 | |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 99 | if (auto EC = dumpStreamBlocks()) |
| 100 | return EC; |
| 101 | |
Zachary Turner | 72c5b64 | 2016-09-09 18:17:52 +0000 | [diff] [blame] | 102 | if (auto EC = dumpBlockRanges()) |
| 103 | return EC; |
| 104 | |
| 105 | if (auto EC = dumpStreamBytes()) |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 106 | return EC; |
| 107 | |
| 108 | if (auto EC = dumpInfoStream()) |
| 109 | return EC; |
| 110 | |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 111 | if (auto EC = dumpTpiStream(StreamTPI)) |
| 112 | return EC; |
| 113 | |
| 114 | if (auto EC = dumpTpiStream(StreamIPI)) |
| 115 | return EC; |
| 116 | |
| 117 | if (auto EC = dumpDbiStream()) |
| 118 | return EC; |
| 119 | |
| 120 | if (auto EC = dumpSectionContribs()) |
| 121 | return EC; |
| 122 | |
| 123 | if (auto EC = dumpSectionMap()) |
| 124 | return EC; |
| 125 | |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 126 | if (auto EC = dumpGlobalsStream()) |
| 127 | return EC; |
| 128 | |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 129 | if (auto EC = dumpPublicsStream()) |
| 130 | return EC; |
| 131 | |
| 132 | if (auto EC = dumpSectionHeaders()) |
| 133 | return EC; |
| 134 | |
| 135 | if (auto EC = dumpFpoStream()) |
| 136 | return EC; |
| 137 | |
| 138 | flush(); |
| 139 | |
| 140 | return Error::success(); |
| 141 | } |
| 142 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 143 | Error LLVMOutputStyle::dumpFileHeaders() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 144 | if (!opts::raw::DumpHeaders) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 145 | return Error::success(); |
| 146 | |
| 147 | DictScope D(P, "FileHeaders"); |
| 148 | P.printNumber("BlockSize", File.getBlockSize()); |
Zachary Turner | b927e02 | 2016-07-15 22:17:19 +0000 | [diff] [blame] | 149 | P.printNumber("FreeBlockMap", File.getFreeBlockMapBlock()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 150 | P.printNumber("NumBlocks", File.getBlockCount()); |
| 151 | P.printNumber("NumDirectoryBytes", File.getNumDirectoryBytes()); |
| 152 | P.printNumber("Unknown1", File.getUnknown1()); |
| 153 | P.printNumber("BlockMapAddr", File.getBlockMapIndex()); |
| 154 | P.printNumber("NumDirectoryBlocks", File.getNumDirectoryBlocks()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 155 | |
| 156 | // The directory is not contiguous. Instead, the block map contains a |
| 157 | // contiguous list of block numbers whose contents, when concatenated in |
| 158 | // order, make up the directory. |
| 159 | P.printList("DirectoryBlocks", File.getDirectoryBlockArray()); |
| 160 | P.printNumber("NumStreams", File.getNumStreams()); |
| 161 | return Error::success(); |
| 162 | } |
| 163 | |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 164 | void LLVMOutputStyle::discoverStreamPurposes() { |
| 165 | if (!StreamPurposes.empty()) |
| 166 | return; |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 167 | |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 168 | // It's OK if we fail to load some of these streams, we still attempt to print |
| 169 | // what we can. |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 170 | auto Dbi = File.getPDBDbiStream(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 171 | auto Tpi = File.getPDBTpiStream(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 172 | auto Ipi = File.getPDBIpiStream(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 173 | auto Info = File.getPDBInfoStream(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 174 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 175 | uint32_t StreamCount = File.getNumStreams(); |
| 176 | std::unordered_map<uint16_t, const ModuleInfoEx *> ModStreams; |
| 177 | std::unordered_map<uint16_t, std::string> NamedStreams; |
| 178 | |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 179 | if (Dbi) { |
| 180 | for (auto &ModI : Dbi->modules()) { |
| 181 | uint16_t SN = ModI.Info.getModuleStreamIndex(); |
| 182 | ModStreams[SN] = &ModI; |
| 183 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 184 | } |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 185 | if (Info) { |
| 186 | for (auto &NSE : Info->named_streams()) { |
| 187 | NamedStreams[NSE.second] = NSE.first(); |
| 188 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 191 | StreamPurposes.resize(StreamCount); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 192 | for (uint16_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 193 | std::string Value; |
| 194 | if (StreamIdx == OldMSFDirectory) |
| 195 | Value = "Old MSF Directory"; |
| 196 | else if (StreamIdx == StreamPDB) |
| 197 | Value = "PDB Stream"; |
| 198 | else if (StreamIdx == StreamDBI) |
| 199 | Value = "DBI Stream"; |
| 200 | else if (StreamIdx == StreamTPI) |
| 201 | Value = "TPI Stream"; |
| 202 | else if (StreamIdx == StreamIPI) |
| 203 | Value = "IPI Stream"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 204 | else if (Dbi && StreamIdx == Dbi->getGlobalSymbolStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 205 | Value = "Global Symbol Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 206 | else if (Dbi && StreamIdx == Dbi->getPublicSymbolStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 207 | Value = "Public Symbol Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 208 | else if (Dbi && StreamIdx == Dbi->getSymRecordStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 209 | Value = "Public Symbol Records"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 210 | else if (Tpi && StreamIdx == Tpi->getTypeHashStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 211 | Value = "TPI Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 212 | else if (Tpi && StreamIdx == Tpi->getTypeHashStreamAuxIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 213 | Value = "TPI Aux Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 214 | else if (Ipi && StreamIdx == Ipi->getTypeHashStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 215 | Value = "IPI Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 216 | else if (Ipi && StreamIdx == Ipi->getTypeHashStreamAuxIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 217 | Value = "IPI Aux Hash"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 218 | else if (Dbi && |
| 219 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Exception)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 220 | Value = "Exception Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 221 | else if (Dbi && StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Fixup)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 222 | Value = "Fixup Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 223 | else if (Dbi && StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::FPO)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 224 | Value = "FPO Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 225 | else if (Dbi && |
| 226 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::NewFPO)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 227 | Value = "New FPO Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 228 | else if (Dbi && |
| 229 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::OmapFromSrc)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 230 | Value = "Omap From Source Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 231 | else if (Dbi && |
| 232 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::OmapToSrc)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 233 | Value = "Omap To Source Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 234 | else if (Dbi && StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Pdata)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 235 | Value = "Pdata"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 236 | else if (Dbi && |
| 237 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::SectionHdr)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 238 | Value = "Section Header Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 239 | else if (Dbi && |
| 240 | StreamIdx == |
| 241 | Dbi->getDebugStreamIndex(DbgHeaderType::SectionHdrOrig)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 242 | Value = "Section Header Original Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 243 | else if (Dbi && |
| 244 | StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::TokenRidMap)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 245 | Value = "Token Rid Data"; |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 246 | else if (Dbi && StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Xdata)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 247 | Value = "Xdata"; |
| 248 | else { |
| 249 | auto ModIter = ModStreams.find(StreamIdx); |
| 250 | auto NSIter = NamedStreams.find(StreamIdx); |
| 251 | if (ModIter != ModStreams.end()) { |
| 252 | Value = "Module \""; |
| 253 | Value += ModIter->second->Info.getModuleName().str(); |
| 254 | Value += "\""; |
| 255 | } else if (NSIter != NamedStreams.end()) { |
| 256 | Value = "Named Stream \""; |
| 257 | Value += NSIter->second; |
| 258 | Value += "\""; |
| 259 | } else { |
| 260 | Value = "???"; |
| 261 | } |
| 262 | } |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 263 | StreamPurposes[StreamIdx] = Value; |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 264 | } |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 265 | |
| 266 | // Consume errors from missing streams. |
| 267 | if (!Dbi) |
| 268 | consumeError(Dbi.takeError()); |
| 269 | if (!Tpi) |
| 270 | consumeError(Tpi.takeError()); |
| 271 | if (!Ipi) |
| 272 | consumeError(Ipi.takeError()); |
| 273 | if (!Info) |
| 274 | consumeError(Info.takeError()); |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | Error LLVMOutputStyle::dumpStreamSummary() { |
| 278 | if (!opts::raw::DumpStreamSummary) |
| 279 | return Error::success(); |
| 280 | |
| 281 | discoverStreamPurposes(); |
| 282 | |
| 283 | uint32_t StreamCount = File.getNumStreams(); |
| 284 | |
| 285 | ListScope L(P, "Streams"); |
| 286 | for (uint16_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { |
| 287 | std::string Label("Stream "); |
| 288 | Label += to_string(StreamIdx); |
| 289 | |
| 290 | std::string Value = "[" + StreamPurposes[StreamIdx] + "] ("; |
| 291 | Value += to_string(File.getStreamByteSize(StreamIdx)); |
| 292 | Value += " bytes)"; |
| 293 | |
| 294 | P.printString(Label, Value); |
| 295 | } |
Reid Kleckner | 11582c5 | 2016-06-17 20:38:01 +0000 | [diff] [blame] | 296 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 297 | P.flush(); |
| 298 | return Error::success(); |
| 299 | } |
| 300 | |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 301 | Error LLVMOutputStyle::dumpFreePageMap() { |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 302 | if (!opts::raw::DumpPageStats) |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 303 | return Error::success(); |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 304 | |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 305 | // Start with used pages instead of free pages because |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 306 | // the number of free pages is far larger than used pages. |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 307 | BitVector FPM = File.getMsfLayout().FreePageMap; |
| 308 | |
| 309 | PageStats PS(FPM); |
| 310 | |
| 311 | recordKnownUsedPage(PS, 0); // MSF Super Block |
| 312 | |
Zachary Turner | 8cf51c3 | 2016-08-03 16:53:21 +0000 | [diff] [blame] | 313 | uint32_t BlocksPerSection = msf::getFpmIntervalLength(File.getMsfLayout()); |
| 314 | uint32_t NumSections = msf::getNumFpmIntervals(File.getMsfLayout()); |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 315 | for (uint32_t I = 0; I < NumSections; ++I) { |
| 316 | uint32_t Fpm0 = 1 + BlocksPerSection * I; |
| 317 | // 2 Fpm blocks spaced at `getBlockSize()` block intervals |
| 318 | recordKnownUsedPage(PS, Fpm0); |
| 319 | recordKnownUsedPage(PS, Fpm0 + 1); |
| 320 | } |
| 321 | |
| 322 | recordKnownUsedPage(PS, File.getBlockMapIndex()); // Stream Table |
| 323 | |
Rui Ueyama | 22e6738 | 2016-08-02 23:22:46 +0000 | [diff] [blame] | 324 | for (auto DB : File.getDirectoryBlockArray()) |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 325 | recordKnownUsedPage(PS, DB); |
Rui Ueyama | 22e6738 | 2016-08-02 23:22:46 +0000 | [diff] [blame] | 326 | |
| 327 | // Record pages used by streams. Note that pages for stream 0 |
| 328 | // are considered being unused because that's what MSVC tools do. |
| 329 | // Stream 0 doesn't contain actual data, so it makes some sense, |
| 330 | // though it's a bit confusing to us. |
| 331 | for (auto &SE : File.getStreamMap().drop_front(1)) |
| 332 | for (auto &S : SE) |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 333 | recordKnownUsedPage(PS, S); |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 334 | |
| 335 | dumpBitVector("Msf Free Pages", FPM); |
| 336 | dumpBitVector("Orphaned Pages", PS.OrphanedPages); |
| 337 | dumpBitVector("Multiply Used Pages", PS.MultiUsePages); |
| 338 | dumpBitVector("Use After Free Pages", PS.UseAfterFreePages); |
Rui Ueyama | 7a5cdc6 | 2016-07-29 21:38:00 +0000 | [diff] [blame] | 339 | return Error::success(); |
| 340 | } |
| 341 | |
Zachary Turner | d3c7b8e | 2016-08-01 21:19:45 +0000 | [diff] [blame] | 342 | void LLVMOutputStyle::dumpBitVector(StringRef Name, const BitVector &V) { |
| 343 | std::vector<uint32_t> Vec; |
| 344 | for (uint32_t I = 0, E = V.size(); I != E; ++I) |
| 345 | if (V[I]) |
| 346 | Vec.push_back(I); |
| 347 | P.printList(Name, Vec); |
| 348 | } |
| 349 | |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 350 | Error LLVMOutputStyle::dumpGlobalsStream() { |
| 351 | if (!opts::raw::DumpGlobals) |
| 352 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 353 | if (!File.hasPDBGlobalsStream()) { |
| 354 | P.printString("Globals Stream not present"); |
| 355 | return Error::success(); |
| 356 | } |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 357 | |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 358 | auto Globals = File.getPDBGlobalsStream(); |
| 359 | if (!Globals) |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 360 | return handleErrors(Globals.takeError(), |
| 361 | [&](const msf::MSFError &E) -> Error { |
| 362 | if (E.Code == msf::msf_error_code::no_stream) { |
| 363 | P.printString("Globals Stream not present"); |
| 364 | return Error::success(); |
| 365 | } else { |
| 366 | return make_error<msf::MSFError>(E); |
| 367 | } |
| 368 | }); |
| 369 | DictScope D(P, "Globals Stream"); |
Bob Haarman | 653baa2 | 2016-10-21 19:43:19 +0000 | [diff] [blame] | 370 | |
| 371 | auto Dbi = File.getPDBDbiStream(); |
| 372 | if (!Dbi) |
| 373 | return Dbi.takeError(); |
| 374 | |
| 375 | P.printNumber("Stream number", Dbi->getGlobalSymbolStreamIndex()); |
| 376 | P.printNumber("Number of buckets", Globals->getNumBuckets()); |
| 377 | P.printList("Hash Buckets", Globals->getHashBuckets()); |
| 378 | |
| 379 | return Error::success(); |
| 380 | } |
| 381 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 382 | Error LLVMOutputStyle::dumpStreamBlocks() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 383 | if (!opts::raw::DumpStreamBlocks) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 384 | return Error::success(); |
| 385 | |
| 386 | ListScope L(P, "StreamBlocks"); |
| 387 | uint32_t StreamCount = File.getNumStreams(); |
| 388 | for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { |
| 389 | std::string Name("Stream "); |
| 390 | Name += to_string(StreamIdx); |
| 391 | auto StreamBlocks = File.getStreamBlockList(StreamIdx); |
| 392 | P.printList(Name, StreamBlocks); |
| 393 | } |
| 394 | return Error::success(); |
| 395 | } |
| 396 | |
Zachary Turner | 72c5b64 | 2016-09-09 18:17:52 +0000 | [diff] [blame] | 397 | Error LLVMOutputStyle::dumpBlockRanges() { |
| 398 | if (!opts::raw::DumpBlockRange.hasValue()) |
| 399 | return Error::success(); |
| 400 | auto &R = *opts::raw::DumpBlockRange; |
| 401 | uint32_t Max = R.Max.getValueOr(R.Min); |
| 402 | |
| 403 | if (Max < R.Min) |
| 404 | return make_error<StringError>( |
| 405 | "Invalid block range specified. Max < Min", |
| 406 | std::make_error_code(std::errc::bad_address)); |
| 407 | if (Max >= File.getBlockCount()) |
| 408 | return make_error<StringError>( |
| 409 | "Invalid block range specified. Requested block out of bounds", |
| 410 | std::make_error_code(std::errc::bad_address)); |
| 411 | |
| 412 | DictScope D(P, "Block Data"); |
| 413 | for (uint32_t I = R.Min; I <= Max; ++I) { |
| 414 | auto ExpectedData = File.getBlockData(I, File.getBlockSize()); |
| 415 | if (!ExpectedData) |
| 416 | return ExpectedData.takeError(); |
| 417 | std::string Label; |
| 418 | llvm::raw_string_ostream S(Label); |
| 419 | S << "Block " << I; |
| 420 | S.flush(); |
| 421 | P.printBinaryBlock(Label, *ExpectedData); |
| 422 | } |
| 423 | |
| 424 | return Error::success(); |
| 425 | } |
| 426 | |
| 427 | Error LLVMOutputStyle::dumpStreamBytes() { |
| 428 | if (opts::raw::DumpStreamData.empty()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 429 | return Error::success(); |
| 430 | |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 431 | discoverStreamPurposes(); |
| 432 | |
Zachary Turner | 72c5b64 | 2016-09-09 18:17:52 +0000 | [diff] [blame] | 433 | DictScope D(P, "Stream Data"); |
| 434 | for (uint32_t SI : opts::raw::DumpStreamData) { |
| 435 | if (SI >= File.getNumStreams()) |
| 436 | return make_error<RawError>(raw_error_code::no_stream); |
Zachary Turner | d2b2bfe | 2016-06-08 00:25:08 +0000 | [diff] [blame] | 437 | |
Zachary Turner | 72c5b64 | 2016-09-09 18:17:52 +0000 | [diff] [blame] | 438 | auto S = MappedBlockStream::createIndexedStream(File.getMsfLayout(), |
| 439 | File.getMsfBuffer(), SI); |
| 440 | if (!S) |
| 441 | continue; |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 442 | DictScope DD(P, "Stream"); |
| 443 | |
| 444 | P.printNumber("Index", SI); |
| 445 | P.printString("Type", StreamPurposes[SI]); |
| 446 | P.printNumber("Size", S->getLength()); |
| 447 | auto Blocks = File.getMsfLayout().StreamMap[SI]; |
| 448 | P.printList("Blocks", Blocks); |
| 449 | |
Zachary Turner | 72c5b64 | 2016-09-09 18:17:52 +0000 | [diff] [blame] | 450 | StreamReader R(*S); |
| 451 | ArrayRef<uint8_t> StreamData; |
| 452 | if (auto EC = R.readBytes(StreamData, S->getLength())) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 453 | return EC; |
Zachary Turner | 36efbfa | 2016-09-09 19:00:49 +0000 | [diff] [blame] | 454 | P.printBinaryBlock("Data", StreamData); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 455 | } |
| 456 | return Error::success(); |
| 457 | } |
| 458 | |
| 459 | Error LLVMOutputStyle::dumpInfoStream() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 460 | if (!opts::raw::DumpHeaders) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 461 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 462 | if (!File.hasPDBInfoStream()) { |
| 463 | P.printString("PDB Stream not present"); |
| 464 | return Error::success(); |
| 465 | } |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 466 | auto IS = File.getPDBInfoStream(); |
| 467 | if (!IS) |
| 468 | return IS.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 469 | |
| 470 | DictScope D(P, "PDB Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 471 | P.printNumber("Version", IS->getVersion()); |
| 472 | P.printHex("Signature", IS->getSignature()); |
| 473 | P.printNumber("Age", IS->getAge()); |
| 474 | P.printObject("Guid", IS->getGuid()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 475 | return Error::success(); |
| 476 | } |
| 477 | |
Rui Ueyama | fd97bf1 | 2016-06-03 20:48:51 +0000 | [diff] [blame] | 478 | static void printTypeIndexOffset(raw_ostream &OS, |
| 479 | const TypeIndexOffset &TIOff) { |
| 480 | OS << "{" << TIOff.Type.getIndex() << ", " << TIOff.Offset << "}"; |
| 481 | } |
| 482 | |
| 483 | static void dumpTpiHash(ScopedPrinter &P, TpiStream &Tpi) { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 484 | if (!opts::raw::DumpTpiHash) |
Rui Ueyama | fd97bf1 | 2016-06-03 20:48:51 +0000 | [diff] [blame] | 485 | return; |
| 486 | DictScope DD(P, "Hash"); |
Rui Ueyama | f14a74c | 2016-06-07 23:53:43 +0000 | [diff] [blame] | 487 | P.printNumber("Number of Hash Buckets", Tpi.NumHashBuckets()); |
Rui Ueyama | d833917 | 2016-06-07 23:44:27 +0000 | [diff] [blame] | 488 | P.printNumber("Hash Key Size", Tpi.getHashKeySize()); |
Rui Ueyama | fd97bf1 | 2016-06-03 20:48:51 +0000 | [diff] [blame] | 489 | P.printList("Values", Tpi.getHashValues()); |
| 490 | P.printList("Type Index Offsets", Tpi.getTypeIndexOffsets(), |
| 491 | printTypeIndexOffset); |
| 492 | P.printList("Hash Adjustments", Tpi.getHashAdjustments(), |
| 493 | printTypeIndexOffset); |
| 494 | } |
| 495 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 496 | Error LLVMOutputStyle::dumpTpiStream(uint32_t StreamIdx) { |
| 497 | assert(StreamIdx == StreamTPI || StreamIdx == StreamIPI); |
| 498 | |
| 499 | bool DumpRecordBytes = false; |
| 500 | bool DumpRecords = false; |
| 501 | StringRef Label; |
| 502 | StringRef VerLabel; |
| 503 | if (StreamIdx == StreamTPI) { |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 504 | if (!File.hasPDBTpiStream()) { |
| 505 | P.printString("Type Info Stream (TPI) not present"); |
| 506 | return Error::success(); |
| 507 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 508 | DumpRecordBytes = opts::raw::DumpTpiRecordBytes; |
| 509 | DumpRecords = opts::raw::DumpTpiRecords; |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 510 | Label = "Type Info Stream (TPI)"; |
| 511 | VerLabel = "TPI Version"; |
| 512 | } else if (StreamIdx == StreamIPI) { |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 513 | if (!File.hasPDBIpiStream()) { |
| 514 | P.printString("Type Info Stream (IPI) not present"); |
| 515 | return Error::success(); |
| 516 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 517 | DumpRecordBytes = opts::raw::DumpIpiRecordBytes; |
| 518 | DumpRecords = opts::raw::DumpIpiRecords; |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 519 | Label = "Type Info Stream (IPI)"; |
| 520 | VerLabel = "IPI Version"; |
| 521 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 522 | if (!DumpRecordBytes && !DumpRecords && !opts::raw::DumpModuleSyms) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 523 | return Error::success(); |
| 524 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 525 | auto Tpi = (StreamIdx == StreamTPI) ? File.getPDBTpiStream() |
| 526 | : File.getPDBIpiStream(); |
| 527 | if (!Tpi) |
| 528 | return Tpi.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 529 | |
| 530 | if (DumpRecords || DumpRecordBytes) { |
| 531 | DictScope D(P, Label); |
| 532 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 533 | P.printNumber(VerLabel, Tpi->getTpiVersion()); |
| 534 | P.printNumber("Record count", Tpi->NumTypeRecords()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 535 | |
| 536 | ListScope L(P, "Records"); |
| 537 | |
| 538 | bool HadError = false; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 539 | for (auto &Type : Tpi->types(&HadError)) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 540 | DictScope DD(P, ""); |
| 541 | |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 542 | if (DumpRecords) { |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 543 | if (auto EC = Dumper.dump(Type)) |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 544 | return EC; |
| 545 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 546 | |
| 547 | if (DumpRecordBytes) |
Zachary Turner | c67b00c | 2016-09-14 23:00:16 +0000 | [diff] [blame] | 548 | P.printBinaryBlock("Bytes", Type.content()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 549 | } |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 550 | dumpTpiHash(P, *Tpi); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 551 | if (HadError) |
| 552 | return make_error<RawError>(raw_error_code::corrupt_file, |
| 553 | "TPI stream contained corrupt record"); |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 554 | } else if (opts::raw::DumpModuleSyms) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 555 | // Even if the user doesn't want to dump type records, we still need to |
| 556 | // iterate them in order to build the list of types so that we can print |
| 557 | // them when dumping module symbols. So when they want to dump symbols |
| 558 | // but not types, use a null output stream. |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 559 | ScopedPrinter *OldP = Dumper.getPrinter(); |
| 560 | Dumper.setPrinter(nullptr); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 561 | |
| 562 | bool HadError = false; |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 563 | for (auto &Type : Tpi->types(&HadError)) { |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 564 | if (auto EC = Dumper.dump(Type)) |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 565 | return EC; |
| 566 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 567 | |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 568 | Dumper.setPrinter(OldP); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 569 | dumpTpiHash(P, *Tpi); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 570 | if (HadError) |
| 571 | return make_error<RawError>(raw_error_code::corrupt_file, |
| 572 | "TPI stream contained corrupt record"); |
| 573 | } |
| 574 | P.flush(); |
| 575 | return Error::success(); |
| 576 | } |
| 577 | |
| 578 | Error LLVMOutputStyle::dumpDbiStream() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 579 | bool DumpModules = opts::raw::DumpModules || opts::raw::DumpModuleSyms || |
| 580 | opts::raw::DumpModuleFiles || opts::raw::DumpLineInfo; |
| 581 | if (!opts::raw::DumpHeaders && !DumpModules) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 582 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 583 | if (!File.hasPDBDbiStream()) { |
| 584 | P.printString("DBI Stream not present"); |
| 585 | return Error::success(); |
| 586 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 587 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 588 | auto DS = File.getPDBDbiStream(); |
| 589 | if (!DS) |
| 590 | return DS.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 591 | |
| 592 | DictScope D(P, "DBI Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 593 | P.printNumber("Dbi Version", DS->getDbiVersion()); |
| 594 | P.printNumber("Age", DS->getAge()); |
| 595 | P.printBoolean("Incremental Linking", DS->isIncrementallyLinked()); |
| 596 | P.printBoolean("Has CTypes", DS->hasCTypes()); |
| 597 | P.printBoolean("Is Stripped", DS->isStripped()); |
| 598 | P.printObject("Machine Type", DS->getMachineType()); |
| 599 | P.printNumber("Symbol Record Stream Index", DS->getSymRecordStreamIndex()); |
| 600 | P.printNumber("Public Symbol Stream Index", DS->getPublicSymbolStreamIndex()); |
| 601 | P.printNumber("Global Symbol Stream Index", DS->getGlobalSymbolStreamIndex()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 602 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 603 | uint16_t Major = DS->getBuildMajorVersion(); |
| 604 | uint16_t Minor = DS->getBuildMinorVersion(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 605 | P.printVersion("Toolchain Version", Major, Minor); |
| 606 | |
| 607 | std::string DllName; |
| 608 | raw_string_ostream DllStream(DllName); |
| 609 | DllStream << "mspdb" << Major << Minor << ".dll version"; |
| 610 | DllStream.flush(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 611 | P.printVersion(DllName, Major, Minor, DS->getPdbDllVersion()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 612 | |
| 613 | if (DumpModules) { |
| 614 | ListScope L(P, "Modules"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 615 | for (auto &Modi : DS->modules()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 616 | DictScope DD(P); |
| 617 | P.printString("Name", Modi.Info.getModuleName().str()); |
| 618 | P.printNumber("Debug Stream Index", Modi.Info.getModuleStreamIndex()); |
| 619 | P.printString("Object File Name", Modi.Info.getObjFileName().str()); |
| 620 | P.printNumber("Num Files", Modi.Info.getNumberOfFiles()); |
| 621 | P.printNumber("Source File Name Idx", Modi.Info.getSourceFileNameIndex()); |
| 622 | P.printNumber("Pdb File Name Idx", Modi.Info.getPdbFilePathNameIndex()); |
| 623 | P.printNumber("Line Info Byte Size", Modi.Info.getLineInfoByteSize()); |
| 624 | P.printNumber("C13 Line Info Byte Size", |
| 625 | Modi.Info.getC13LineInfoByteSize()); |
| 626 | P.printNumber("Symbol Byte Size", Modi.Info.getSymbolDebugInfoByteSize()); |
| 627 | P.printNumber("Type Server Index", Modi.Info.getTypeServerIndex()); |
| 628 | P.printBoolean("Has EC Info", Modi.Info.hasECInfo()); |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 629 | if (opts::raw::DumpModuleFiles) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 630 | std::string FileListName = |
| 631 | to_string(Modi.SourceFiles.size()) + " Contributing Source Files"; |
| 632 | ListScope LL(P, FileListName); |
| 633 | for (auto File : Modi.SourceFiles) |
| 634 | P.printString(File.str()); |
| 635 | } |
| 636 | bool HasModuleDI = |
| 637 | (Modi.Info.getModuleStreamIndex() < File.getNumStreams()); |
| 638 | bool ShouldDumpSymbols = |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 639 | (opts::raw::DumpModuleSyms || opts::raw::DumpSymRecordBytes); |
| 640 | if (HasModuleDI && (ShouldDumpSymbols || opts::raw::DumpLineInfo)) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 641 | auto ModStreamData = MappedBlockStream::createIndexedStream( |
Zachary Turner | d66889c | 2016-07-28 19:12:28 +0000 | [diff] [blame] | 642 | File.getMsfLayout(), File.getMsfBuffer(), |
| 643 | Modi.Info.getModuleStreamIndex()); |
| 644 | |
| 645 | ModStream ModS(Modi.Info, std::move(ModStreamData)); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 646 | if (auto EC = ModS.reload()) |
| 647 | return EC; |
| 648 | |
| 649 | if (ShouldDumpSymbols) { |
| 650 | ListScope SS(P, "Symbols"); |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 651 | codeview::CVSymbolDumper SD(P, Dumper, nullptr, false); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 652 | bool HadError = false; |
Zachary Turner | 0d84074 | 2016-10-07 21:34:46 +0000 | [diff] [blame] | 653 | for (auto S : ModS.symbols(&HadError)) { |
| 654 | DictScope LL(P, ""); |
| 655 | if (opts::raw::DumpModuleSyms) { |
| 656 | if (auto EC = SD.dump(S)) { |
| 657 | llvm::consumeError(std::move(EC)); |
| 658 | HadError = true; |
| 659 | break; |
| 660 | } |
| 661 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 662 | if (opts::raw::DumpSymRecordBytes) |
Zachary Turner | c67b00c | 2016-09-14 23:00:16 +0000 | [diff] [blame] | 663 | P.printBinaryBlock("Bytes", S.content()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 664 | } |
| 665 | if (HadError) |
| 666 | return make_error<RawError>( |
| 667 | raw_error_code::corrupt_file, |
| 668 | "DBI stream contained corrupt symbol record"); |
| 669 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 670 | if (opts::raw::DumpLineInfo) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 671 | ListScope SS(P, "LineInfo"); |
| 672 | bool HadError = false; |
| 673 | // Define a locally scoped visitor to print the different |
| 674 | // substream types types. |
| 675 | class RecordVisitor : public codeview::IModuleSubstreamVisitor { |
| 676 | public: |
| 677 | RecordVisitor(ScopedPrinter &P, PDBFile &F) : P(P), F(F) {} |
| 678 | Error visitUnknown(ModuleSubstreamKind Kind, |
Zachary Turner | d66889c | 2016-07-28 19:12:28 +0000 | [diff] [blame] | 679 | ReadableStreamRef Stream) override { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 680 | DictScope DD(P, "Unknown"); |
| 681 | ArrayRef<uint8_t> Data; |
| 682 | StreamReader R(Stream); |
| 683 | if (auto EC = R.readBytes(Data, R.bytesRemaining())) { |
| 684 | return make_error<RawError>( |
| 685 | raw_error_code::corrupt_file, |
| 686 | "DBI stream contained corrupt line info record"); |
| 687 | } |
| 688 | P.printBinaryBlock("Data", Data); |
| 689 | return Error::success(); |
| 690 | } |
| 691 | Error |
Zachary Turner | d66889c | 2016-07-28 19:12:28 +0000 | [diff] [blame] | 692 | visitFileChecksums(ReadableStreamRef Data, |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 693 | const FileChecksumArray &Checksums) override { |
| 694 | DictScope DD(P, "FileChecksums"); |
| 695 | for (const auto &C : Checksums) { |
| 696 | DictScope DDD(P, "Checksum"); |
| 697 | if (auto Result = getFileNameForOffset(C.FileNameOffset)) |
| 698 | P.printString("FileName", Result.get()); |
| 699 | else |
| 700 | return Result.takeError(); |
| 701 | P.flush(); |
| 702 | P.printEnum("Kind", uint8_t(C.Kind), getFileChecksumNames()); |
| 703 | P.printBinaryBlock("Checksum", C.Checksum); |
| 704 | } |
| 705 | return Error::success(); |
| 706 | } |
| 707 | |
Zachary Turner | d66889c | 2016-07-28 19:12:28 +0000 | [diff] [blame] | 708 | Error visitLines(ReadableStreamRef Data, |
| 709 | const LineSubstreamHeader *Header, |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 710 | const LineInfoArray &Lines) override { |
| 711 | DictScope DD(P, "Lines"); |
| 712 | for (const auto &L : Lines) { |
| 713 | if (auto Result = getFileNameForOffset2(L.NameIndex)) |
| 714 | P.printString("FileName", Result.get()); |
| 715 | else |
| 716 | return Result.takeError(); |
| 717 | P.flush(); |
| 718 | for (const auto &N : L.LineNumbers) { |
| 719 | DictScope DDD(P, "Line"); |
| 720 | LineInfo LI(N.Flags); |
| 721 | P.printNumber("Offset", N.Offset); |
| 722 | if (LI.isAlwaysStepInto()) |
| 723 | P.printString("StepInto", StringRef("Always")); |
| 724 | else if (LI.isNeverStepInto()) |
| 725 | P.printString("StepInto", StringRef("Never")); |
| 726 | else |
| 727 | P.printNumber("LineNumberStart", LI.getStartLine()); |
| 728 | P.printNumber("EndDelta", LI.getLineDelta()); |
| 729 | P.printBoolean("IsStatement", LI.isStatement()); |
| 730 | } |
| 731 | for (const auto &C : L.Columns) { |
| 732 | DictScope DDD(P, "Column"); |
| 733 | P.printNumber("Start", C.StartColumn); |
| 734 | P.printNumber("End", C.EndColumn); |
| 735 | } |
| 736 | } |
| 737 | return Error::success(); |
| 738 | } |
| 739 | |
| 740 | private: |
| 741 | Expected<StringRef> getFileNameForOffset(uint32_t Offset) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 742 | auto ST = F.getStringTable(); |
| 743 | if (!ST) |
| 744 | return ST.takeError(); |
| 745 | |
| 746 | return ST->getStringForID(Offset); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 747 | } |
| 748 | Expected<StringRef> getFileNameForOffset2(uint32_t Offset) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 749 | auto DS = F.getPDBDbiStream(); |
| 750 | if (!DS) |
| 751 | return DS.takeError(); |
| 752 | return DS->getFileNameForIndex(Offset); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 753 | } |
| 754 | ScopedPrinter &P; |
| 755 | PDBFile &F; |
| 756 | }; |
| 757 | |
| 758 | RecordVisitor V(P, File); |
| 759 | for (const auto &L : ModS.lines(&HadError)) { |
| 760 | if (auto EC = codeview::visitModuleSubstream(L, V)) |
| 761 | return EC; |
| 762 | } |
| 763 | } |
| 764 | } |
| 765 | } |
| 766 | } |
| 767 | return Error::success(); |
| 768 | } |
| 769 | |
| 770 | Error LLVMOutputStyle::dumpSectionContribs() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 771 | if (!opts::raw::DumpSectionContribs) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 772 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 773 | if (!File.hasPDBDbiStream()) { |
| 774 | P.printString("DBI Stream not present"); |
| 775 | return Error::success(); |
| 776 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 777 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 778 | auto Dbi = File.getPDBDbiStream(); |
| 779 | if (!Dbi) |
| 780 | return Dbi.takeError(); |
| 781 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 782 | ListScope L(P, "Section Contributions"); |
| 783 | class Visitor : public ISectionContribVisitor { |
| 784 | public: |
| 785 | Visitor(ScopedPrinter &P, DbiStream &DS) : P(P), DS(DS) {} |
| 786 | void visit(const SectionContrib &SC) override { |
| 787 | DictScope D(P, "Contribution"); |
| 788 | P.printNumber("ISect", SC.ISect); |
| 789 | P.printNumber("Off", SC.Off); |
| 790 | P.printNumber("Size", SC.Size); |
| 791 | P.printFlags("Characteristics", SC.Characteristics, |
| 792 | codeview::getImageSectionCharacteristicNames(), |
| 793 | COFF::SectionCharacteristics(0x00F00000)); |
| 794 | { |
| 795 | DictScope DD(P, "Module"); |
| 796 | P.printNumber("Index", SC.Imod); |
| 797 | auto M = DS.modules(); |
| 798 | if (M.size() > SC.Imod) { |
| 799 | P.printString("Name", M[SC.Imod].Info.getModuleName()); |
| 800 | } |
| 801 | } |
| 802 | P.printNumber("Data CRC", SC.DataCrc); |
| 803 | P.printNumber("Reloc CRC", SC.RelocCrc); |
| 804 | P.flush(); |
| 805 | } |
| 806 | void visit(const SectionContrib2 &SC) override { |
| 807 | visit(SC.Base); |
| 808 | P.printNumber("ISect Coff", SC.ISectCoff); |
| 809 | P.flush(); |
| 810 | } |
| 811 | |
| 812 | private: |
| 813 | ScopedPrinter &P; |
| 814 | DbiStream &DS; |
| 815 | }; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 816 | Visitor V(P, *Dbi); |
| 817 | Dbi->visitSectionContributions(V); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 818 | return Error::success(); |
| 819 | } |
| 820 | |
| 821 | Error LLVMOutputStyle::dumpSectionMap() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 822 | if (!opts::raw::DumpSectionMap) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 823 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 824 | if (!File.hasPDBDbiStream()) { |
| 825 | P.printString("DBI Stream not present"); |
| 826 | return Error::success(); |
| 827 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 828 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 829 | auto Dbi = File.getPDBDbiStream(); |
| 830 | if (!Dbi) |
| 831 | return Dbi.takeError(); |
| 832 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 833 | ListScope L(P, "Section Map"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 834 | for (auto &M : Dbi->getSectionMap()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 835 | DictScope D(P, "Entry"); |
| 836 | P.printFlags("Flags", M.Flags, getOMFSegMapDescFlagNames()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 837 | P.printNumber("Ovl", M.Ovl); |
| 838 | P.printNumber("Group", M.Group); |
| 839 | P.printNumber("Frame", M.Frame); |
| 840 | P.printNumber("SecName", M.SecName); |
| 841 | P.printNumber("ClassName", M.ClassName); |
| 842 | P.printNumber("Offset", M.Offset); |
| 843 | P.printNumber("SecByteLength", M.SecByteLength); |
| 844 | P.flush(); |
| 845 | } |
| 846 | return Error::success(); |
| 847 | } |
| 848 | |
| 849 | Error LLVMOutputStyle::dumpPublicsStream() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 850 | if (!opts::raw::DumpPublics) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 851 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 852 | if (!File.hasPDBPublicsStream()) { |
| 853 | P.printString("Publics Stream not present"); |
| 854 | return Error::success(); |
| 855 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 856 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 857 | auto Publics = File.getPDBPublicsStream(); |
| 858 | if (!Publics) |
| 859 | return Publics.takeError(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 860 | DictScope D(P, "Publics Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 861 | |
| 862 | auto Dbi = File.getPDBDbiStream(); |
| 863 | if (!Dbi) |
| 864 | return Dbi.takeError(); |
| 865 | |
| 866 | P.printNumber("Stream number", Dbi->getPublicSymbolStreamIndex()); |
| 867 | P.printNumber("SymHash", Publics->getSymHash()); |
| 868 | P.printNumber("AddrMap", Publics->getAddrMap()); |
| 869 | P.printNumber("Number of buckets", Publics->getNumBuckets()); |
| 870 | P.printList("Hash Buckets", Publics->getHashBuckets()); |
| 871 | P.printList("Address Map", Publics->getAddressMap()); |
| 872 | P.printList("Thunk Map", Publics->getThunkMap()); |
| 873 | P.printList("Section Offsets", Publics->getSectionOffsets(), |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 874 | printSectionOffset); |
| 875 | ListScope L(P, "Symbols"); |
Zachary Turner | 5e3e4bb | 2016-08-05 21:45:34 +0000 | [diff] [blame] | 876 | codeview::CVSymbolDumper SD(P, Dumper, nullptr, false); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 877 | bool HadError = false; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 878 | for (auto S : Publics->getSymbols(&HadError)) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 879 | DictScope DD(P, ""); |
| 880 | |
Zachary Turner | 0d84074 | 2016-10-07 21:34:46 +0000 | [diff] [blame] | 881 | if (auto EC = SD.dump(S)) { |
| 882 | HadError = true; |
| 883 | break; |
| 884 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 885 | if (opts::raw::DumpSymRecordBytes) |
Zachary Turner | c67b00c | 2016-09-14 23:00:16 +0000 | [diff] [blame] | 886 | P.printBinaryBlock("Bytes", S.content()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 887 | } |
| 888 | if (HadError) |
| 889 | return make_error<RawError>( |
| 890 | raw_error_code::corrupt_file, |
| 891 | "Public symbol stream contained corrupt record"); |
| 892 | |
| 893 | return Error::success(); |
| 894 | } |
| 895 | |
| 896 | Error LLVMOutputStyle::dumpSectionHeaders() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 897 | if (!opts::raw::DumpSectionHeaders) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 898 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 899 | if (!File.hasPDBDbiStream()) { |
| 900 | P.printString("DBI Stream not present"); |
| 901 | return Error::success(); |
| 902 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 903 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 904 | auto Dbi = File.getPDBDbiStream(); |
| 905 | if (!Dbi) |
| 906 | return Dbi.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 907 | |
| 908 | ListScope D(P, "Section Headers"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 909 | for (const object::coff_section &Section : Dbi->getSectionHeaders()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 910 | DictScope DD(P, ""); |
| 911 | |
| 912 | // If a name is 8 characters long, there is no NUL character at end. |
| 913 | StringRef Name(Section.Name, strnlen(Section.Name, sizeof(Section.Name))); |
| 914 | P.printString("Name", Name); |
| 915 | P.printNumber("Virtual Size", Section.VirtualSize); |
| 916 | P.printNumber("Virtual Address", Section.VirtualAddress); |
| 917 | P.printNumber("Size of Raw Data", Section.SizeOfRawData); |
| 918 | P.printNumber("File Pointer to Raw Data", Section.PointerToRawData); |
| 919 | P.printNumber("File Pointer to Relocations", Section.PointerToRelocations); |
| 920 | P.printNumber("File Pointer to Linenumbers", Section.PointerToLinenumbers); |
| 921 | P.printNumber("Number of Relocations", Section.NumberOfRelocations); |
| 922 | P.printNumber("Number of Linenumbers", Section.NumberOfLinenumbers); |
Rui Ueyama | 2c5384a | 2016-06-06 21:34:55 +0000 | [diff] [blame] | 923 | P.printFlags("Characteristics", Section.Characteristics, |
| 924 | getImageSectionCharacteristicNames()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 925 | } |
| 926 | return Error::success(); |
| 927 | } |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 928 | |
| 929 | Error LLVMOutputStyle::dumpFpoStream() { |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 930 | if (!opts::raw::DumpFpo) |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 931 | return Error::success(); |
Bob Haarman | a5b4358 | 2016-12-05 22:44:00 +0000 | [diff] [blame] | 932 | if (!File.hasPDBDbiStream()) { |
| 933 | P.printString("DBI Stream not present"); |
| 934 | return Error::success(); |
| 935 | } |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 936 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 937 | auto Dbi = File.getPDBDbiStream(); |
| 938 | if (!Dbi) |
| 939 | return Dbi.takeError(); |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 940 | |
| 941 | ListScope D(P, "New FPO"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 942 | for (const object::FpoData &Fpo : Dbi->getFpoRecords()) { |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 943 | DictScope DD(P, ""); |
| 944 | P.printNumber("Offset", Fpo.Offset); |
| 945 | P.printNumber("Size", Fpo.Size); |
| 946 | P.printNumber("Number of locals", Fpo.NumLocals); |
| 947 | P.printNumber("Number of params", Fpo.NumParams); |
| 948 | P.printNumber("Size of Prolog", Fpo.getPrologSize()); |
| 949 | P.printNumber("Number of Saved Registers", Fpo.getNumSavedRegs()); |
| 950 | P.printBoolean("Has SEH", Fpo.hasSEH()); |
| 951 | P.printBoolean("Use BP", Fpo.useBP()); |
| 952 | P.printNumber("Frame Pointer", Fpo.getFP()); |
| 953 | } |
| 954 | return Error::success(); |
| 955 | } |
Zachary Turner | a30bd1a | 2016-06-30 17:42:48 +0000 | [diff] [blame] | 956 | |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 957 | void LLVMOutputStyle::flush() { P.flush(); } |