blob: c94161e412b09d4c832871c239b7faff6ce6a5c3 [file] [log] [blame]
Greg Clayton64a4eaa2011-09-24 01:32:22 +00001//===-- SWIG Interface for SBSection ----------------------------*- 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
10namespace lldb {
11
12%feature("docstring",
Johnny Chen5b94dc22011-09-24 04:51:43 +000013"Represents an executable image section.
14
15SBSection supports iteration through its subsection, represented as SBSection
Johnny Chenced90682011-10-03 23:06:33 +000016as well. For example,
17
18 for sec in exe_module:
19 if sec.GetName() == '__TEXT':
20 print sec
21 break
22 print INDENT + 'Number of subsections: %d' % sec.GetNumSubSections()
23 for subsec in sec:
24 print INDENT + repr(subsec)
25
26produces:
27
28[0x0000000100000000-0x0000000100002000) a.out.__TEXT
29 Number of subsections: 6
30 [0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text
31 [0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs
32 [0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper
33 [0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring
34 [0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info
35 [0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame
36
37See also SBModule."
Greg Clayton64a4eaa2011-09-24 01:32:22 +000038) SBSection;
39
40class SBSection
41{
42public:
43
44 SBSection ();
45
46 SBSection (const lldb::SBSection &rhs);
47
48 ~SBSection ();
49
50 bool
51 IsValid () const;
52
Greg Claytonf644ddf2011-09-24 01:37:21 +000053 const char *
54 GetName ();
55
Greg Clayton64a4eaa2011-09-24 01:32:22 +000056 lldb::SBSection
Greg Clayton1d4c5402013-06-13 21:23:23 +000057 GetParent();
58
59 lldb::SBSection
Greg Clayton64a4eaa2011-09-24 01:32:22 +000060 FindSubSection (const char *sect_name);
61
62 size_t
63 GetNumSubSections ();
64
65 lldb::SBSection
66 GetSubSectionAtIndex (size_t idx);
67
68 lldb::addr_t
69 GetFileAddress ();
70
71 lldb::addr_t
Greg Claytonfed39aa2012-06-27 22:22:28 +000072 GetLoadAddress (lldb::SBTarget &target);
73
74 lldb::addr_t
Greg Clayton64a4eaa2011-09-24 01:32:22 +000075 GetByteSize ();
76
77 uint64_t
78 GetFileOffset ();
79
80 uint64_t
81 GetFileByteSize ();
82
83 lldb::SBData
Greg Claytond9dc52d2011-09-24 05:04:40 +000084 GetSectionData ();
85
86 lldb::SBData
Greg Clayton64a4eaa2011-09-24 01:32:22 +000087 GetSectionData (uint64_t offset,
88 uint64_t size);
89
90 SectionType
91 GetSectionType ();
92
Matthew Gardinerc928de32014-10-22 07:22:56 +000093 %feature("docstring", "
94 //------------------------------------------------------------------
95 /// Return the size of a target's byte represented by this section
96 /// in numbers of host bytes. Note that certain architectures have
97 /// varying minimum addressable unit (i.e. byte) size for their
98 /// CODE or DATA buses.
99 ///
100 /// @return
101 /// The number of host (8-bit) bytes needed to hold a target byte
102 //------------------------------------------------------------------
103 ") GetTargetByteSize;
104 uint32_t
105 GetTargetByteSize ();
106
Greg Clayton64a4eaa2011-09-24 01:32:22 +0000107 bool
108 GetDescription (lldb::SBStream &description);
109
Enrico Granatac3387332013-05-03 01:29:27 +0000110 bool
111 operator == (const lldb::SBSection &rhs);
112
113 bool
114 operator != (const lldb::SBSection &rhs);
115
Greg Clayton13d19502012-01-29 06:07:39 +0000116 %pythoncode %{
Greg Clayton819134a2012-02-04 02:58:17 +0000117 def get_addr(self):
118 return SBAddress(self, 0)
119
Greg Clayton13d19502012-01-29 06:07:39 +0000120 __swig_getmethods__["name"] = GetName
Greg Clayton5ef31a92012-06-29 22:00:42 +0000121 if _newclass: name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000122
Greg Clayton819134a2012-02-04 02:58:17 +0000123 __swig_getmethods__["addr"] = get_addr
Greg Clayton5ef31a92012-06-29 22:00:42 +0000124 if _newclass: addr = property(get_addr, None, doc='''A read only property that returns an lldb object that represents the start address (lldb.SBAddress) for this section.''')
Greg Clayton819134a2012-02-04 02:58:17 +0000125
Greg Clayton13d19502012-01-29 06:07:39 +0000126 __swig_getmethods__["file_addr"] = GetFileAddress
Greg Clayton5ef31a92012-06-29 22:00:42 +0000127 if _newclass: file_addr = property(GetFileAddress, None, doc='''A read only property that returns an integer that represents the starting "file" address for this section, or the address of the section in the object file in which it is defined.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000128
129 __swig_getmethods__["size"] = GetByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000130 if _newclass: size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000131
132 __swig_getmethods__["file_offset"] = GetFileOffset
Greg Clayton5ef31a92012-06-29 22:00:42 +0000133 if _newclass: file_offset = property(GetFileOffset, None, doc='''A read only property that returns the file offset in bytes of this section as an integer.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000134
135 __swig_getmethods__["file_size"] = GetFileByteSize
Greg Clayton5ef31a92012-06-29 22:00:42 +0000136 if _newclass: file_size = property(GetFileByteSize, None, doc='''A read only property that returns the file size in bytes of this section as an integer.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000137
138 __swig_getmethods__["data"] = GetSectionData
Greg Clayton5ef31a92012-06-29 22:00:42 +0000139 if _newclass: data = property(GetSectionData, None, doc='''A read only property that returns an lldb object that represents the bytes for this section (lldb.SBData) for this section.''')
Greg Clayton13d19502012-01-29 06:07:39 +0000140
141 __swig_getmethods__["type"] = GetSectionType
Greg Clayton5ef31a92012-06-29 22:00:42 +0000142 if _newclass: type = property(GetSectionType, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eSectionType") that represents the type of this section (code, data, etc.).''')
Greg Clayton13d19502012-01-29 06:07:39 +0000143
Matthew Gardinerc928de32014-10-22 07:22:56 +0000144 __swig_getmethods__["target_byte_size"] = GetTargetByteSize
145 if _newclass: target_byte_size = property(GetTargetByteSize, None, doc='''A read only property that returns the size of a target byte represented by this section as a number of host bytes.''')
146
Greg Clayton13d19502012-01-29 06:07:39 +0000147 %}
148
Greg Clayton64a4eaa2011-09-24 01:32:22 +0000149private:
150
Greg Clayton7b0992d2013-04-18 22:45:39 +0000151 std::unique_ptr<lldb_private::SectionImpl> m_opaque_ap;
Greg Clayton64a4eaa2011-09-24 01:32:22 +0000152};
153
154} // namespace lldb