1*0b57cec5SDimitry Andric //===- MinimalSymbolDumper.h ---------------------------------- *- C++ --*-===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric 9*0b57cec5SDimitry Andric #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 10*0b57cec5SDimitry Andric #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 11*0b57cec5SDimitry Andric 12*0b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h" 13*0b57cec5SDimitry Andric 14*0b57cec5SDimitry Andric namespace llvm { 15*0b57cec5SDimitry Andric namespace codeview { 16*0b57cec5SDimitry Andric class LazyRandomTypeCollection; 17*0b57cec5SDimitry Andric } 18*0b57cec5SDimitry Andric 19*0b57cec5SDimitry Andric namespace pdb { 20*0b57cec5SDimitry Andric class LinePrinter; 21*0b57cec5SDimitry Andric class SymbolGroup; 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks { 24*0b57cec5SDimitry Andric public: MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)25*0b57cec5SDimitry Andric MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 26*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids, 27*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types) 28*0b57cec5SDimitry Andric : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {} MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,const SymbolGroup & SymGroup,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)29*0b57cec5SDimitry Andric MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 30*0b57cec5SDimitry Andric const SymbolGroup &SymGroup, 31*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids, 32*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types) 33*0b57cec5SDimitry Andric : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup), Ids(Ids), 34*0b57cec5SDimitry Andric Types(Types) {} 35*0b57cec5SDimitry Andric 36*0b57cec5SDimitry Andric Error visitSymbolBegin(codeview::CVSymbol &Record) override; 37*0b57cec5SDimitry Andric Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override; 38*0b57cec5SDimitry Andric Error visitSymbolEnd(codeview::CVSymbol &Record) override; 39*0b57cec5SDimitry Andric setSymbolGroup(const SymbolGroup * Group)40*0b57cec5SDimitry Andric void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; } 41*0b57cec5SDimitry Andric 42*0b57cec5SDimitry Andric #define SYMBOL_RECORD(EnumName, EnumVal, Name) \ 43*0b57cec5SDimitry Andric virtual Error visitKnownRecord(codeview::CVSymbol &CVR, \ 44*0b57cec5SDimitry Andric codeview::Name &Record) override; 45*0b57cec5SDimitry Andric #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 46*0b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 47*0b57cec5SDimitry Andric 48*0b57cec5SDimitry Andric private: 49*0b57cec5SDimitry Andric std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const; 50*0b57cec5SDimitry Andric 51*0b57cec5SDimitry Andric std::string typeIndex(codeview::TypeIndex TI) const; 52*0b57cec5SDimitry Andric std::string idIndex(codeview::TypeIndex TI) const; 53*0b57cec5SDimitry Andric 54*0b57cec5SDimitry Andric LinePrinter &P; 55*0b57cec5SDimitry Andric 56*0b57cec5SDimitry Andric /// Dumping certain records requires knowing what machine this is. The 57*0b57cec5SDimitry Andric /// S_COMPILE3 record will tell us, but if we don't see one, default to X64. 58*0b57cec5SDimitry Andric codeview::CPUType CompilationCPU = codeview::CPUType::X64; 59*0b57cec5SDimitry Andric 60*0b57cec5SDimitry Andric bool RecordBytes; 61*0b57cec5SDimitry Andric const SymbolGroup *SymGroup = nullptr; 62*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids; 63*0b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types; 64*0b57cec5SDimitry Andric }; 65*0b57cec5SDimitry Andric } // namespace pdb 66*0b57cec5SDimitry Andric } // namespace llvm 67*0b57cec5SDimitry Andric 68*0b57cec5SDimitry Andric #endif 69