summaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm18/include/llvm/DebugInfo/BTF/BTFContext.h
blob: 46132b74bc073b6861d1dd97e8a4a7d4daf4e80f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===- BTFContext.h ---------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// BTFContext interface is used by llvm-objdump tool to print source
// code alongside disassembly.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEBUGINFO_BTF_BTFCONTEXT_H
#define LLVM_DEBUGINFO_BTF_BTFCONTEXT_H

#include "llvm/DebugInfo/BTF/BTFParser.h"
#include "llvm/DebugInfo/DIContext.h"

namespace llvm {

class BTFContext final : public DIContext {
  BTFParser BTF;

public:
  BTFContext() : DIContext(CK_BTF) {}

  void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override {
    // This function is called from objdump when --dwarf=? option is set.
    // BTF is no DWARF, so ignore this operation for now.
  }

  DILineInfo getLineInfoForAddress(
      object::SectionedAddress Address,
      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;

  DILineInfo
  getLineInfoForDataAddress(object::SectionedAddress Address) override;

  DILineInfoTable getLineInfoForAddressRange(
      object::SectionedAddress Address, uint64_t Size,
      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;

  DIInliningInfo getInliningInfoForAddress(
      object::SectionedAddress Address,
      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;

  std::vector<DILocal>
  getLocalsForAddress(object::SectionedAddress Address) override;

  static std::unique_ptr<BTFContext> create(
      const object::ObjectFile &Obj,
      std::function<void(Error)> ErrorHandler = WithColor::defaultErrorHandler);
};

} // end namespace llvm

#endif // LLVM_DEBUGINFO_BTF_BTFCONTEXT_H

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif