Path: blob/main/contrib/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
39645 views
//===-- DWARFDebugInfo.h ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H9#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H1011#include <map>12#include <vector>1314#include "DWARFDIE.h"15#include "DWARFTypeUnit.h"16#include "DWARFUnit.h"17#include "SymbolFileDWARF.h"18#include "lldb/lldb-private.h"19#include "llvm/Support/Error.h"2021namespace lldb_private::plugin {22namespace dwarf {23class DWARFContext;2425class DWARFDebugInfo {26public:27typedef dw_offset_t (*Callback)(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,28DWARFDebugInfoEntry *die,29const dw_offset_t next_offset,30const uint32_t depth, void *userData);3132explicit DWARFDebugInfo(SymbolFileDWARF &dwarf, DWARFContext &context);3334size_t GetNumUnits();35DWARFUnit *GetUnitAtIndex(size_t idx);36DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset,37uint32_t *idx_ptr = nullptr);38DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,39dw_offset_t die_offset);40DWARFUnit *GetSkeletonUnit(DWARFUnit *dwo_unit);41DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);42bool ContainsTypeUnits();43DWARFDIE GetDIE(DIERef::Section section, dw_offset_t die_offset);4445enum {46eDumpFlag_Verbose = (1 << 0), // Verbose dumping47eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type48eDumpFlag_ShowAncestors =49(1 << 2) // Show all parent DIEs when dumping single DIEs50};5152const DWARFDebugAranges &GetCompileUnitAranges();5354const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();5556protected:57typedef std::vector<DWARFUnitSP> UnitColl;5859SymbolFileDWARF &m_dwarf;60DWARFContext &m_context;6162llvm::once_flag m_units_once_flag;63UnitColl m_units;6465std::unique_ptr<DWARFDebugAranges>66m_cu_aranges_up; // A quick address to compile unit table6768std::vector<std::pair<uint64_t, uint32_t>> m_type_hash_to_unit_index;69llvm::DenseMap<uint64_t, DWARFUnit *> m_dwarf5_dwo_id_to_skeleton_unit;70llvm::DenseMap<uint64_t, DWARFUnit *> m_dwarf4_dwo_id_to_skeleton_unit;71llvm::once_flag m_dwarf4_dwo_id_to_skeleton_unit_once_flag;7273private:74// All parsing needs to be done partially any managed by this class as75// accessors are called.76void ParseUnitHeadersIfNeeded();7778void ParseUnitsFor(DIERef::Section section);7980uint32_t FindUnitIndex(DIERef::Section section, dw_offset_t offset);8182DWARFDebugInfo(const DWARFDebugInfo &) = delete;83const DWARFDebugInfo &operator=(const DWARFDebugInfo &) = delete;84};85} // namespace dwarf86} // namespace lldb_private::plugin8788#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H899091