1//===-- GsymContext.h --------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===/
8
9#ifndef LLVM_DEBUGINFO_GSYM_GSYMCONTEXT_H
10#define LLVM_DEBUGINFO_GSYM_GSYMCONTEXT_H
11
12#include "llvm/DebugInfo/DIContext.h"
13#include <cstdint>
14#include <memory>
15
16namespace llvm {
17
18namespace gsym {
19
20class GsymReader;
21
22/// GSYM DI Context
23/// This data structure is the top level entity that deals with GSYM
24/// symbolication.
25/// This data structure exists only when there is a need for a transparent
26/// interface to different symbolication formats (e.g. GSYM, PDB and DWARF).
27/// More control and power over the debug information access can be had by using
28/// the GSYM interfaces directly.
29class GsymContext : public DIContext {
30public:
31 GsymContext(std::unique_ptr<GsymReader> Reader);
32 ~GsymContext() override;
33
34 GsymContext(GsymContext &) = delete;
35 GsymContext &operator=(GsymContext &) = delete;
36
37 static bool classof(const DIContext *DICtx) {
38 return DICtx->getKind() == CK_GSYM;
39 }
40
41 void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override;
42
43 std::optional<DILineInfo> getLineInfoForAddress(
44 object::SectionedAddress Address,
45 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
46 std::optional<DILineInfo>
47 getLineInfoForDataAddress(object::SectionedAddress Address) override;
48 DILineInfoTable getLineInfoForAddressRange(
49 object::SectionedAddress Address, uint64_t Size,
50 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
51 DIInliningInfo getInliningInfoForAddress(
52 object::SectionedAddress Address,
53 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
54
55 std::vector<DILocal>
56 getLocalsForAddress(object::SectionedAddress Address) override;
57
58private:
59 const std::unique_ptr<GsymReader> Reader;
60};
61
62} // end namespace gsym
63
64} // end namespace llvm
65
66#endif // LLVM_DEBUGINFO_GSYM_GSYMCONTEXT_H
67