1 //===-- PDBContext.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_DEBUGINFO_PDB_PDBCONTEXT_H 11 #define LLVM_DEBUGINFO_PDB_PDBCONTEXT_H 12 13 #include "llvm/DebugInfo/DIContext.h" 14 #include "llvm/DebugInfo/PDB/IPDBSession.h" 15 16 namespace llvm { 17 18 namespace object { 19 class COFFObjectFile; 20 } 21 22 /// PDBContext 23 /// This data structure is the top level entity that deals with PDB debug 24 /// information parsing. This data structure exists only when there is a 25 /// need for a transparent interface to different debug information formats 26 /// (e.g. PDB and DWARF). More control and power over the debug information 27 /// access can be had by using the PDB interfaces directly. 28 class PDBContext : public DIContext { 29 30 PDBContext(PDBContext &) = delete; 31 PDBContext &operator=(PDBContext &) = delete; 32 33 public: 34 PDBContext(const object::COFFObjectFile &Object, 35 std::unique_ptr<IPDBSession> PDBSession); 36 classof(const DIContext * DICtx)37 static bool classof(const DIContext *DICtx) { 38 return DICtx->getKind() == CK_PDB; 39 } 40 41 void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override; 42 43 DILineInfo getLineInfoForAddress( 44 uint64_t Address, 45 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 46 DILineInfoTable getLineInfoForAddressRange( 47 uint64_t Address, uint64_t Size, 48 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 49 DIInliningInfo getInliningInfoForAddress( 50 uint64_t Address, 51 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 52 53 private: 54 std::string getFunctionName(uint64_t Address, DINameKind NameKind) const; 55 std::unique_ptr<IPDBSession> Session; 56 }; 57 } 58 59 #endif 60