86 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H11 12#include "DWARFDataExtractor.h"13#include "lldb/Core/Section.h"14#include "llvm/DebugInfo/DWARF/DWARFContext.h"15#include "llvm/Support/Threading.h"16#include <memory>17#include <optional>18 19namespace lldb_private::plugin {20namespace dwarf {21class DWARFContext {22private:23 SectionList *m_main_section_list;24 SectionList *m_dwo_section_list;25 mutable std::unique_ptr<llvm::DWARFContext> m_llvm_context;26 27 struct SectionData {28 llvm::once_flag flag;29 DWARFDataExtractor data;30 };31 32 SectionData m_data_debug_abbrev;33 SectionData m_data_debug_addr;34 SectionData m_data_debug_aranges;35 SectionData m_data_debug_cu_index;36 SectionData m_data_debug_info;37 SectionData m_data_debug_line;38 SectionData m_data_debug_line_str;39 SectionData m_data_debug_loc;40 SectionData m_data_debug_loclists;41 SectionData m_data_debug_macro;42 SectionData m_data_debug_ranges;43 SectionData m_data_debug_rnglists;44 SectionData m_data_debug_str;45 SectionData m_data_debug_str_offsets;46 SectionData m_data_debug_tu_index;47 SectionData m_data_debug_types;48 49 const DWARFDataExtractor &50 LoadOrGetSection(std::optional<lldb::SectionType> main_section_type,51 std::optional<lldb::SectionType> dwo_section_type,52 SectionData &data);53 54 const DWARFDataExtractor &getOrLoadCuIndexData();55 const DWARFDataExtractor &getOrLoadTuIndexData();56 57public:58 explicit DWARFContext(SectionList *main_section_list,59 SectionList *dwo_section_list)60 : m_main_section_list(main_section_list),61 m_dwo_section_list(dwo_section_list) {}62 63 const DWARFDataExtractor &getOrLoadAbbrevData();64 const DWARFDataExtractor &getOrLoadAddrData();65 const DWARFDataExtractor &getOrLoadArangesData();66 const DWARFDataExtractor &getOrLoadDebugInfoData();67 const DWARFDataExtractor &getOrLoadLineData();68 const DWARFDataExtractor &getOrLoadLineStrData();69 const DWARFDataExtractor &getOrLoadLocData();70 const DWARFDataExtractor &getOrLoadLocListsData();71 const DWARFDataExtractor &getOrLoadMacroData();72 const DWARFDataExtractor &getOrLoadRangesData();73 const DWARFDataExtractor &getOrLoadRngListsData();74 const DWARFDataExtractor &getOrLoadStrData();75 const DWARFDataExtractor &getOrLoadStrOffsetsData();76 const DWARFDataExtractor &getOrLoadDebugTypesData();77 78 bool isDwo() { return m_dwo_section_list != nullptr; }79 80 llvm::DWARFContext &GetAsLLVM();81};82} // namespace dwarf83} // namespace lldb_private::plugin84 85#endif86