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 70 71 72 73 74 75 76 77 78 79 80 81 82 83
  
     | 
    
      //===-- DWARFContext.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
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H
#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFCONTEXT_H
#include "DWARFDataExtractor.h"
#include "lldb/Core/Section.h"
#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Support/Threading.h"
#include <memory>
namespace lldb_private {
class DWARFContext {
private:
  SectionList *m_main_section_list;
  SectionList *m_dwo_section_list;
  mutable std::unique_ptr<llvm::DWARFContext> m_llvm_context;
  struct SectionData {
    llvm::once_flag flag;
    DWARFDataExtractor data;
  };
  SectionData m_data_debug_abbrev;
  SectionData m_data_debug_addr;
  SectionData m_data_debug_aranges;
  SectionData m_data_debug_cu_index;
  SectionData m_data_debug_info;
  SectionData m_data_debug_line;
  SectionData m_data_debug_line_str;
  SectionData m_data_debug_loc;
  SectionData m_data_debug_loclists;
  SectionData m_data_debug_macro;
  SectionData m_data_debug_ranges;
  SectionData m_data_debug_rnglists;
  SectionData m_data_debug_str;
  SectionData m_data_debug_str_offsets;
  SectionData m_data_debug_tu_index;
  SectionData m_data_debug_types;
  const DWARFDataExtractor &
  LoadOrGetSection(llvm::Optional<lldb::SectionType> main_section_type,
                   llvm::Optional<lldb::SectionType> dwo_section_type,
                   SectionData &data);
  const DWARFDataExtractor &getOrLoadCuIndexData();
  const DWARFDataExtractor &getOrLoadTuIndexData();
public:
  explicit DWARFContext(SectionList *main_section_list,
                        SectionList *dwo_section_list)
      : m_main_section_list(main_section_list),
        m_dwo_section_list(dwo_section_list) {}
  const DWARFDataExtractor &getOrLoadAbbrevData();
  const DWARFDataExtractor &getOrLoadAddrData();
  const DWARFDataExtractor &getOrLoadArangesData();
  const DWARFDataExtractor &getOrLoadDebugInfoData();
  const DWARFDataExtractor &getOrLoadLineData();
  const DWARFDataExtractor &getOrLoadLineStrData();
  const DWARFDataExtractor &getOrLoadLocData();
  const DWARFDataExtractor &getOrLoadLocListsData();
  const DWARFDataExtractor &getOrLoadMacroData();
  const DWARFDataExtractor &getOrLoadRangesData();
  const DWARFDataExtractor &getOrLoadRngListsData();
  const DWARFDataExtractor &getOrLoadStrData();
  const DWARFDataExtractor &getOrLoadStrOffsetsData();
  const DWARFDataExtractor &getOrLoadDebugTypesData();
  bool isDwo() { return m_dwo_section_list != nullptr; }
  llvm::DWARFContext &GetAsLLVM();
};
} // namespace lldb_private
#endif
 
     |