LLVM API Documentation
00001 //===-- DWARFDebugArangeSet.h -----------------------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGESET_H 00011 #define LLVM_LIB_DEBUGINFO_DWARFDEBUGARANGESET_H 00012 00013 #include "llvm/ADT/iterator_range.h" 00014 #include "llvm/Support/DataExtractor.h" 00015 #include <vector> 00016 00017 namespace llvm { 00018 00019 class raw_ostream; 00020 00021 class DWARFDebugArangeSet { 00022 public: 00023 struct Header { 00024 // The total length of the entries for that set, not including the length 00025 // field itself. 00026 uint32_t Length; 00027 // The offset from the beginning of the .debug_info section of the 00028 // compilation unit entry referenced by the table. 00029 uint32_t CuOffset; 00030 // The DWARF version number. 00031 uint16_t Version; 00032 // The size in bytes of an address on the target architecture. For segmented 00033 // addressing, this is the size of the offset portion of the address. 00034 uint8_t AddrSize; 00035 // The size in bytes of a segment descriptor on the target architecture. 00036 // If the target system uses a flat address space, this value is 0. 00037 uint8_t SegSize; 00038 }; 00039 00040 struct Descriptor { 00041 uint64_t Address; 00042 uint64_t Length; 00043 uint64_t getEndAddress() const { return Address + Length; } 00044 }; 00045 00046 private: 00047 typedef std::vector<Descriptor> DescriptorColl; 00048 typedef iterator_range<DescriptorColl::const_iterator> desc_iterator_range; 00049 00050 uint32_t Offset; 00051 Header HeaderData; 00052 DescriptorColl ArangeDescriptors; 00053 00054 public: 00055 DWARFDebugArangeSet() { clear(); } 00056 void clear(); 00057 bool extract(DataExtractor data, uint32_t *offset_ptr); 00058 void dump(raw_ostream &OS) const; 00059 00060 uint32_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; } 00061 00062 desc_iterator_range descriptors() const { 00063 return desc_iterator_range(ArangeDescriptors.begin(), 00064 ArangeDescriptors.end()); 00065 } 00066 }; 00067 00068 } 00069 00070 #endif