]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / source / Plugins / SymbolFile / DWARF / DWARFContext.h
1 //===-- DWARFContext.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_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H
10 #define LLDB_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H
11
12 #include "DWARFDataExtractor.h"
13 #include "lldb/Core/Section.h"
14 #include "llvm/ADT/Optional.h"
15 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
16 #include "llvm/Support/Threading.h"
17 #include <memory>
18
19 namespace lldb_private {
20 class DWARFContext {
21 private:
22   SectionList *m_main_section_list;
23   SectionList *m_dwo_section_list;
24   mutable std::unique_ptr<llvm::DWARFContext> m_llvm_context;
25
26   struct SectionData {
27     llvm::once_flag flag;
28     DWARFDataExtractor data;
29   };
30
31   SectionData m_data_debug_abbrev;
32   SectionData m_data_debug_addr;
33   SectionData m_data_debug_aranges;
34   SectionData m_data_debug_info;
35   SectionData m_data_debug_line;
36   SectionData m_data_debug_line_str;
37   SectionData m_data_debug_macro;
38   SectionData m_data_debug_ranges;
39   SectionData m_data_debug_rnglists;
40   SectionData m_data_debug_str;
41   SectionData m_data_debug_str_offsets;
42   SectionData m_data_debug_types;
43
44   bool isDwo() { return m_dwo_section_list != nullptr; }
45
46   const DWARFDataExtractor &
47   LoadOrGetSection(lldb::SectionType main_section_type,
48                    llvm::Optional<lldb::SectionType> dwo_section_type,
49                    SectionData &data);
50
51 public:
52   explicit DWARFContext(SectionList *main_section_list,
53                         SectionList *dwo_section_list)
54       : m_main_section_list(main_section_list),
55         m_dwo_section_list(dwo_section_list) {}
56
57   const DWARFDataExtractor &getOrLoadAbbrevData();
58   const DWARFDataExtractor &getOrLoadAddrData();
59   const DWARFDataExtractor &getOrLoadArangesData();
60   const DWARFDataExtractor &getOrLoadDebugInfoData();
61   const DWARFDataExtractor &getOrLoadLineData();
62   const DWARFDataExtractor &getOrLoadLineStrData();
63   const DWARFDataExtractor &getOrLoadMacroData();
64   const DWARFDataExtractor &getOrLoadRangesData();
65   const DWARFDataExtractor &getOrLoadRngListsData();
66   const DWARFDataExtractor &getOrLoadStrData();
67   const DWARFDataExtractor &getOrLoadStrOffsetsData();
68   const DWARFDataExtractor &getOrLoadDebugTypesData();
69
70   llvm::DWARFContext &GetAsLLVM();
71 };
72 } // namespace lldb_private
73
74 #endif