#include "DumpOutputStyle.h"
#include "MinimalSymbolDumper.h"
#include "MinimalTypeDumper.h"
#include "StreamUtil.h"
#include "TypeReferenceTracker.h"
#include "llvm-pdbutil.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
#include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"
#include "llvm/DebugInfo/CodeView/Formatters.h"
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbackPipeline.h"
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
#include "llvm/DebugInfo/CodeView/TypeHashing.h"
#include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
#include "llvm/DebugInfo/PDB/Native/DbiStream.h"
#include "llvm/DebugInfo/PDB/Native/FormatUtil.h"
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/ISectionContribVisitor.h"
#include "llvm/DebugInfo/PDB/Native/InfoStream.h"
#include "llvm/DebugInfo/PDB/Native/InputFile.h"
#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/DebugInfo/PDB/Native/PublicsStream.h"
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"
#include "llvm/DebugInfo/PDB/Native/TpiHashing.h"
#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/FormatAdapters.h"
#include "llvm/Support/FormatVariadic.h"
#include <cctype>
usingnamespacellvm;
usingnamespacellvm::codeview;
usingnamespacellvm::msf;
usingnamespacellvm::pdb;
DumpOutputStyle::DumpOutputStyle(InputFile &File)
: … { … }
DumpOutputStyle::~DumpOutputStyle() { … }
PDBFile &DumpOutputStyle::getPdb() { … }
object::COFFObjectFile &DumpOutputStyle::getObj() { … }
void DumpOutputStyle::printStreamNotValidForObj() { … }
void DumpOutputStyle::printStreamNotPresent(StringRef StreamName) { … }
Error DumpOutputStyle::dump() { … }
static void printHeader(LinePrinter &P, const Twine &S) { … }
Error DumpOutputStyle::dumpFileSummary() { … }
static StatCollection getSymbolStats(const SymbolGroup &SG,
StatCollection &CumulativeStats) { … }
static StatCollection getChunkStats(const SymbolGroup &SG,
StatCollection &CumulativeStats) { … }
static inline std::string formatModuleDetailKind(DebugSubsectionKind K) { … }
static inline std::string formatModuleDetailKind(SymbolKind K) { … }
std::vector<StatCollection::KindAndStat>
StatCollection::getStatsSortedBySize() const { … }
template <typename Kind>
static void printModuleDetailStats(LinePrinter &P, StringRef Label,
const StatCollection &Stats) { … }
Error DumpOutputStyle::dumpStreamSummary() { … }
static Expected<std::pair<std::unique_ptr<MappedBlockStream>,
ArrayRef<llvm::object::coff_section>>>
loadSectionHeaders(PDBFile &File, DbgHeaderType Type) { … }
static Expected<std::vector<std::string>> getSectionNames(PDBFile &File) { … }
static void dumpSectionContrib(LinePrinter &P, const SectionContrib &SC,
ArrayRef<std::string> SectionNames,
uint32_t FieldWidth) { … }
static void dumpSectionContrib(LinePrinter &P, const SectionContrib2 &SC,
ArrayRef<std::string> SectionNames,
uint32_t FieldWidth) { … }
Error DumpOutputStyle::dumpModules() { … }
Error DumpOutputStyle::dumpModuleFiles() { … }
Error DumpOutputStyle::dumpSymbolStats() { … }
Error DumpOutputStyle::dumpTypeStats() { … }
static bool isValidNamespaceIdentifier(StringRef S) { … }
namespace {
constexpr uint32_t kNoneUdtKind = …;
constexpr uint32_t kSimpleUdtKind = …;
constexpr uint32_t kUnknownUdtKind = …;
}
static std::string getUdtStatLabel(uint32_t Kind) { … }
static uint32_t getLongestTypeLeafName(const StatCollection &Stats) { … }
Error DumpOutputStyle::dumpUdtStats() { … }
static void typesetLinesAndColumns(LinePrinter &P, uint32_t Start,
const LineColumnEntry &E) { … }
Error DumpOutputStyle::dumpLines() { … }
Error DumpOutputStyle::dumpInlineeLines() { … }
Error DumpOutputStyle::dumpXmi() { … }
Error DumpOutputStyle::dumpXme() { … }
std::string formatFrameType(object::frame_type FT) { … }
Error DumpOutputStyle::dumpOldFpo(PDBFile &File) { … }
Error DumpOutputStyle::dumpNewFpo(PDBFile &File) { … }
Error DumpOutputStyle::dumpFpo() { … }
Error DumpOutputStyle::dumpStringTableFromPdb() { … }
Error DumpOutputStyle::dumpStringTableFromObj() { … }
Error DumpOutputStyle::dumpNamedStreams() { … }
Error DumpOutputStyle::dumpStringTable() { … }
static void buildDepSet(LazyRandomTypeCollection &Types,
ArrayRef<TypeIndex> Indices,
std::map<TypeIndex, CVType> &DepSet) { … }
static void
dumpFullTypeStream(LinePrinter &Printer, LazyRandomTypeCollection &Types,
TypeReferenceTracker *RefTracker, uint32_t NumTypeRecords,
uint32_t NumHashBuckets,
FixedStreamArray<support::ulittle32_t> HashValues,
TpiStream *Stream, bool Bytes, bool Extras) { … }
static void dumpPartialTypeStream(LinePrinter &Printer,
LazyRandomTypeCollection &Types,
TypeReferenceTracker *RefTracker,
TpiStream &Stream, ArrayRef<TypeIndex> TiList,
bool Bytes, bool Extras, bool Deps) { … }
Error DumpOutputStyle::dumpTypesFromObjectFile() { … }
Error DumpOutputStyle::dumpTpiStream(uint32_t StreamIdx) { … }
Error DumpOutputStyle::dumpModuleSymsForObj() { … }
Error DumpOutputStyle::dumpModuleSymsForPdb() { … }
Error DumpOutputStyle::dumpTypeRefStats() { … }
Error DumpOutputStyle::dumpGSIRecords() { … }
Error DumpOutputStyle::dumpGlobals() { … }
Error DumpOutputStyle::dumpPublics() { … }
Error DumpOutputStyle::dumpSymbolsFromGSI(const GSIHashTable &Table,
bool HashExtras) { … }
static std::string formatSegMapDescriptorFlag(uint32_t IndentLevel,
OMFSegDescFlags Flags) { … }
Error DumpOutputStyle::dumpSectionHeaders() { … }
void DumpOutputStyle::dumpSectionHeaders(StringRef Label, DbgHeaderType Type) { … }
Error DumpOutputStyle::dumpSectionContribs() { … }
Error DumpOutputStyle::dumpSectionMap() { … }