LLDB mainline
DWARFDebugInfo.h
Go to the documentation of this file.
1//===-- DWARFDebugInfo.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_DWARFDEBUGINFO_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H
11
12#include <map>
13#include <vector>
14
15#include "DWARFDIE.h"
16#include "DWARFTypeUnit.h"
17#include "DWARFUnit.h"
18#include "SymbolFileDWARF.h"
19#include "lldb/lldb-private.h"
20#include "llvm/Support/Error.h"
21
22namespace lldb_private::plugin {
23namespace dwarf {
24class DWARFContext;
25
27public:
28 typedef dw_offset_t (*Callback)(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
30 const dw_offset_t next_offset,
31 const uint32_t depth, void *userData);
32
34
35 size_t GetNumUnits();
36 DWARFUnit *GetUnitAtIndex(size_t idx);
38 uint32_t *idx_ptr = nullptr);
40 dw_offset_t die_offset);
41 DWARFUnit *GetUnit(const DIERef &die_ref);
43 DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
44 bool ContainsTypeUnits();
45 DWARFDIE GetDIE(const DIERef &die_ref);
46
47 /// Returns the AT_Name of this DIE, if it exists, without parsing the entire
48 /// compile unit. An empty is string is returned upon error or if the
49 /// attribute is not present.
50 llvm::StringRef PeekDIEName(const DIERef &die_ref);
51
52 enum {
53 eDumpFlag_Verbose = (1 << 0), // Verbose dumping
54 eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
56 (1 << 2) // Show all parent DIEs when dumping single DIEs
57 };
58
60
61protected:
62 typedef std::vector<DWARFUnitSP> UnitColl;
63
66
67 llvm::once_flag m_units_once_flag;
69
70 std::unique_ptr<DWARFDebugAranges>
71 m_cu_aranges_up; // A quick address to compile unit table
72
73 std::vector<std::pair<uint64_t, uint32_t>> m_type_hash_to_unit_index;
74 llvm::DenseMap<uint64_t, DWARFUnit *> m_dwarf5_dwo_id_to_skeleton_unit;
75 llvm::DenseMap<uint64_t, DWARFUnit *> m_dwarf4_dwo_id_to_skeleton_unit;
77
78private:
79 // All parsing needs to be done partially any managed by this class as
80 // accessors are called.
82
83 void ParseUnitsFor(DIERef::Section section);
84
85 uint32_t FindUnitIndex(DIERef::Section section, dw_offset_t offset);
86
87 DWARFDebugInfo(const DWARFDebugInfo &) = delete;
88 const DWARFDebugInfo &operator=(const DWARFDebugInfo &) = delete;
89};
90} // namespace dwarf
91} // namespace lldb_private::plugin
92
93#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H
Identifies a DWARF debug info entry within a given Module.
Definition: DIERef.h:30
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
DWARFTypeUnit * GetTypeUnitForHash(uint64_t hash)
DWARFUnit * GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, uint32_t *idx_ptr=nullptr)
llvm::StringRef PeekDIEName(const DIERef &die_ref)
Returns the AT_Name of this DIE, if it exists, without parsing the entire compile unit.
uint32_t FindUnitIndex(DIERef::Section section, dw_offset_t offset)
const DWARFDebugAranges & GetCompileUnitAranges()
void ParseUnitsFor(DIERef::Section section)
llvm::DenseMap< uint64_t, DWARFUnit * > m_dwarf4_dwo_id_to_skeleton_unit
llvm::DenseMap< uint64_t, DWARFUnit * > m_dwarf5_dwo_id_to_skeleton_unit
std::vector< std::pair< uint64_t, uint32_t > > m_type_hash_to_unit_index
const DWARFDebugInfo & operator=(const DWARFDebugInfo &)=delete
DWARFDIE GetDIE(const DIERef &die_ref)
std::unique_ptr< DWARFDebugAranges > m_cu_aranges_up
DWARFUnit * GetUnitContainingDIEOffset(DIERef::Section section, dw_offset_t die_offset)
dw_offset_t(* Callback)(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, DWARFDebugInfoEntry *die, const dw_offset_t next_offset, const uint32_t depth, void *userData)
DWARFDebugInfo(const DWARFDebugInfo &)=delete
DWARFUnit * GetUnit(const DIERef &die_ref)
uint64_t dw_offset_t
Definition: dwarf.h:31