1 //===-- SBSection.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 LLDB_SBSection_h_ 11 #define LLDB_SBSection_h_ 12 13 #include "lldb/API/SBData.h" 14 #include "lldb/API/SBDefines.h" 15 16 namespace lldb { 17 18 class LLDB_API SBSection { 19 public: 20 SBSection(); 21 22 SBSection(const lldb::SBSection &rhs); 23 24 ~SBSection(); 25 26 const lldb::SBSection &operator=(const lldb::SBSection &rhs); 27 28 bool IsValid() const; 29 30 const char *GetName(); 31 32 lldb::SBSection GetParent(); 33 34 lldb::SBSection FindSubSection(const char *sect_name); 35 36 size_t GetNumSubSections(); 37 38 lldb::SBSection GetSubSectionAtIndex(size_t idx); 39 40 lldb::addr_t GetFileAddress(); 41 42 lldb::addr_t GetLoadAddress(lldb::SBTarget &target); 43 44 lldb::addr_t GetByteSize(); 45 46 uint64_t GetFileOffset(); 47 48 uint64_t GetFileByteSize(); 49 50 lldb::SBData GetSectionData(); 51 52 lldb::SBData GetSectionData(uint64_t offset, uint64_t size); 53 54 SectionType GetSectionType(); 55 56 //------------------------------------------------------------------ 57 /// Gets the permissions (RWX) of the section of the object file 58 /// 59 /// Returns a mask of bits of enum lldb::Permissions for this section. 60 /// Sections for which permissions are not defined, 0 is returned for 61 /// them. The binary representation of this value corresponds to [XRW] 62 /// i.e. for a section having read and execute permissions, the value 63 /// returned is 6 64 /// 65 /// @return 66 /// Returns an unsigned value for Permissions for the section. 67 //------------------------------------------------------------------ 68 uint32_t 69 GetPermissions() const; 70 71 //------------------------------------------------------------------ 72 /// Return the size of a target's byte represented by this section 73 /// in numbers of host bytes. Note that certain architectures have 74 /// varying minimum addressable unit (i.e. byte) size for their 75 /// CODE or DATA buses. 76 /// 77 /// @return 78 /// The number of host (8-bit) bytes needed to hold a target byte 79 //------------------------------------------------------------------ 80 uint32_t GetTargetByteSize(); 81 82 bool operator==(const lldb::SBSection &rhs); 83 84 bool operator!=(const lldb::SBSection &rhs); 85 86 bool GetDescription(lldb::SBStream &description); 87 88 private: 89 friend class SBAddress; 90 friend class SBModule; 91 friend class SBTarget; 92 93 SBSection(const lldb::SectionSP §ion_sp); 94 95 lldb::SectionSP GetSP() const; 96 97 void SetSP(const lldb::SectionSP §ion_sp); 98 99 lldb::SectionWP m_opaque_wp; 100 }; 101 102 } // namespace lldb 103 104 #endif // LLDB_SBSection_h_ 105