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 {
23class DWARFContext;
24}
25
27public:
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();
46 DWARFDIE GetDIE(const DIERef &die_ref);
47
48 enum {
49 eDumpFlag_Verbose = (1 << 0), // Verbose dumping
50 eDumpFlag_ShowForm = (1 << 1), // Show the DW_form type
52 (1 << 2) // Show all parent DIEs when dumping single DIEs
53 };
54
56
57protected:
58 typedef std::vector<DWARFUnitSP> UnitColl;
59
62
63 llvm::once_flag m_units_once_flag;
65
66 std::unique_ptr<DWARFDebugAranges>
67 m_cu_aranges_up; // A quick address to compile unit table
68
69 std::vector<std::pair<uint64_t, uint32_t>> m_type_hash_to_unit_index;
70
71private:
72 // All parsing needs to be done partially any managed by this class as
73 // accessors are called.
75
76 void ParseUnitsFor(DIERef::Section section);
77
79
80 DWARFDebugInfo(const DWARFDebugInfo &) = delete;
81 const DWARFDebugInfo &operator=(const DWARFDebugInfo &) = delete;
82};
83
84#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGINFO_H
Identifies a DWARF debug info entry within a given Module.
Definition: DIERef.h:28
Section
Definition: DIERef.h:30
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
DWARFDebugInfo(const DWARFDebugInfo &)=delete
SymbolFileDWARF & m_dwarf
DWARFTypeUnit * GetTypeUnitForHash(uint64_t hash)
UnitColl m_units
DWARFUnit * GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset, uint32_t *idx_ptr=nullptr)
uint32_t FindUnitIndex(DIERef::Section section, dw_offset_t offset)
const DWARFDebugAranges & GetCompileUnitAranges()
void ParseUnitsFor(DIERef::Section section)
void ParseUnitHeadersIfNeeded()
DWARFDIE GetDIE(const DIERef &die_ref)
DWARFUnit * GetUnitContainingDIEOffset(DIERef::Section section, dw_offset_t die_offset)
DWARFUnit * GetUnitAtIndex(size_t idx)
const DWARFDebugInfo & operator=(const DWARFDebugInfo &)=delete
std::vector< std::pair< uint64_t, uint32_t > > m_type_hash_to_unit_index
std::vector< DWARFUnitSP > UnitColl
llvm::once_flag m_units_once_flag
std::unique_ptr< DWARFDebugAranges > m_cu_aranges_up
DWARFUnit * GetUnit(const DIERef &die_ref)
dw_offset_t(* Callback)(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, DWARFDebugInfoEntry *die, const dw_offset_t next_offset, const uint32_t depth, void *userData)
lldb_private::DWARFContext & m_context
uint64_t dw_offset_t
Definition: dwarf.h:31
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14