LLDB mainline
SBSection.h
Go to the documentation of this file.
1//===-- SBSection.h ---------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_API_SBSECTION_H
10#define LLDB_API_SBSECTION_H
11
12#include "lldb/API/SBData.h"
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
18public:
19 SBSection();
20
21 SBSection(const lldb::SBSection &rhs);
22
24
25 const lldb::SBSection &operator=(const lldb::SBSection &rhs);
26
27 explicit operator bool() const;
28
29 bool IsValid() const;
30
31 const char *GetName();
32
33 lldb::SBSection GetParent();
34
35 lldb::SBSection FindSubSection(const char *sect_name);
36
37 size_t GetNumSubSections();
38
39 lldb::SBSection GetSubSectionAtIndex(size_t idx);
40
41 lldb::addr_t GetFileAddress();
42
43 lldb::addr_t GetLoadAddress(lldb::SBTarget &target);
44
45 lldb::addr_t GetByteSize();
46
47 uint64_t GetFileOffset();
48
49 uint64_t GetFileByteSize();
50
51 lldb::SBData GetSectionData();
52
53 lldb::SBData GetSectionData(uint64_t offset, uint64_t size);
54
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 uint32_t
68 GetPermissions() const;
69
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.
74 ///
75 /// \return
76 /// The number of host (8-bit) bytes needed to hold a target byte
77 uint32_t GetTargetByteSize();
78
79 /// Return the alignment of the section in bytes
80 ///
81 /// \return
82 /// The alignment of the section in bytes
83 uint32_t GetAlignment();
84
85 bool operator==(const lldb::SBSection &rhs);
86
87 bool operator!=(const lldb::SBSection &rhs);
88
89 bool GetDescription(lldb::SBStream &description);
90
91private:
92 friend class SBAddress;
93 friend class SBModule;
94 friend class SBTarget;
95
96 SBSection(const lldb::SectionSP &section_sp);
97
98 lldb::SectionSP GetSP() const;
99
100 void SetSP(const lldb::SectionSP &section_sp);
101
103};
104
105} // namespace lldb
106
107#endif // LLDB_API_SBSECTION_H
static uint32_t GetTargetByteSize(SectionType Type, const ArchSpec &arch)
static Permissions GetPermissions(const ELFSectionHeader &H)
static lldb::SectionType GetSectionType(uint32_t flags, ConstString section_name)
#define LLDB_API
Definition: SBDefines.h:28
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb::SectionWP m_opaque_wp
Definition: SBSection.h:102
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Section > SectionSP
Definition: lldb-forward.h:414
uint64_t addr_t
Definition: lldb-types.h:80
bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs)
Definition: SBAddress.cpp:60
std::weak_ptr< lldb_private::Section > SectionWP
Definition: lldb-forward.h:416