xref: /llvm-project/lldb/bindings/interface/SBSectionExtensions.i (revision 6813ef37377e8d8fadf6efe01e1ed80cc53b9c86)
1662548c8SAlex Langford STRING_EXTENSION_OUTSIDE(SBSection)
2662548c8SAlex Langford 
3662548c8SAlex Langford %extend lldb::SBSection {
4662548c8SAlex Langford #ifdef SWIGPYTHON
5662548c8SAlex Langford     %pythoncode %{
6*6813ef37SMed Ismail Bennani         # operator== is a free function, which swig does not handle, so we inject
7*6813ef37SMed Ismail Bennani         # our own equality operator here
8*6813ef37SMed Ismail Bennani         def __eq__(self, other):
9*6813ef37SMed Ismail Bennani             return not self.__ne__(other)
10*6813ef37SMed Ismail Bennani 
11662548c8SAlex Langford         def __iter__(self):
12662548c8SAlex Langford             '''Iterate over all subsections in a lldb.SBSection object.'''
13662548c8SAlex Langford             return lldb_iter(self, 'GetNumSubSections', 'GetSubSectionAtIndex')
14662548c8SAlex Langford 
15662548c8SAlex Langford         def __len__(self):
16662548c8SAlex Langford             '''Return the number of subsections in a lldb.SBSection object.'''
17662548c8SAlex Langford             return self.GetNumSubSections()
18662548c8SAlex Langford 
19662548c8SAlex Langford         def get_addr(self):
20662548c8SAlex Langford             return SBAddress(self, 0)
21662548c8SAlex Langford 
22662548c8SAlex Langford         name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''')
23662548c8SAlex Langford         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.''')
24662548c8SAlex Langford         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.''')
25662548c8SAlex Langford         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''')
26662548c8SAlex Langford         file_offset = property(GetFileOffset, None, doc='''A read only property that returns the file offset in bytes of this section as an integer.''')
27662548c8SAlex Langford         file_size = property(GetFileByteSize, None, doc='''A read only property that returns the file size in bytes of this section as an integer.''')
28662548c8SAlex Langford         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.''')
29662548c8SAlex Langford         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.).''')
30662548c8SAlex Langford         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.''')
31662548c8SAlex Langford         alignment = property(GetAlignment, None, doc='''A read only property that returns the alignment of this section as a number of host bytes.''')
32662548c8SAlex Langford     %}
33662548c8SAlex Langford #endif
34662548c8SAlex Langford }
35