LLDB mainline
DebugNamesDWARFIndex.h
Go to the documentation of this file.
1//===-- DebugNamesDWARFIndex.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#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
11
17#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
18#include <optional>
19
20namespace lldb_private {
22public:
23 static llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>>
24 Create(Module &module, DWARFDataExtractor debug_names,
26
27 void Preload() override { m_fallback.Preload(); }
28
29 void
31 llvm::function_ref<bool(DWARFDIE die)> callback) override;
32 void
34 llvm::function_ref<bool(DWARFDIE die)> callback) override;
35 void
37 llvm::function_ref<bool(DWARFDIE die)> callback) override;
38 void
40 llvm::function_ref<bool(DWARFDIE die)> callback) override {}
42 ConstString class_name, bool must_be_implementation,
43 llvm::function_ref<bool(DWARFDIE die)> callback) override;
44 void GetTypes(ConstString name,
45 llvm::function_ref<bool(DWARFDIE die)> callback) override;
46 void GetTypes(const DWARFDeclContext &context,
47 llvm::function_ref<bool(DWARFDIE die)> callback) override;
48 void GetNamespaces(ConstString name,
49 llvm::function_ref<bool(DWARFDIE die)> callback) override;
50 void GetFunctions(const Module::LookupInfo &lookup_info,
52 const CompilerDeclContext &parent_decl_ctx,
53 llvm::function_ref<bool(DWARFDIE die)> callback) override;
54 void GetFunctions(const RegularExpression &regex,
55 llvm::function_ref<bool(DWARFDIE die)> callback) override;
56
57 void Dump(Stream &s) override;
58
59private:
61 std::unique_ptr<llvm::DWARFDebugNames> debug_names_up,
62 DWARFDataExtractor debug_names_data,
63 DWARFDataExtractor debug_str_data,
66 m_debug_names_data(debug_names_data), m_debug_str_data(debug_str_data),
67 m_debug_names_up(std::move(debug_names_up)),
69
71
72 // LLVM DWARFDebugNames will hold a non-owning reference to this data, so keep
73 // track of the ownership here.
76
77 using DebugNames = llvm::DWARFDebugNames;
78 std::unique_ptr<DebugNames> m_debug_names_up;
80
81 std::optional<DIERef> ToDIERef(const DebugNames::Entry &entry);
82 bool ProcessEntry(const DebugNames::Entry &entry,
83 llvm::function_ref<bool(DWARFDIE die)> callback,
84 llvm::StringRef name);
85
86 static void MaybeLogLookupError(llvm::Error error,
87 const DebugNames::NameIndex &ni,
88 llvm::StringRef name);
89
90 static llvm::DenseSet<dw_offset_t> GetUnits(const DebugNames &debug_names);
91};
92
93} // namespace lldb_private
94
95#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DEBUGNAMESDWARFINDEX_H
static llvm::raw_ostream & error(Stream &strm)
Represents a generic declaration context in a program.
A uniqued constant string class.
Definition: ConstString.h:39
static llvm::Expected< std::unique_ptr< DebugNamesDWARFIndex > > Create(Module &module, DWARFDataExtractor debug_names, DWARFDataExtractor debug_str, SymbolFileDWARF &dwarf)
static void MaybeLogLookupError(llvm::Error error, const DebugNames::NameIndex &ni, llvm::StringRef name)
std::optional< DIERef > ToDIERef(const DebugNames::Entry &entry)
void GetTypes(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetNamespaces(ConstString name, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetGlobalVariables(ConstString basename, llvm::function_ref< bool(DWARFDIE die)> callback) override
Finds global variables with the given base name.
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation, llvm::function_ref< bool(DWARFDIE die)> callback) override
void GetFunctions(const Module::LookupInfo &lookup_info, SymbolFileDWARF &dwarf, const CompilerDeclContext &parent_decl_ctx, llvm::function_ref< bool(DWARFDIE die)> callback) override
bool ProcessEntry(const DebugNames::Entry &entry, llvm::function_ref< bool(DWARFDIE die)> callback, llvm::StringRef name)
static llvm::DenseSet< dw_offset_t > GetUnits(const DebugNames &debug_names)
std::unique_ptr< DebugNames > m_debug_names_up
DebugNamesDWARFIndex(Module &module, std::unique_ptr< llvm::DWARFDebugNames > debug_names_up, DWARFDataExtractor debug_names_data, DWARFDataExtractor debug_str_data, SymbolFileDWARF &dwarf)
A class that encapsulates name lookup information.
Definition: Module.h:950
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:88
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
A class that represents a running process on the host machine.