SBSection.h 2.5 KB

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