1 //===- MinimalSymbolDumper.h ---------------------------------- *- 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 #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 11 #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 12 13 #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h" 14 15 namespace llvm { 16 namespace codeview { 17 class LazyRandomTypeCollection; 18 } 19 20 namespace pdb { 21 class LinePrinter; 22 class SymbolGroup; 23 24 class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks { 25 public: MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)26 MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 27 codeview::LazyRandomTypeCollection &Ids, 28 codeview::LazyRandomTypeCollection &Types) 29 : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {} MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,const SymbolGroup & SymGroup,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)30 MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 31 const SymbolGroup &SymGroup, 32 codeview::LazyRandomTypeCollection &Ids, 33 codeview::LazyRandomTypeCollection &Types) 34 : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup), Ids(Ids), 35 Types(Types) {} 36 37 Error visitSymbolBegin(codeview::CVSymbol &Record) override; 38 Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override; 39 Error visitSymbolEnd(codeview::CVSymbol &Record) override; 40 setSymbolGroup(const SymbolGroup * Group)41 void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; } 42 43 #define SYMBOL_RECORD(EnumName, EnumVal, Name) \ 44 virtual Error visitKnownRecord(codeview::CVSymbol &CVR, \ 45 codeview::Name &Record) override; 46 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 47 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 48 49 private: 50 std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const; 51 52 std::string typeIndex(codeview::TypeIndex TI) const; 53 std::string idIndex(codeview::TypeIndex TI) const; 54 55 LinePrinter &P; 56 bool RecordBytes; 57 const SymbolGroup *SymGroup = nullptr; 58 codeview::LazyRandomTypeCollection &Ids; 59 codeview::LazyRandomTypeCollection &Types; 60 }; 61 } // namespace pdb 62 } // namespace llvm 63 64 #endif