1 //===- BTFContext.h ---------------------------------------------*- C++ -*-===// 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 // BTFContext interface is used by llvm-objdump tool to print source 10 // code alongside disassembly. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_DEBUGINFO_BTF_BTFCONTEXT_H 15 #define LLVM_DEBUGINFO_BTF_BTFCONTEXT_H 16 17 #include "llvm/DebugInfo/BTF/BTFParser.h" 18 #include "llvm/DebugInfo/DIContext.h" 19 20 namespace llvm { 21 22 class BTFContext final : public DIContext { 23 BTFParser BTF; 24 25 public: BTFContext()26 BTFContext() : DIContext(CK_BTF) {} 27 dump(raw_ostream & OS,DIDumpOptions DumpOpts)28 void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override { 29 // This function is called from objdump when --dwarf=? option is set. 30 // BTF is no DWARF, so ignore this operation for now. 31 } 32 33 DILineInfo getLineInfoForAddress( 34 object::SectionedAddress Address, 35 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 36 37 DILineInfo 38 getLineInfoForDataAddress(object::SectionedAddress Address) override; 39 40 DILineInfoTable getLineInfoForAddressRange( 41 object::SectionedAddress Address, uint64_t Size, 42 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 43 44 DIInliningInfo getInliningInfoForAddress( 45 object::SectionedAddress Address, 46 DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override; 47 48 std::vector<DILocal> 49 getLocalsForAddress(object::SectionedAddress Address) override; 50 51 static std::unique_ptr<BTFContext> create( 52 const object::ObjectFile &Obj, 53 std::function<void(Error)> ErrorHandler = WithColor::defaultErrorHandler); 54 }; 55 56 } // end namespace llvm 57 58 #endif // LLVM_DEBUGINFO_BTF_BTFCONTEXT_H 59