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 
22 namespace lldb_private {
23 class DWARFContext;
24 }
25 
27 public:
28  typedef dw_offset_t (*Callback)(SymbolFileDWARF *dwarf2Data,
29  DWARFUnit *cu,
31  const dw_offset_t next_offset,
32  const uint32_t depth, void *userData);
33 
36 
37  size_t GetNumUnits();
38  DWARFUnit *GetUnitAtIndex(size_t idx);
40  uint32_t *idx_ptr = nullptr);
42  dw_offset_t die_offset);
43  DWARFUnit *GetUnit(const DIERef &die_ref);
44  DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
45  bool ContainsTypeUnits();
47  dw_offset_t die_offset);
48  DWARFDIE GetDIE(const DIERef &die_ref);
49 
50  enum {
51  eDumpFlag_Verbose = (1 << 0), // Verbose dumping
52  eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
54  (1 << 2) // Show all parent DIEs when dumping single DIEs
55  };
56 
58 
59 protected:
60  typedef std::vector<DWARFUnitSP> UnitColl;
61 
64 
65  llvm::once_flag m_units_once_flag;
67 
68  std::unique_ptr<DWARFDebugAranges>
69  m_cu_aranges_up; // A quick address to compile unit table
70 
71  std::vector<std::pair<uint64_t, uint32_t>> m_type_hash_to_unit_index;
72 
73 private:
74  // All parsing needs to be done partially any managed by this class as
75  // accessors are called.
77 
78  void ParseUnitsFor(DIERef::Section section);
79 
81 
82  DWARFDebugInfo(const DWARFDebugInfo &) = delete;
83  const DWARFDebugInfo &operator=(const DWARFDebugInfo &) = delete;
84 };
85 
86 #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H
DWARFDebugInfo::ContainsTypeUnits
bool ContainsTypeUnits()
Definition: DWARFDebugInfo.cpp:172
DIERef
Identifies a DWARF debug info entry within a given Module.
Definition: DIERef.h:26
DWARFDebugInfo::eDumpFlag_ShowForm
@ eDumpFlag_ShowForm
Definition: DWARFDebugInfo.h:52
DWARFDebugInfo::ParseUnitHeadersIfNeeded
void ParseUnitHeadersIfNeeded()
Definition: DWARFDebugInfo.cpp:98
DWARFDIE.h
DWARFDebugAranges
Definition: DWARFDebugAranges.h:16
DWARFDebugInfo::FindUnitIndex
uint32_t FindUnitIndex(DIERef::Section section, dw_offset_t offset)
Definition: DWARFDebugInfo.cpp:118
DWARFDebugInfo
Definition: DWARFDebugInfo.h:26
DWARFTypeUnit
Definition: DWARFTypeUnit.h:15
DWARFDebugInfo::GetNumUnits
size_t GetNumUnits()
Definition: DWARFDebugInfo.cpp:106
SymbolFileDWARF
Definition: SymbolFileDWARF.h:58
SymbolFileDWARF.h
DWARFDebugInfo::operator=
const DWARFDebugInfo & operator=(const DWARFDebugInfo &)=delete
DWARFDebugInfo::m_units
UnitColl m_units
Definition: DWARFDebugInfo.h:66
dw_offset_t
uint32_t dw_offset_t
Definition: dwarf.h:30
DWARFDebugInfo::m_type_hash_to_unit_index
std::vector< std::pair< uint64_t, uint32_t > > m_type_hash_to_unit_index
Definition: DWARFDebugInfo.h:71
DWARFDebugInfoEntry
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
Definition: DWARFDebugInfoEntry.h:31
DWARFDebugInfo::GetCompileUnitAranges
const DWARFDebugAranges & GetCompileUnitAranges()
Definition: DWARFDebugInfo.cpp:37
lldb_private::DWARFContext
Definition: DWARFContext.h:20
DWARFDebugInfo::m_units_once_flag
llvm::once_flag m_units_once_flag
Definition: DWARFDebugInfo.h:65
DWARFDebugInfo::eDumpFlag_Verbose
@ eDumpFlag_Verbose
Definition: DWARFDebugInfo.h:51
DWARFDIE
Definition: DWARFDIE.h:15
DWARFDebugInfo::UnitColl
std::vector< DWARFUnitSP > UnitColl
Definition: DWARFDebugInfo.h:60
DWARFDebugInfo::DWARFDebugInfo
DWARFDebugInfo(SymbolFileDWARF &dwarf, lldb_private::DWARFContext &context)
Definition: DWARFDebugInfo.cpp:33
DWARFUnit
Definition: DWARFUnit.h:80
dwarf
Definition: ABISysV_arc.cpp:61
DWARFDebugInfo::GetTypeUnitForHash
DWARFTypeUnit * GetTypeUnitForHash(uint64_t hash)
Definition: DWARFDebugInfo.cpp:164
DWARFDebugInfo::m_dwarf
SymbolFileDWARF & m_dwarf
Definition: DWARFDebugInfo.h:62
DWARFDebugInfo::GetUnitAtIndex
DWARFUnit * GetUnitAtIndex(size_t idx)
Definition: DWARFDebugInfo.cpp:111
DWARFUnit.h
lldb-private.h
DWARFDebugInfo::GetUnit
DWARFUnit * GetUnit(const DIERef &die_ref)
Definition: DWARFDebugInfo.cpp:150
DWARFDebugInfo::Callback
dw_offset_t(* Callback)(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, DWARFDebugInfoEntry *die, const dw_offset_t next_offset, const uint32_t depth, void *userData)
Definition: DWARFDebugInfo.h:28
DWARFDebugInfo::ParseUnitsFor
void ParseUnitsFor(DIERef::Section section)
Definition: DWARFDebugInfo.cpp:71
DWARFDebugInfo::GetDIEForDIEOffset
DWARFDIE GetDIEForDIEOffset(DIERef::Section section, dw_offset_t die_offset)
Definition: DWARFDebugInfo.cpp:178
uint32_t
DWARFDebugInfo::GetUnitAtOffset
DWARFUnit * GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, uint32_t *idx_ptr=nullptr)
Definition: DWARFDebugInfo.cpp:136
DWARFDebugInfo::m_cu_aranges_up
std::unique_ptr< DWARFDebugAranges > m_cu_aranges_up
Definition: DWARFDebugInfo.h:69
DWARFDebugInfo::GetUnitContainingDIEOffset
DWARFUnit * GetUnitContainingDIEOffset(DIERef::Section section, dw_offset_t die_offset)
Definition: DWARFDebugInfo.cpp:155
DWARFTypeUnit.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
DWARFDebugInfo::GetDIE
DWARFDIE GetDIE(const DIERef &die_ref)
Definition: DWARFDebugInfo.cpp:190
DIERef::Section
Section
Definition: DIERef.h:28
DWARFDebugInfo::eDumpFlag_ShowAncestors
@ eDumpFlag_ShowAncestors
Definition: DWARFDebugInfo.h:53
DWARFDebugInfo::m_context
lldb_private::DWARFContext & m_context
Definition: DWARFDebugInfo.h:63