1 //===- DIASession.h - DIA implementation of IPDBSession ---------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
10 #define LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
12 #include "DIASupport.h"
13 #include "llvm/DebugInfo/PDB/IPDBSession.h"
14 #include "llvm/Support/Error.h"
16 #include <system_error>
22 class DIASession
: public IPDBSession
{
24 explicit DIASession(CComPtr
<IDiaSession
> DiaSession
);
26 static Error
createFromPdb(StringRef Path
,
27 std::unique_ptr
<IPDBSession
> &Session
);
28 static Error
createFromExe(StringRef Path
,
29 std::unique_ptr
<IPDBSession
> &Session
);
31 uint64_t getLoadAddress() const override
;
32 bool setLoadAddress(uint64_t Address
) override
;
33 std::unique_ptr
<PDBSymbolExe
> getGlobalScope() override
;
34 std::unique_ptr
<PDBSymbol
> getSymbolById(SymIndexId SymbolId
) const override
;
36 bool addressForVA(uint64_t VA
, uint32_t &Section
,
37 uint32_t &Offset
) const override
;
38 bool addressForRVA(uint32_t RVA
, uint32_t &Section
,
39 uint32_t &Offset
) const override
;
41 std::unique_ptr
<PDBSymbol
>
42 findSymbolByAddress(uint64_t Address
, PDB_SymType Type
) const override
;
43 std::unique_ptr
<PDBSymbol
> findSymbolByRVA(uint32_t RVA
,
44 PDB_SymType Type
) const override
;
45 std::unique_ptr
<PDBSymbol
>
46 findSymbolBySectOffset(uint32_t Section
, uint32_t Offset
,
47 PDB_SymType Type
) const override
;
49 std::unique_ptr
<IPDBEnumLineNumbers
>
50 findLineNumbers(const PDBSymbolCompiland
&Compiland
,
51 const IPDBSourceFile
&File
) const override
;
52 std::unique_ptr
<IPDBEnumLineNumbers
>
53 findLineNumbersByAddress(uint64_t Address
, uint32_t Length
) const override
;
54 std::unique_ptr
<IPDBEnumLineNumbers
>
55 findLineNumbersByRVA(uint32_t RVA
, uint32_t Length
) const override
;
56 std::unique_ptr
<IPDBEnumLineNumbers
>
57 findLineNumbersBySectOffset(uint32_t Section
, uint32_t Offset
,
58 uint32_t Length
) const override
;
60 std::unique_ptr
<IPDBEnumSourceFiles
>
61 findSourceFiles(const PDBSymbolCompiland
*Compiland
, llvm::StringRef Pattern
,
62 PDB_NameSearchFlags Flags
) const override
;
63 std::unique_ptr
<IPDBSourceFile
>
64 findOneSourceFile(const PDBSymbolCompiland
*Compiland
,
65 llvm::StringRef Pattern
,
66 PDB_NameSearchFlags Flags
) const override
;
67 std::unique_ptr
<IPDBEnumChildren
<PDBSymbolCompiland
>>
68 findCompilandsForSourceFile(llvm::StringRef Pattern
,
69 PDB_NameSearchFlags Flags
) const override
;
70 std::unique_ptr
<PDBSymbolCompiland
>
71 findOneCompilandForSourceFile(llvm::StringRef Pattern
,
72 PDB_NameSearchFlags Flags
) const override
;
73 std::unique_ptr
<IPDBEnumSourceFiles
> getAllSourceFiles() const override
;
74 std::unique_ptr
<IPDBEnumSourceFiles
> getSourceFilesForCompiland(
75 const PDBSymbolCompiland
&Compiland
) const override
;
76 std::unique_ptr
<IPDBSourceFile
>
77 getSourceFileById(uint32_t FileId
) const override
;
79 std::unique_ptr
<IPDBEnumDataStreams
> getDebugStreams() const override
;
81 std::unique_ptr
<IPDBEnumTables
> getEnumTables() const override
;
83 std::unique_ptr
<IPDBEnumInjectedSources
> getInjectedSources() const override
;
85 std::unique_ptr
<IPDBEnumSectionContribs
> getSectionContribs() const override
;
87 std::unique_ptr
<IPDBEnumFrameData
> getFrameData() const override
;
89 CComPtr
<IDiaSession
> Session
;