1//===-- DWARFDebugArangeSet.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_DWARFDebugArangeSet_h_ 11#define SymbolFileDWARF_DWARFDebugArangeSet_h_ 12 13#include "SymbolFileDWARF.h" 14#include <vector> 15 16class SymbolFileDWARF; 17 18class DWARFDebugArangeSet 19{ 20public: 21 struct Header 22 { 23 uint32_t length; // The total length of the entries for that set, not including the length field itself. 24 uint16_t version; // The DWARF version number 25 uint32_t cu_offset; // The offset from the beginning of the .debug_info section of the compilation unit entry referenced by the table. 26 uint8_t addr_size; // The size in bytes of an address on the target architecture. For segmented addressing, this is the size of the offset portion of the address 27 uint8_t seg_size; // The size in bytes of a segment descriptor on the target architecture. If the target system uses a flat address space, this value is 0. 28 }; 29 30 struct Descriptor 31 { 32 dw_addr_t address; 33 dw_addr_t length; 34 dw_addr_t end_address() const { return address + length; } 35 }; 36 37 38 DWARFDebugArangeSet(); 39 void Clear(); 40 void SetOffset(uint32_t offset) { m_offset = offset; } 41 void SetHeader(uint16_t version, uint32_t cu_offset, uint8_t addr_size, uint8_t seg_size); 42 void AddDescriptor(const DWARFDebugArangeSet::Descriptor& range); 43 void Compact(); 44 bool Extract(const lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr); 45 void Dump(lldb_private::Stream *s) const; 46 dw_offset_t GetCompileUnitDIEOffset() const { return m_header.cu_offset; } 47 dw_offset_t GetOffsetOfNextEntry() const; 48 dw_offset_t FindAddress(dw_addr_t address) const; 49 size_t NumDescriptors() const { return m_arange_descriptors.size(); } 50 const Header& GetHeader() const { return m_header; } 51 const Descriptor* GetDescriptor(uint32_t i) const 52 { 53 if (i < m_arange_descriptors.size()) 54 return &m_arange_descriptors[i]; 55 return NULL; 56 } 57 58 const Descriptor & 59 GetDescriptorRef (uint32_t i) const 60 { 61 return m_arange_descriptors[i]; 62 } 63 64 65protected: 66 typedef std::vector<Descriptor> DescriptorColl; 67 typedef DescriptorColl::iterator DescriptorIter; 68 typedef DescriptorColl::const_iterator DescriptorConstIter; 69 70 71 uint32_t m_offset; 72 Header m_header; 73 DescriptorColl m_arange_descriptors; 74}; 75 76#endif // SymbolFileDWARF_DWARFDebugArangeSet_h_ 77