DWARFDebugAranges.h revision 344779
1//===-- DWARFDebugAranges.h -------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef SymbolFileDWARF_DWARFDebugAranges_h_
11#define SymbolFileDWARF_DWARFDebugAranges_h_
12
13#include "DWARFDebugArangeSet.h"
14#include <list>
15
16#include "lldb/Core/RangeMap.h"
17
18class SymbolFileDWARF;
19
20class DWARFDebugAranges {
21protected:
22  typedef lldb_private::RangeDataVector<dw_addr_t, uint32_t, dw_offset_t>
23      RangeToDIE;
24
25public:
26  typedef RangeToDIE::Entry Range;
27  typedef std::vector<RangeToDIE::Entry> RangeColl;
28
29  DWARFDebugAranges();
30
31  void Clear() { m_aranges.Clear(); }
32
33  bool Extract(const lldb_private::DWARFDataExtractor &debug_aranges_data);
34
35  bool Generate(SymbolFileDWARF *dwarf2Data);
36
37  // Use append range multiple times and then call sort
38  void AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc);
39
40  void Sort(bool minimize);
41
42  const Range *RangeAtIndex(uint32_t idx) const {
43    return m_aranges.GetEntryAtIndex(idx);
44  }
45
46  void Dump(lldb_private::Log *log) const;
47
48  dw_offset_t FindAddress(dw_addr_t address) const;
49
50  bool IsEmpty() const { return m_aranges.IsEmpty(); }
51  size_t GetNumRanges() const { return m_aranges.GetSize(); }
52
53  dw_offset_t OffsetAtIndex(uint32_t idx) const {
54    const Range *range = m_aranges.GetEntryAtIndex(idx);
55    if (range)
56      return range->data;
57    return DW_INVALID_OFFSET;
58  }
59
60  static void Dump(SymbolFileDWARF *dwarf2Data, lldb_private::Stream *s);
61
62protected:
63  RangeToDIE m_aranges;
64};
65
66#endif // SymbolFileDWARF_DWARFDebugAranges_h_
67