10b57cec5SDimitry Andric //===- MinimalSymbolDumper.h ---------------------------------- *- C++ --*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 100b57cec5SDimitry Andric #define LLVM_TOOLS_LLVMPDBUTIL_MINIMAL_SYMBOL_DUMPER_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h" 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric namespace llvm { 150b57cec5SDimitry Andric namespace codeview { 160b57cec5SDimitry Andric class LazyRandomTypeCollection; 170b57cec5SDimitry Andric } 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric namespace pdb { 200b57cec5SDimitry Andric class LinePrinter; 210b57cec5SDimitry Andric class SymbolGroup; 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric class MinimalSymbolDumper : public codeview::SymbolVisitorCallbacks { 240b57cec5SDimitry Andric public: MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)250b57cec5SDimitry Andric MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 260b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids, 270b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types) 280b57cec5SDimitry Andric : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {} MinimalSymbolDumper(LinePrinter & P,bool RecordBytes,const SymbolGroup & SymGroup,codeview::LazyRandomTypeCollection & Ids,codeview::LazyRandomTypeCollection & Types)290b57cec5SDimitry Andric MinimalSymbolDumper(LinePrinter &P, bool RecordBytes, 300b57cec5SDimitry Andric const SymbolGroup &SymGroup, 310b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids, 320b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types) 330b57cec5SDimitry Andric : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup), Ids(Ids), 340b57cec5SDimitry Andric Types(Types) {} 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric Error visitSymbolBegin(codeview::CVSymbol &Record) override; 370b57cec5SDimitry Andric Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t Offset) override; 380b57cec5SDimitry Andric Error visitSymbolEnd(codeview::CVSymbol &Record) override; 390b57cec5SDimitry Andric setSymbolGroup(const SymbolGroup * Group)400b57cec5SDimitry Andric void setSymbolGroup(const SymbolGroup *Group) { SymGroup = Group; } 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric #define SYMBOL_RECORD(EnumName, EnumVal, Name) \ 430b57cec5SDimitry Andric virtual Error visitKnownRecord(codeview::CVSymbol &CVR, \ 440b57cec5SDimitry Andric codeview::Name &Record) override; 450b57cec5SDimitry Andric #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 460b57cec5SDimitry Andric #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric private: 490b57cec5SDimitry Andric std::string typeOrIdIndex(codeview::TypeIndex TI, bool IsType) const; 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric std::string typeIndex(codeview::TypeIndex TI) const; 520b57cec5SDimitry Andric std::string idIndex(codeview::TypeIndex TI) const; 530b57cec5SDimitry Andric 540b57cec5SDimitry Andric LinePrinter &P; 550b57cec5SDimitry Andric 560b57cec5SDimitry Andric /// Dumping certain records requires knowing what machine this is. The 570b57cec5SDimitry Andric /// S_COMPILE3 record will tell us, but if we don't see one, default to X64. 580b57cec5SDimitry Andric codeview::CPUType CompilationCPU = codeview::CPUType::X64; 590b57cec5SDimitry Andric 600b57cec5SDimitry Andric bool RecordBytes; 610b57cec5SDimitry Andric const SymbolGroup *SymGroup = nullptr; 620b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Ids; 630b57cec5SDimitry Andric codeview::LazyRandomTypeCollection &Types; 640b57cec5SDimitry Andric }; 650b57cec5SDimitry Andric } // namespace pdb 660b57cec5SDimitry Andric } // namespace llvm 670b57cec5SDimitry Andric 680b57cec5SDimitry Andric #endif 69