Path: blob/main/contrib/llvm-project/llvm/tools/llvm-pdbutil/DumpOutputStyle.h
35260 views
//===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H9#define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H1011#include "OutputStyle.h"12#include "StreamUtil.h"1314#include "llvm/ADT/DenseMap.h"15#include "llvm/ADT/SmallVector.h"16#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"17#include "llvm/DebugInfo/PDB/Native/RawConstants.h"1819namespace llvm {20namespace object {21class COFFObjectFile;22}2324namespace pdb {25class GSIHashTable;26class InputFile;27class TypeReferenceTracker;2829struct StatCollection {30struct Stat {31Stat() {}32Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}33uint32_t Count = 0;34uint32_t Size = 0;3536void update(uint32_t RecordSize) {37++Count;38Size += RecordSize;39}40};4142using KindAndStat = std::pair<uint32_t, Stat>;4344void update(uint32_t Kind, uint32_t RecordSize) {45Totals.update(RecordSize);46auto Iter = Individual.try_emplace(Kind, 1, RecordSize);47if (!Iter.second)48Iter.first->second.update(RecordSize);49}50Stat Totals;51DenseMap<uint32_t, Stat> Individual;5253std::vector<KindAndStat> getStatsSortedBySize() const;54};5556class DumpOutputStyle : public OutputStyle {5758public:59DumpOutputStyle(InputFile &File);60~DumpOutputStyle() override;6162Error dump() override;6364private:65PDBFile &getPdb();66object::COFFObjectFile &getObj();6768void printStreamNotValidForObj();69void printStreamNotPresent(StringRef StreamName);7071Error dumpFileSummary();72Error dumpStreamSummary();73Error dumpSymbolStats();74Error dumpUdtStats();75Error dumpTypeStats();76Error dumpNamedStreams();77Error dumpStringTable();78Error dumpStringTableFromPdb();79Error dumpStringTableFromObj();80Error dumpLines();81Error dumpInlineeLines();82Error dumpXmi();83Error dumpXme();84Error dumpFpo();85Error dumpOldFpo(PDBFile &File);86Error dumpNewFpo(PDBFile &File);87Error dumpTpiStream(uint32_t StreamIdx);88Error dumpTypesFromObjectFile();89Error dumpTypeRefStats();90Error dumpModules();91Error dumpModuleFiles();92Error dumpModuleSymsForPdb();93Error dumpModuleSymsForObj();94Error dumpGSIRecords();95Error dumpGlobals();96Error dumpPublics();97Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);98Error dumpSectionHeaders();99Error dumpSectionContribs();100Error dumpSectionMap();101102void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);103104InputFile &File;105std::unique_ptr<TypeReferenceTracker> RefTracker;106LinePrinter P;107SmallVector<StreamInfo, 32> StreamPurposes;108};109} // namespace pdb110} // namespace llvm111112#endif113114115