xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBSectionExtensions.i (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
106c3fb27SDimitry Andric STRING_EXTENSION_OUTSIDE(SBSection)
206c3fb27SDimitry Andric 
306c3fb27SDimitry Andric %extend lldb::SBSection {
406c3fb27SDimitry Andric #ifdef SWIGPYTHON
506c3fb27SDimitry Andric     %pythoncode %{
6*5f757f3fSDimitry Andric         # operator== is a free function, which swig does not handle, so we inject
7*5f757f3fSDimitry Andric         # our own equality operator here
8*5f757f3fSDimitry Andric         def __eq__(self, other):
9*5f757f3fSDimitry Andric             return not self.__ne__(other)
10*5f757f3fSDimitry Andric 
1106c3fb27SDimitry Andric         def __iter__(self):
1206c3fb27SDimitry Andric             '''Iterate over all subsections in a lldb.SBSection object.'''
1306c3fb27SDimitry Andric             return lldb_iter(self, 'GetNumSubSections', 'GetSubSectionAtIndex')
1406c3fb27SDimitry Andric 
1506c3fb27SDimitry Andric         def __len__(self):
1606c3fb27SDimitry Andric             '''Return the number of subsections in a lldb.SBSection object.'''
1706c3fb27SDimitry Andric             return self.GetNumSubSections()
1806c3fb27SDimitry Andric 
1906c3fb27SDimitry Andric         def get_addr(self):
2006c3fb27SDimitry Andric             return SBAddress(self, 0)
2106c3fb27SDimitry Andric 
2206c3fb27SDimitry Andric         name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''')
2306c3fb27SDimitry Andric         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.''')
2406c3fb27SDimitry Andric         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.''')
2506c3fb27SDimitry Andric         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''')
2606c3fb27SDimitry Andric         file_offset = property(GetFileOffset, None, doc='''A read only property that returns the file offset in bytes of this section as an integer.''')
2706c3fb27SDimitry Andric         file_size = property(GetFileByteSize, None, doc='''A read only property that returns the file size in bytes of this section as an integer.''')
2806c3fb27SDimitry Andric         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.''')
2906c3fb27SDimitry Andric         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.).''')
3006c3fb27SDimitry Andric         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.''')
3106c3fb27SDimitry Andric         alignment = property(GetAlignment, None, doc='''A read only property that returns the alignment of this section as a number of host bytes.''')
3206c3fb27SDimitry Andric     %}
3306c3fb27SDimitry Andric #endif
3406c3fb27SDimitry Andric }
35