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" |
| 16 | #include "llvm/DebugInfo/PDB/PDBExtras.h" |
| 17 | #include "llvm/DebugInfo/PDB/Raw/DbiStream.h" |
| 18 | #include "llvm/DebugInfo/PDB/Raw/EnumTables.h" |
| 19 | #include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h" |
Zachary Turner | d844799 | 2016-06-07 05:28:55 +0000 | [diff] [blame] | 20 | #include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h" |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 21 | #include "llvm/DebugInfo/PDB/Raw/InfoStream.h" |
| 22 | #include "llvm/DebugInfo/PDB/Raw/ModInfo.h" |
| 23 | #include "llvm/DebugInfo/PDB/Raw/ModStream.h" |
| 24 | #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" |
| 25 | #include "llvm/DebugInfo/PDB/Raw/PublicsStream.h" |
| 26 | #include "llvm/DebugInfo/PDB/Raw/RawError.h" |
| 27 | #include "llvm/DebugInfo/PDB/Raw/TpiStream.h" |
| 28 | #include "llvm/Object/COFF.h" |
| 29 | |
| 30 | #include <unordered_map> |
| 31 | |
| 32 | using namespace llvm; |
| 33 | using namespace llvm::codeview; |
| 34 | using namespace llvm::pdb; |
| 35 | |
| 36 | static void printSectionOffset(llvm::raw_ostream &OS, |
| 37 | const SectionOffset &Off) { |
| 38 | OS << Off.Off << ", " << Off.Isect; |
| 39 | } |
| 40 | |
| 41 | LLVMOutputStyle::LLVMOutputStyle(PDBFile &File) |
| 42 | : File(File), P(outs()), TD(&P, false) {} |
| 43 | |
| 44 | Error LLVMOutputStyle::dumpFileHeaders() { |
| 45 | if (!opts::DumpHeaders) |
| 46 | return Error::success(); |
| 47 | |
| 48 | DictScope D(P, "FileHeaders"); |
| 49 | P.printNumber("BlockSize", File.getBlockSize()); |
| 50 | P.printNumber("Unknown0", File.getUnknown0()); |
| 51 | P.printNumber("NumBlocks", File.getBlockCount()); |
| 52 | P.printNumber("NumDirectoryBytes", File.getNumDirectoryBytes()); |
| 53 | P.printNumber("Unknown1", File.getUnknown1()); |
| 54 | P.printNumber("BlockMapAddr", File.getBlockMapIndex()); |
| 55 | P.printNumber("NumDirectoryBlocks", File.getNumDirectoryBlocks()); |
| 56 | P.printNumber("BlockMapOffset", File.getBlockMapOffset()); |
| 57 | |
| 58 | // The directory is not contiguous. Instead, the block map contains a |
| 59 | // contiguous list of block numbers whose contents, when concatenated in |
| 60 | // order, make up the directory. |
| 61 | P.printList("DirectoryBlocks", File.getDirectoryBlockArray()); |
| 62 | P.printNumber("NumStreams", File.getNumStreams()); |
| 63 | return Error::success(); |
| 64 | } |
| 65 | |
| 66 | Error LLVMOutputStyle::dumpStreamSummary() { |
| 67 | if (!opts::DumpStreamSummary) |
| 68 | return Error::success(); |
| 69 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 70 | auto Dbi = File.getPDBDbiStream(); |
| 71 | if (!Dbi) |
| 72 | return Dbi.takeError(); |
| 73 | |
| 74 | auto Tpi = File.getPDBTpiStream(); |
| 75 | if (!Tpi) |
| 76 | return Tpi.takeError(); |
| 77 | |
| 78 | auto Ipi = File.getPDBIpiStream(); |
| 79 | if (!Ipi) |
| 80 | return Ipi.takeError(); |
| 81 | |
| 82 | auto Info = File.getPDBInfoStream(); |
| 83 | if (!Info) |
| 84 | return Info.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 85 | |
| 86 | ListScope L(P, "Streams"); |
| 87 | uint32_t StreamCount = File.getNumStreams(); |
| 88 | std::unordered_map<uint16_t, const ModuleInfoEx *> ModStreams; |
| 89 | std::unordered_map<uint16_t, std::string> NamedStreams; |
| 90 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 91 | for (auto &ModI : Dbi->modules()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 92 | uint16_t SN = ModI.Info.getModuleStreamIndex(); |
| 93 | ModStreams[SN] = &ModI; |
| 94 | } |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 95 | for (auto &NSE : Info->named_streams()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 96 | NamedStreams[NSE.second] = NSE.first(); |
| 97 | } |
| 98 | |
| 99 | for (uint16_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { |
| 100 | std::string Label("Stream "); |
| 101 | Label += to_string(StreamIdx); |
| 102 | std::string Value; |
| 103 | if (StreamIdx == OldMSFDirectory) |
| 104 | Value = "Old MSF Directory"; |
| 105 | else if (StreamIdx == StreamPDB) |
| 106 | Value = "PDB Stream"; |
| 107 | else if (StreamIdx == StreamDBI) |
| 108 | Value = "DBI Stream"; |
| 109 | else if (StreamIdx == StreamTPI) |
| 110 | Value = "TPI Stream"; |
| 111 | else if (StreamIdx == StreamIPI) |
| 112 | Value = "IPI Stream"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 113 | else if (StreamIdx == Dbi->getGlobalSymbolStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 114 | Value = "Global Symbol Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 115 | else if (StreamIdx == Dbi->getPublicSymbolStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 116 | Value = "Public Symbol Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 117 | else if (StreamIdx == Dbi->getSymRecordStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 118 | Value = "Public Symbol Records"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 119 | else if (StreamIdx == Tpi->getTypeHashStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 120 | Value = "TPI Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 121 | else if (StreamIdx == Tpi->getTypeHashStreamAuxIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 122 | Value = "TPI Aux Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 123 | else if (StreamIdx == Ipi->getTypeHashStreamIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 124 | Value = "IPI Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 125 | else if (StreamIdx == Ipi->getTypeHashStreamAuxIndex()) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 126 | Value = "IPI Aux Hash"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 127 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Exception)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 128 | Value = "Exception Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 129 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Fixup)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 130 | Value = "Fixup Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 131 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::FPO)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 132 | Value = "FPO Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 133 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::NewFPO)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 134 | Value = "New FPO Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 135 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::OmapFromSrc)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 136 | Value = "Omap From Source Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 137 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::OmapToSrc)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 138 | Value = "Omap To Source Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 139 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Pdata)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 140 | Value = "Pdata"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 141 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::SectionHdr)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 142 | Value = "Section Header Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 143 | else if (StreamIdx == |
| 144 | Dbi->getDebugStreamIndex(DbgHeaderType::SectionHdrOrig)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 145 | Value = "Section Header Original Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 146 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::TokenRidMap)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 147 | Value = "Token Rid Data"; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 148 | else if (StreamIdx == Dbi->getDebugStreamIndex(DbgHeaderType::Xdata)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 149 | Value = "Xdata"; |
| 150 | else { |
| 151 | auto ModIter = ModStreams.find(StreamIdx); |
| 152 | auto NSIter = NamedStreams.find(StreamIdx); |
| 153 | if (ModIter != ModStreams.end()) { |
| 154 | Value = "Module \""; |
| 155 | Value += ModIter->second->Info.getModuleName().str(); |
| 156 | Value += "\""; |
| 157 | } else if (NSIter != NamedStreams.end()) { |
| 158 | Value = "Named Stream \""; |
| 159 | Value += NSIter->second; |
| 160 | Value += "\""; |
| 161 | } else { |
| 162 | Value = "???"; |
| 163 | } |
| 164 | } |
| 165 | Value = "[" + Value + "]"; |
| 166 | Value = |
| 167 | Value + " (" + to_string(File.getStreamByteSize(StreamIdx)) + " bytes)"; |
| 168 | |
| 169 | P.printString(Label, Value); |
| 170 | } |
| 171 | P.flush(); |
| 172 | return Error::success(); |
| 173 | } |
| 174 | |
| 175 | Error LLVMOutputStyle::dumpStreamBlocks() { |
| 176 | if (!opts::DumpStreamBlocks) |
| 177 | return Error::success(); |
| 178 | |
| 179 | ListScope L(P, "StreamBlocks"); |
| 180 | uint32_t StreamCount = File.getNumStreams(); |
| 181 | for (uint32_t StreamIdx = 0; StreamIdx < StreamCount; ++StreamIdx) { |
| 182 | std::string Name("Stream "); |
| 183 | Name += to_string(StreamIdx); |
| 184 | auto StreamBlocks = File.getStreamBlockList(StreamIdx); |
| 185 | P.printList(Name, StreamBlocks); |
| 186 | } |
| 187 | return Error::success(); |
| 188 | } |
| 189 | |
| 190 | Error LLVMOutputStyle::dumpStreamData() { |
| 191 | uint32_t StreamCount = File.getNumStreams(); |
| 192 | StringRef DumpStreamStr = opts::DumpStreamDataIdx; |
| 193 | uint32_t DumpStreamNum; |
Zachary Turner | d2b2bfe | 2016-06-08 00:25:08 +0000 | [diff] [blame] | 194 | if (DumpStreamStr.getAsInteger(/*Radix=*/0U, DumpStreamNum)) |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 195 | return Error::success(); |
| 196 | |
Zachary Turner | d2b2bfe | 2016-06-08 00:25:08 +0000 | [diff] [blame] | 197 | if (DumpStreamNum >= StreamCount) |
| 198 | return make_error<RawError>(raw_error_code::no_stream); |
| 199 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 200 | auto S = MappedBlockStream::createIndexedStream(DumpStreamNum, File); |
| 201 | if (!S) |
| 202 | return S.takeError(); |
| 203 | codeview::StreamReader R(**S); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 204 | while (R.bytesRemaining() > 0) { |
| 205 | ArrayRef<uint8_t> Data; |
| 206 | uint32_t BytesToReadInBlock = std::min( |
| 207 | R.bytesRemaining(), static_cast<uint32_t>(File.getBlockSize())); |
| 208 | if (auto EC = R.readBytes(Data, BytesToReadInBlock)) |
| 209 | return EC; |
| 210 | P.printBinaryBlock( |
| 211 | "Data", |
| 212 | StringRef(reinterpret_cast<const char *>(Data.begin()), Data.size())); |
| 213 | } |
| 214 | return Error::success(); |
| 215 | } |
| 216 | |
| 217 | Error LLVMOutputStyle::dumpInfoStream() { |
| 218 | if (!opts::DumpHeaders) |
| 219 | return Error::success(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 220 | auto IS = File.getPDBInfoStream(); |
| 221 | if (!IS) |
| 222 | return IS.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 223 | |
| 224 | DictScope D(P, "PDB Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 225 | P.printNumber("Version", IS->getVersion()); |
| 226 | P.printHex("Signature", IS->getSignature()); |
| 227 | P.printNumber("Age", IS->getAge()); |
| 228 | P.printObject("Guid", IS->getGuid()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 229 | return Error::success(); |
| 230 | } |
| 231 | |
| 232 | Error LLVMOutputStyle::dumpNamedStream() { |
| 233 | if (opts::DumpStreamDataName.empty()) |
| 234 | return Error::success(); |
| 235 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 236 | auto IS = File.getPDBInfoStream(); |
| 237 | if (!IS) |
| 238 | return IS.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 239 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 240 | uint32_t NameStreamIndex = IS->getNamedStreamIndex(opts::DumpStreamDataName); |
Zachary Turner | d2b2bfe | 2016-06-08 00:25:08 +0000 | [diff] [blame] | 241 | if (NameStreamIndex == 0 || NameStreamIndex >= File.getNumStreams()) |
| 242 | return make_error<RawError>(raw_error_code::no_stream); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 243 | |
| 244 | if (NameStreamIndex != 0) { |
| 245 | std::string Name("Stream '"); |
| 246 | Name += opts::DumpStreamDataName; |
| 247 | Name += "'"; |
| 248 | DictScope D(P, Name); |
| 249 | P.printNumber("Index", NameStreamIndex); |
| 250 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 251 | auto NameStream = |
| 252 | MappedBlockStream::createIndexedStream(NameStreamIndex, File); |
| 253 | if (!NameStream) |
| 254 | return NameStream.takeError(); |
| 255 | codeview::StreamReader Reader(**NameStream); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 256 | |
| 257 | NameHashTable NameTable; |
| 258 | if (auto EC = NameTable.load(Reader)) |
| 259 | return EC; |
| 260 | |
| 261 | P.printHex("Signature", NameTable.getSignature()); |
| 262 | P.printNumber("Version", NameTable.getHashVersion()); |
| 263 | P.printNumber("Name Count", NameTable.getNameCount()); |
| 264 | ListScope L(P, "Names"); |
| 265 | for (uint32_t ID : NameTable.name_ids()) { |
| 266 | StringRef Str = NameTable.getStringForID(ID); |
| 267 | if (!Str.empty()) |
| 268 | P.printString(to_string(ID), Str); |
| 269 | } |
| 270 | } |
| 271 | return Error::success(); |
| 272 | } |
| 273 | |
Rui Ueyama | fd97bf1 | 2016-06-03 20:48:51 +0000 | [diff] [blame] | 274 | static void printTypeIndexOffset(raw_ostream &OS, |
| 275 | const TypeIndexOffset &TIOff) { |
| 276 | OS << "{" << TIOff.Type.getIndex() << ", " << TIOff.Offset << "}"; |
| 277 | } |
| 278 | |
| 279 | static void dumpTpiHash(ScopedPrinter &P, TpiStream &Tpi) { |
| 280 | if (!opts::DumpTpiHash) |
| 281 | return; |
| 282 | DictScope DD(P, "Hash"); |
Rui Ueyama | f14a74c | 2016-06-07 23:53:43 +0000 | [diff] [blame] | 283 | P.printNumber("Number of Hash Buckets", Tpi.NumHashBuckets()); |
Rui Ueyama | d833917 | 2016-06-07 23:44:27 +0000 | [diff] [blame] | 284 | P.printNumber("Hash Key Size", Tpi.getHashKeySize()); |
Rui Ueyama | fd97bf1 | 2016-06-03 20:48:51 +0000 | [diff] [blame] | 285 | codeview::FixedStreamArray<support::ulittle32_t> S = Tpi.getHashValues(); |
| 286 | P.printList("Values", Tpi.getHashValues()); |
| 287 | P.printList("Type Index Offsets", Tpi.getTypeIndexOffsets(), |
| 288 | printTypeIndexOffset); |
| 289 | P.printList("Hash Adjustments", Tpi.getHashAdjustments(), |
| 290 | printTypeIndexOffset); |
| 291 | } |
| 292 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 293 | Error LLVMOutputStyle::dumpTpiStream(uint32_t StreamIdx) { |
| 294 | assert(StreamIdx == StreamTPI || StreamIdx == StreamIPI); |
| 295 | |
| 296 | bool DumpRecordBytes = false; |
| 297 | bool DumpRecords = false; |
| 298 | StringRef Label; |
| 299 | StringRef VerLabel; |
| 300 | if (StreamIdx == StreamTPI) { |
| 301 | DumpRecordBytes = opts::DumpTpiRecordBytes; |
| 302 | DumpRecords = opts::DumpTpiRecords; |
| 303 | Label = "Type Info Stream (TPI)"; |
| 304 | VerLabel = "TPI Version"; |
| 305 | } else if (StreamIdx == StreamIPI) { |
| 306 | DumpRecordBytes = opts::DumpIpiRecordBytes; |
| 307 | DumpRecords = opts::DumpIpiRecords; |
| 308 | Label = "Type Info Stream (IPI)"; |
| 309 | VerLabel = "IPI Version"; |
| 310 | } |
| 311 | if (!DumpRecordBytes && !DumpRecords && !opts::DumpModuleSyms) |
| 312 | return Error::success(); |
| 313 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 314 | auto Tpi = (StreamIdx == StreamTPI) ? File.getPDBTpiStream() |
| 315 | : File.getPDBIpiStream(); |
| 316 | if (!Tpi) |
| 317 | return Tpi.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 318 | |
| 319 | if (DumpRecords || DumpRecordBytes) { |
| 320 | DictScope D(P, Label); |
| 321 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 322 | P.printNumber(VerLabel, Tpi->getTpiVersion()); |
| 323 | P.printNumber("Record count", Tpi->NumTypeRecords()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 324 | |
| 325 | ListScope L(P, "Records"); |
| 326 | |
| 327 | bool HadError = false; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 328 | for (auto &Type : Tpi->types(&HadError)) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 329 | DictScope DD(P, ""); |
| 330 | |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 331 | if (DumpRecords) { |
| 332 | if (auto EC = TD.dump(Type)) |
| 333 | return EC; |
| 334 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 335 | |
| 336 | if (DumpRecordBytes) |
| 337 | P.printBinaryBlock("Bytes", Type.Data); |
| 338 | } |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 339 | dumpTpiHash(P, *Tpi); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 340 | if (HadError) |
| 341 | return make_error<RawError>(raw_error_code::corrupt_file, |
| 342 | "TPI stream contained corrupt record"); |
| 343 | } else if (opts::DumpModuleSyms) { |
| 344 | // Even if the user doesn't want to dump type records, we still need to |
| 345 | // iterate them in order to build the list of types so that we can print |
| 346 | // them when dumping module symbols. So when they want to dump symbols |
| 347 | // but not types, use a null output stream. |
| 348 | ScopedPrinter *OldP = TD.getPrinter(); |
| 349 | TD.setPrinter(nullptr); |
| 350 | |
| 351 | bool HadError = false; |
Zachary Turner | 01ee3dae | 2016-06-16 18:22:27 +0000 | [diff] [blame] | 352 | for (auto &Type : Tpi->types(&HadError)) { |
| 353 | if (auto EC = TD.dump(Type)) |
| 354 | return EC; |
| 355 | } |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 356 | |
| 357 | TD.setPrinter(OldP); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 358 | dumpTpiHash(P, *Tpi); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 359 | if (HadError) |
| 360 | return make_error<RawError>(raw_error_code::corrupt_file, |
| 361 | "TPI stream contained corrupt record"); |
| 362 | } |
| 363 | P.flush(); |
| 364 | return Error::success(); |
| 365 | } |
| 366 | |
| 367 | Error LLVMOutputStyle::dumpDbiStream() { |
| 368 | bool DumpModules = opts::DumpModules || opts::DumpModuleSyms || |
| 369 | opts::DumpModuleFiles || opts::DumpLineInfo; |
| 370 | if (!opts::DumpHeaders && !DumpModules) |
| 371 | return Error::success(); |
| 372 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 373 | auto DS = File.getPDBDbiStream(); |
| 374 | if (!DS) |
| 375 | return DS.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 376 | |
| 377 | DictScope D(P, "DBI Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 378 | P.printNumber("Dbi Version", DS->getDbiVersion()); |
| 379 | P.printNumber("Age", DS->getAge()); |
| 380 | P.printBoolean("Incremental Linking", DS->isIncrementallyLinked()); |
| 381 | P.printBoolean("Has CTypes", DS->hasCTypes()); |
| 382 | P.printBoolean("Is Stripped", DS->isStripped()); |
| 383 | P.printObject("Machine Type", DS->getMachineType()); |
| 384 | P.printNumber("Symbol Record Stream Index", DS->getSymRecordStreamIndex()); |
| 385 | P.printNumber("Public Symbol Stream Index", DS->getPublicSymbolStreamIndex()); |
| 386 | P.printNumber("Global Symbol Stream Index", DS->getGlobalSymbolStreamIndex()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 387 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 388 | uint16_t Major = DS->getBuildMajorVersion(); |
| 389 | uint16_t Minor = DS->getBuildMinorVersion(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 390 | P.printVersion("Toolchain Version", Major, Minor); |
| 391 | |
| 392 | std::string DllName; |
| 393 | raw_string_ostream DllStream(DllName); |
| 394 | DllStream << "mspdb" << Major << Minor << ".dll version"; |
| 395 | DllStream.flush(); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 396 | P.printVersion(DllName, Major, Minor, DS->getPdbDllVersion()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 397 | |
| 398 | if (DumpModules) { |
| 399 | ListScope L(P, "Modules"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 400 | for (auto &Modi : DS->modules()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 401 | DictScope DD(P); |
| 402 | P.printString("Name", Modi.Info.getModuleName().str()); |
| 403 | P.printNumber("Debug Stream Index", Modi.Info.getModuleStreamIndex()); |
| 404 | P.printString("Object File Name", Modi.Info.getObjFileName().str()); |
| 405 | P.printNumber("Num Files", Modi.Info.getNumberOfFiles()); |
| 406 | P.printNumber("Source File Name Idx", Modi.Info.getSourceFileNameIndex()); |
| 407 | P.printNumber("Pdb File Name Idx", Modi.Info.getPdbFilePathNameIndex()); |
| 408 | P.printNumber("Line Info Byte Size", Modi.Info.getLineInfoByteSize()); |
| 409 | P.printNumber("C13 Line Info Byte Size", |
| 410 | Modi.Info.getC13LineInfoByteSize()); |
| 411 | P.printNumber("Symbol Byte Size", Modi.Info.getSymbolDebugInfoByteSize()); |
| 412 | P.printNumber("Type Server Index", Modi.Info.getTypeServerIndex()); |
| 413 | P.printBoolean("Has EC Info", Modi.Info.hasECInfo()); |
| 414 | if (opts::DumpModuleFiles) { |
| 415 | std::string FileListName = |
| 416 | to_string(Modi.SourceFiles.size()) + " Contributing Source Files"; |
| 417 | ListScope LL(P, FileListName); |
| 418 | for (auto File : Modi.SourceFiles) |
| 419 | P.printString(File.str()); |
| 420 | } |
| 421 | bool HasModuleDI = |
| 422 | (Modi.Info.getModuleStreamIndex() < File.getNumStreams()); |
| 423 | bool ShouldDumpSymbols = |
| 424 | (opts::DumpModuleSyms || opts::DumpSymRecordBytes); |
| 425 | if (HasModuleDI && (ShouldDumpSymbols || opts::DumpLineInfo)) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 426 | auto ModStreamData = MappedBlockStream::createIndexedStream( |
| 427 | Modi.Info.getModuleStreamIndex(), File); |
| 428 | if (!ModStreamData) |
| 429 | return ModStreamData.takeError(); |
| 430 | ModStream ModS(Modi.Info, std::move(*ModStreamData)); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 431 | if (auto EC = ModS.reload()) |
| 432 | return EC; |
| 433 | |
| 434 | if (ShouldDumpSymbols) { |
| 435 | ListScope SS(P, "Symbols"); |
| 436 | codeview::CVSymbolDumper SD(P, TD, nullptr, false); |
| 437 | bool HadError = false; |
| 438 | for (const auto &S : ModS.symbols(&HadError)) { |
| 439 | DictScope DD(P, ""); |
| 440 | |
| 441 | if (opts::DumpModuleSyms) |
| 442 | SD.dump(S); |
| 443 | if (opts::DumpSymRecordBytes) |
| 444 | P.printBinaryBlock("Bytes", S.Data); |
| 445 | } |
| 446 | if (HadError) |
| 447 | return make_error<RawError>( |
| 448 | raw_error_code::corrupt_file, |
| 449 | "DBI stream contained corrupt symbol record"); |
| 450 | } |
| 451 | if (opts::DumpLineInfo) { |
| 452 | ListScope SS(P, "LineInfo"); |
| 453 | bool HadError = false; |
| 454 | // Define a locally scoped visitor to print the different |
| 455 | // substream types types. |
| 456 | class RecordVisitor : public codeview::IModuleSubstreamVisitor { |
| 457 | public: |
| 458 | RecordVisitor(ScopedPrinter &P, PDBFile &F) : P(P), F(F) {} |
| 459 | Error visitUnknown(ModuleSubstreamKind Kind, |
| 460 | StreamRef Stream) override { |
| 461 | DictScope DD(P, "Unknown"); |
| 462 | ArrayRef<uint8_t> Data; |
| 463 | StreamReader R(Stream); |
| 464 | if (auto EC = R.readBytes(Data, R.bytesRemaining())) { |
| 465 | return make_error<RawError>( |
| 466 | raw_error_code::corrupt_file, |
| 467 | "DBI stream contained corrupt line info record"); |
| 468 | } |
| 469 | P.printBinaryBlock("Data", Data); |
| 470 | return Error::success(); |
| 471 | } |
| 472 | Error |
| 473 | visitFileChecksums(StreamRef Data, |
| 474 | const FileChecksumArray &Checksums) override { |
| 475 | DictScope DD(P, "FileChecksums"); |
| 476 | for (const auto &C : Checksums) { |
| 477 | DictScope DDD(P, "Checksum"); |
| 478 | if (auto Result = getFileNameForOffset(C.FileNameOffset)) |
| 479 | P.printString("FileName", Result.get()); |
| 480 | else |
| 481 | return Result.takeError(); |
| 482 | P.flush(); |
| 483 | P.printEnum("Kind", uint8_t(C.Kind), getFileChecksumNames()); |
| 484 | P.printBinaryBlock("Checksum", C.Checksum); |
| 485 | } |
| 486 | return Error::success(); |
| 487 | } |
| 488 | |
| 489 | Error visitLines(StreamRef Data, const LineSubstreamHeader *Header, |
| 490 | const LineInfoArray &Lines) override { |
| 491 | DictScope DD(P, "Lines"); |
| 492 | for (const auto &L : Lines) { |
| 493 | if (auto Result = getFileNameForOffset2(L.NameIndex)) |
| 494 | P.printString("FileName", Result.get()); |
| 495 | else |
| 496 | return Result.takeError(); |
| 497 | P.flush(); |
| 498 | for (const auto &N : L.LineNumbers) { |
| 499 | DictScope DDD(P, "Line"); |
| 500 | LineInfo LI(N.Flags); |
| 501 | P.printNumber("Offset", N.Offset); |
| 502 | if (LI.isAlwaysStepInto()) |
| 503 | P.printString("StepInto", StringRef("Always")); |
| 504 | else if (LI.isNeverStepInto()) |
| 505 | P.printString("StepInto", StringRef("Never")); |
| 506 | else |
| 507 | P.printNumber("LineNumberStart", LI.getStartLine()); |
| 508 | P.printNumber("EndDelta", LI.getLineDelta()); |
| 509 | P.printBoolean("IsStatement", LI.isStatement()); |
| 510 | } |
| 511 | for (const auto &C : L.Columns) { |
| 512 | DictScope DDD(P, "Column"); |
| 513 | P.printNumber("Start", C.StartColumn); |
| 514 | P.printNumber("End", C.EndColumn); |
| 515 | } |
| 516 | } |
| 517 | return Error::success(); |
| 518 | } |
| 519 | |
| 520 | private: |
| 521 | Expected<StringRef> getFileNameForOffset(uint32_t Offset) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 522 | auto ST = F.getStringTable(); |
| 523 | if (!ST) |
| 524 | return ST.takeError(); |
| 525 | |
| 526 | return ST->getStringForID(Offset); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 527 | } |
| 528 | Expected<StringRef> getFileNameForOffset2(uint32_t Offset) { |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 529 | auto DS = F.getPDBDbiStream(); |
| 530 | if (!DS) |
| 531 | return DS.takeError(); |
| 532 | return DS->getFileNameForIndex(Offset); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 533 | } |
| 534 | ScopedPrinter &P; |
| 535 | PDBFile &F; |
| 536 | }; |
| 537 | |
| 538 | RecordVisitor V(P, File); |
| 539 | for (const auto &L : ModS.lines(&HadError)) { |
| 540 | if (auto EC = codeview::visitModuleSubstream(L, V)) |
| 541 | return EC; |
| 542 | } |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | return Error::success(); |
| 548 | } |
| 549 | |
| 550 | Error LLVMOutputStyle::dumpSectionContribs() { |
| 551 | if (!opts::DumpSectionContribs) |
| 552 | return Error::success(); |
| 553 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 554 | auto Dbi = File.getPDBDbiStream(); |
| 555 | if (!Dbi) |
| 556 | return Dbi.takeError(); |
| 557 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 558 | ListScope L(P, "Section Contributions"); |
| 559 | class Visitor : public ISectionContribVisitor { |
| 560 | public: |
| 561 | Visitor(ScopedPrinter &P, DbiStream &DS) : P(P), DS(DS) {} |
| 562 | void visit(const SectionContrib &SC) override { |
| 563 | DictScope D(P, "Contribution"); |
| 564 | P.printNumber("ISect", SC.ISect); |
| 565 | P.printNumber("Off", SC.Off); |
| 566 | P.printNumber("Size", SC.Size); |
| 567 | P.printFlags("Characteristics", SC.Characteristics, |
| 568 | codeview::getImageSectionCharacteristicNames(), |
| 569 | COFF::SectionCharacteristics(0x00F00000)); |
| 570 | { |
| 571 | DictScope DD(P, "Module"); |
| 572 | P.printNumber("Index", SC.Imod); |
| 573 | auto M = DS.modules(); |
| 574 | if (M.size() > SC.Imod) { |
| 575 | P.printString("Name", M[SC.Imod].Info.getModuleName()); |
| 576 | } |
| 577 | } |
| 578 | P.printNumber("Data CRC", SC.DataCrc); |
| 579 | P.printNumber("Reloc CRC", SC.RelocCrc); |
| 580 | P.flush(); |
| 581 | } |
| 582 | void visit(const SectionContrib2 &SC) override { |
| 583 | visit(SC.Base); |
| 584 | P.printNumber("ISect Coff", SC.ISectCoff); |
| 585 | P.flush(); |
| 586 | } |
| 587 | |
| 588 | private: |
| 589 | ScopedPrinter &P; |
| 590 | DbiStream &DS; |
| 591 | }; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 592 | Visitor V(P, *Dbi); |
| 593 | Dbi->visitSectionContributions(V); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 594 | return Error::success(); |
| 595 | } |
| 596 | |
| 597 | Error LLVMOutputStyle::dumpSectionMap() { |
| 598 | if (!opts::DumpSectionMap) |
| 599 | return Error::success(); |
| 600 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 601 | auto Dbi = File.getPDBDbiStream(); |
| 602 | if (!Dbi) |
| 603 | return Dbi.takeError(); |
| 604 | |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 605 | ListScope L(P, "Section Map"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 606 | for (auto &M : Dbi->getSectionMap()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 607 | DictScope D(P, "Entry"); |
| 608 | P.printFlags("Flags", M.Flags, getOMFSegMapDescFlagNames()); |
| 609 | P.printNumber("Flags", M.Flags); |
| 610 | P.printNumber("Ovl", M.Ovl); |
| 611 | P.printNumber("Group", M.Group); |
| 612 | P.printNumber("Frame", M.Frame); |
| 613 | P.printNumber("SecName", M.SecName); |
| 614 | P.printNumber("ClassName", M.ClassName); |
| 615 | P.printNumber("Offset", M.Offset); |
| 616 | P.printNumber("SecByteLength", M.SecByteLength); |
| 617 | P.flush(); |
| 618 | } |
| 619 | return Error::success(); |
| 620 | } |
| 621 | |
| 622 | Error LLVMOutputStyle::dumpPublicsStream() { |
| 623 | if (!opts::DumpPublics) |
| 624 | return Error::success(); |
| 625 | |
| 626 | DictScope D(P, "Publics Stream"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 627 | auto Publics = File.getPDBPublicsStream(); |
| 628 | if (!Publics) |
| 629 | return Publics.takeError(); |
| 630 | |
| 631 | auto Dbi = File.getPDBDbiStream(); |
| 632 | if (!Dbi) |
| 633 | return Dbi.takeError(); |
| 634 | |
| 635 | P.printNumber("Stream number", Dbi->getPublicSymbolStreamIndex()); |
| 636 | P.printNumber("SymHash", Publics->getSymHash()); |
| 637 | P.printNumber("AddrMap", Publics->getAddrMap()); |
| 638 | P.printNumber("Number of buckets", Publics->getNumBuckets()); |
| 639 | P.printList("Hash Buckets", Publics->getHashBuckets()); |
| 640 | P.printList("Address Map", Publics->getAddressMap()); |
| 641 | P.printList("Thunk Map", Publics->getThunkMap()); |
| 642 | P.printList("Section Offsets", Publics->getSectionOffsets(), |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 643 | printSectionOffset); |
| 644 | ListScope L(P, "Symbols"); |
| 645 | codeview::CVSymbolDumper SD(P, TD, nullptr, false); |
| 646 | bool HadError = false; |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 647 | for (auto S : Publics->getSymbols(&HadError)) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 648 | DictScope DD(P, ""); |
| 649 | |
| 650 | SD.dump(S); |
| 651 | if (opts::DumpSymRecordBytes) |
| 652 | P.printBinaryBlock("Bytes", S.Data); |
| 653 | } |
| 654 | if (HadError) |
| 655 | return make_error<RawError>( |
| 656 | raw_error_code::corrupt_file, |
| 657 | "Public symbol stream contained corrupt record"); |
| 658 | |
| 659 | return Error::success(); |
| 660 | } |
| 661 | |
| 662 | Error LLVMOutputStyle::dumpSectionHeaders() { |
| 663 | if (!opts::DumpSectionHeaders) |
| 664 | return Error::success(); |
| 665 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 666 | auto Dbi = File.getPDBDbiStream(); |
| 667 | if (!Dbi) |
| 668 | return Dbi.takeError(); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 669 | |
| 670 | ListScope D(P, "Section Headers"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 671 | for (const object::coff_section &Section : Dbi->getSectionHeaders()) { |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 672 | DictScope DD(P, ""); |
| 673 | |
| 674 | // If a name is 8 characters long, there is no NUL character at end. |
| 675 | StringRef Name(Section.Name, strnlen(Section.Name, sizeof(Section.Name))); |
| 676 | P.printString("Name", Name); |
| 677 | P.printNumber("Virtual Size", Section.VirtualSize); |
| 678 | P.printNumber("Virtual Address", Section.VirtualAddress); |
| 679 | P.printNumber("Size of Raw Data", Section.SizeOfRawData); |
| 680 | P.printNumber("File Pointer to Raw Data", Section.PointerToRawData); |
| 681 | P.printNumber("File Pointer to Relocations", Section.PointerToRelocations); |
| 682 | P.printNumber("File Pointer to Linenumbers", Section.PointerToLinenumbers); |
| 683 | P.printNumber("Number of Relocations", Section.NumberOfRelocations); |
| 684 | P.printNumber("Number of Linenumbers", Section.NumberOfLinenumbers); |
Rui Ueyama | 2c5384a | 2016-06-06 21:34:55 +0000 | [diff] [blame] | 685 | P.printFlags("Characteristics", Section.Characteristics, |
| 686 | getImageSectionCharacteristicNames()); |
Zachary Turner | d311739 | 2016-06-03 19:28:33 +0000 | [diff] [blame] | 687 | } |
| 688 | return Error::success(); |
| 689 | } |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 690 | |
| 691 | Error LLVMOutputStyle::dumpFpoStream() { |
| 692 | if (!opts::DumpFpo) |
| 693 | return Error::success(); |
| 694 | |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 695 | auto Dbi = File.getPDBDbiStream(); |
| 696 | if (!Dbi) |
| 697 | return Dbi.takeError(); |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 698 | |
| 699 | ListScope D(P, "New FPO"); |
Zachary Turner | a1657a9 | 2016-06-08 17:26:39 +0000 | [diff] [blame] | 700 | for (const object::FpoData &Fpo : Dbi->getFpoRecords()) { |
Rui Ueyama | ef2b488 | 2016-06-06 18:39:21 +0000 | [diff] [blame] | 701 | DictScope DD(P, ""); |
| 702 | P.printNumber("Offset", Fpo.Offset); |
| 703 | P.printNumber("Size", Fpo.Size); |
| 704 | P.printNumber("Number of locals", Fpo.NumLocals); |
| 705 | P.printNumber("Number of params", Fpo.NumParams); |
| 706 | P.printNumber("Size of Prolog", Fpo.getPrologSize()); |
| 707 | P.printNumber("Number of Saved Registers", Fpo.getNumSavedRegs()); |
| 708 | P.printBoolean("Has SEH", Fpo.hasSEH()); |
| 709 | P.printBoolean("Use BP", Fpo.useBP()); |
| 710 | P.printNumber("Frame Pointer", Fpo.getFP()); |
| 711 | } |
| 712 | return Error::success(); |
| 713 | } |
Zachary Turner | 7120a47 | 2016-06-06 20:37:05 +0000 | [diff] [blame] | 714 | void LLVMOutputStyle::flush() { P.flush(); } |