]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBSection.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBSection.h
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_SBSection_h_
10 #define LLDB_SBSection_h_
11
12 #include "lldb/API/SBData.h"
13 #include "lldb/API/SBDefines.h"
14
15 namespace lldb {
16
17 class LLDB_API SBSection {
18 public:
19   SBSection();
20
21   SBSection(const lldb::SBSection &rhs);
22
23   ~SBSection();
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
55   SectionType GetSectionType();
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   bool operator==(const lldb::SBSection &rhs);
80
81   bool operator!=(const lldb::SBSection &rhs);
82
83   bool GetDescription(lldb::SBStream &description);
84
85 private:
86   friend class SBAddress;
87   friend class SBModule;
88   friend class SBTarget;
89
90   SBSection(const lldb::SectionSP &section_sp);
91
92   lldb::SectionSP GetSP() const;
93
94   void SetSP(const lldb::SectionSP &section_sp);
95
96   lldb::SectionWP m_opaque_wp;
97 };
98
99 } // namespace lldb
100
101 #endif // LLDB_SBSection_h_