xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBSectionExtensions.i (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1 STRING_EXTENSION_OUTSIDE(SBSection)
2 
3 %extend lldb::SBSection {
4 #ifdef SWIGPYTHON
5     %pythoncode %{
6         # operator== is a free function, which swig does not handle, so we inject
7         # our own equality operator here
8         def __eq__(self, other):
9             return not self.__ne__(other)
10 
11         def __iter__(self):
12             '''Iterate over all subsections in a lldb.SBSection object.'''
13             return lldb_iter(self, 'GetNumSubSections', 'GetSubSectionAtIndex')
14 
15         def __len__(self):
16             '''Return the number of subsections in a lldb.SBSection object.'''
17             return self.GetNumSubSections()
18 
19         def get_addr(self):
20             return SBAddress(self, 0)
21 
22         name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''')
23         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.''')
24         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.''')
25         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''')
26         file_offset = property(GetFileOffset, None, doc='''A read only property that returns the file offset in bytes of this section as an integer.''')
27         file_size = property(GetFileByteSize, None, doc='''A read only property that returns the file size in bytes of this section as an integer.''')
28         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.''')
29         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.).''')
30         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.''')
31         alignment = property(GetAlignment, None, doc='''A read only property that returns the alignment of this section as a number of host bytes.''')
32     %}
33 #endif
34 }
35