blob: 476539bf84031646c46e6a85d432832001f33c42 (
plain)
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
|
//===-- DIERef.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 SymbolFileDWARF_DIERef_h_
#define SymbolFileDWARF_DIERef_h_
#include "lldb/Core/dwarf.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/FormatProviders.h"
#include <vector>
/// Identifies a DWARF debug info entry within a given Module. It contains three
/// "coordinates":
/// - section: identifies the section of the debug info entry: debug_info or
/// debug_types
/// - unit_offset: the offset of the unit containing the debug info entry. For
/// regular (unsplit) units, this field is optional, as the die_offset is
/// enough to uniquely identify the containing unit. For split units, this
/// field must contain the offset of the skeleton unit in the main object
/// file.
/// - die_offset: The offset of te debug info entry as an absolute offset from
/// the beginning of the section specified in the section field.
class DIERef {
public:
enum Section : uint8_t { DebugInfo, DebugTypes };
DIERef(Section s, llvm::Optional<dw_offset_t> u, dw_offset_t d)
: m_section(s), m_unit_offset(u.getValueOr(DW_INVALID_OFFSET)),
m_die_offset(d) {}
Section section() const { return static_cast<Section>(m_section); }
llvm::Optional<dw_offset_t> unit_offset() const {
if (m_unit_offset != DW_INVALID_OFFSET)
return m_unit_offset;
return llvm::None;
}
dw_offset_t die_offset() const { return m_die_offset; }
private:
unsigned m_section : 1;
dw_offset_t m_unit_offset;
dw_offset_t m_die_offset;
};
typedef std::vector<DIERef> DIEArray;
namespace llvm {
template<> struct format_provider<DIERef> {
static void format(const DIERef &ref, raw_ostream &OS, StringRef Style);
};
} // namespace llvm
#endif // SymbolFileDWARF_DIERef_h_
|