1 //===-- SBSection.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 LLDB_SBSection_h_
10 #define LLDB_SBSection_h_
12 #include "lldb/API/SBData.h"
13 #include "lldb/API/SBDefines.h"
17 class LLDB_API SBSection {
21 SBSection(const lldb::SBSection &rhs);
25 const lldb::SBSection &operator=(const lldb::SBSection &rhs);
27 explicit operator bool() const;
31 const char *GetName();
33 lldb::SBSection GetParent();
35 lldb::SBSection FindSubSection(const char *sect_name);
37 size_t GetNumSubSections();
39 lldb::SBSection GetSubSectionAtIndex(size_t idx);
41 lldb::addr_t GetFileAddress();
43 lldb::addr_t GetLoadAddress(lldb::SBTarget &target);
45 lldb::addr_t GetByteSize();
47 uint64_t GetFileOffset();
49 uint64_t GetFileByteSize();
51 lldb::SBData GetSectionData();
53 lldb::SBData GetSectionData(uint64_t offset, uint64_t size);
55 SectionType GetSectionType();
57 /// Gets the permissions (RWX) of the section of the object file
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
66 /// Returns an unsigned value for Permissions for the section.
68 GetPermissions() const;
70 /// Return the size of a target's byte represented by this section
71 /// in numbers of host bytes. Note that certain architectures have
72 /// varying minimum addressable unit (i.e. byte) size for their
73 /// CODE or DATA buses.
76 /// The number of host (8-bit) bytes needed to hold a target byte
77 uint32_t GetTargetByteSize();
79 bool operator==(const lldb::SBSection &rhs);
81 bool operator!=(const lldb::SBSection &rhs);
83 bool GetDescription(lldb::SBStream &description);
86 friend class SBAddress;
87 friend class SBModule;
88 friend class SBTarget;
90 SBSection(const lldb::SectionSP §ion_sp);
92 lldb::SectionSP GetSP() const;
94 void SetSP(const lldb::SectionSP §ion_sp);
96 lldb::SectionWP m_opaque_wp;
101 #endif // LLDB_SBSection_h_