1 //===-- DWARFDebugRanges.h --------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef SymbolFileDWARF_DWARFDebugRanges_h_
10 #define SymbolFileDWARF_DWARFDebugRanges_h_
12 #include "lldb/Core/dwarf.h"
16 namespace lldb_private {
20 class DWARFDebugRangesBase {
22 virtual ~DWARFDebugRangesBase(){};
24 virtual void Extract(lldb_private::DWARFContext &context) = 0;
25 virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
26 DWARFRangeList &range_list) const = 0;
27 virtual uint64_t GetOffset(size_t Index) const = 0;
30 class DWARFDebugRanges final : public DWARFDebugRangesBase {
34 void Extract(lldb_private::DWARFContext &context) override;
35 bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
36 DWARFRangeList &range_list) const override;
37 uint64_t GetOffset(size_t Index) const override;
39 static void Dump(lldb_private::Stream &s,
40 const lldb_private::DWARFDataExtractor &debug_ranges_data,
41 lldb::offset_t *offset_ptr, dw_addr_t cu_base_addr);
44 bool Extract(lldb_private::DWARFContext &context, lldb::offset_t *offset_ptr,
45 DWARFRangeList &range_list);
47 typedef std::map<dw_offset_t, DWARFRangeList> range_map;
48 typedef range_map::iterator range_map_iterator;
49 typedef range_map::const_iterator range_map_const_iterator;
50 range_map m_range_map;
53 // DWARF v5 .debug_rnglists section.
54 class DWARFDebugRngLists final : public DWARFDebugRangesBase {
62 void Extract(lldb_private::DWARFContext &context) override;
63 bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
64 DWARFRangeList &range_list) const override;
65 uint64_t GetOffset(size_t Index) const override;
68 bool ExtractRangeList(const lldb_private::DWARFDataExtractor &data,
69 uint8_t addrSize, lldb::offset_t *offset_ptr,
70 std::vector<RngListEntry> &list);
72 std::vector<uint64_t> Offsets;
73 std::map<dw_offset_t, std::vector<RngListEntry>> m_range_map;
76 #endif // SymbolFileDWARF_DWARFDebugRanges_h_