1061da546Spatrick //===-- DWARFDebugArangeSet.h -----------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9dda28197Spatrick #ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGARANGESET_H 10dda28197Spatrick #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGARANGESET_H 11061da546Spatrick 12061da546Spatrick #include "lldb/Core/dwarf.h" 13061da546Spatrick #include <cstdint> 14061da546Spatrick #include <vector> 15061da546Spatrick 16061da546Spatrick class DWARFDebugArangeSet { 17061da546Spatrick public: 18061da546Spatrick struct Header { 19*be691f3bSpatrick /// The total length of the entries for that set, not including the length 20*be691f3bSpatrick /// field itself. 21*be691f3bSpatrick uint32_t length = 0; 22*be691f3bSpatrick /// The DWARF version number. 23*be691f3bSpatrick uint16_t version = 0; 24*be691f3bSpatrick /// The offset from the beginning of the .debug_info section of the 25*be691f3bSpatrick /// compilation unit entry referenced by the table. 26*be691f3bSpatrick uint32_t cu_offset = 0; 27*be691f3bSpatrick /// The size in bytes of an address on the target architecture. For 28*be691f3bSpatrick /// segmented addressing, this is the size of the offset portion of the 29*be691f3bSpatrick /// address. 30*be691f3bSpatrick uint8_t addr_size = 0; 31*be691f3bSpatrick /// The size in bytes of a segment descriptor on the target architecture. 32*be691f3bSpatrick /// If the target system uses a flat address space, this value is 0. 33*be691f3bSpatrick uint8_t seg_size = 0; 34061da546Spatrick }; 35061da546Spatrick 36061da546Spatrick struct Descriptor { 37061da546Spatrick dw_addr_t address; 38061da546Spatrick dw_addr_t length; end_addressDescriptor39061da546Spatrick dw_addr_t end_address() const { return address + length; } 40061da546Spatrick }; 41061da546Spatrick 42061da546Spatrick DWARFDebugArangeSet(); 43061da546Spatrick void Clear(); SetOffset(uint32_t offset)44061da546Spatrick void SetOffset(uint32_t offset) { m_offset = offset; } 45061da546Spatrick llvm::Error extract(const lldb_private::DWARFDataExtractor &data, 46061da546Spatrick lldb::offset_t *offset_ptr); 47061da546Spatrick dw_offset_t FindAddress(dw_addr_t address) const; NumDescriptors()48061da546Spatrick size_t NumDescriptors() const { return m_arange_descriptors.size(); } GetHeader()49061da546Spatrick const Header &GetHeader() const { return m_header; } GetNextOffset()50*be691f3bSpatrick dw_offset_t GetNextOffset() const { return m_next_offset; } GetDescriptorRef(uint32_t i)51061da546Spatrick const Descriptor &GetDescriptorRef(uint32_t i) const { 52061da546Spatrick return m_arange_descriptors[i]; 53061da546Spatrick } 54061da546Spatrick 55061da546Spatrick protected: 56061da546Spatrick typedef std::vector<Descriptor> DescriptorColl; 57061da546Spatrick typedef DescriptorColl::iterator DescriptorIter; 58061da546Spatrick typedef DescriptorColl::const_iterator DescriptorConstIter; 59061da546Spatrick 60*be691f3bSpatrick dw_offset_t m_offset; 61*be691f3bSpatrick dw_offset_t m_next_offset; 62061da546Spatrick Header m_header; 63061da546Spatrick DescriptorColl m_arange_descriptors; 64061da546Spatrick }; 65061da546Spatrick 66dda28197Spatrick #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFDEBUGARANGESET_H 67