Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 1 | //===-- 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 | |
| 10 | namespace lldb { |
| 11 | |
| 12 | %feature("docstring", |
Johnny Chen | dc0cbd1 | 2011-09-24 04:51:43 +0000 | [diff] [blame] | 13 | "Represents an executable image section. |
| 14 | |
| 15 | SBSection supports iteration through its subsection, represented as SBSection |
Johnny Chen | 681bb5e | 2011-10-03 23:06:33 +0000 | [diff] [blame] | 16 | as 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 | |
| 26 | produces: |
| 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 | |
| 37 | See also SBModule." |
Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 38 | ) SBSection; |
| 39 | |
| 40 | class SBSection |
| 41 | { |
| 42 | public: |
| 43 | |
| 44 | SBSection (); |
| 45 | |
| 46 | SBSection (const lldb::SBSection &rhs); |
| 47 | |
| 48 | ~SBSection (); |
| 49 | |
| 50 | bool |
| 51 | IsValid () const; |
| 52 | |
Greg Clayton | 980c750 | 2011-09-24 01:37:21 +0000 | [diff] [blame] | 53 | const char * |
| 54 | GetName (); |
| 55 | |
Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 56 | lldb::SBSection |
| 57 | FindSubSection (const char *sect_name); |
| 58 | |
| 59 | size_t |
| 60 | GetNumSubSections (); |
| 61 | |
| 62 | lldb::SBSection |
| 63 | GetSubSectionAtIndex (size_t idx); |
| 64 | |
| 65 | lldb::addr_t |
| 66 | GetFileAddress (); |
| 67 | |
| 68 | lldb::addr_t |
Greg Clayton | 5c5a38e | 2012-06-27 22:22:28 +0000 | [diff] [blame] | 69 | GetLoadAddress (lldb::SBTarget &target); |
| 70 | |
| 71 | lldb::addr_t |
Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 72 | GetByteSize (); |
| 73 | |
| 74 | uint64_t |
| 75 | GetFileOffset (); |
| 76 | |
| 77 | uint64_t |
| 78 | GetFileByteSize (); |
| 79 | |
| 80 | lldb::SBData |
Greg Clayton | 15ef51e | 2011-09-24 05:04:40 +0000 | [diff] [blame] | 81 | GetSectionData (); |
| 82 | |
| 83 | lldb::SBData |
Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 84 | GetSectionData (uint64_t offset, |
| 85 | uint64_t size); |
| 86 | |
| 87 | SectionType |
| 88 | GetSectionType (); |
| 89 | |
| 90 | bool |
| 91 | GetDescription (lldb::SBStream &description); |
| 92 | |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 93 | %pythoncode %{ |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 94 | def get_addr(self): |
| 95 | return SBAddress(self, 0) |
| 96 | |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 97 | __swig_getmethods__["name"] = GetName |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 98 | if _newclass: name = property(GetName, None, doc='''A read only property that returns the name of this section as a string.''') |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 99 | |
Greg Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 100 | __swig_getmethods__["addr"] = get_addr |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 101 | 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 Clayton | 39f54ea | 2012-02-04 02:58:17 +0000 | [diff] [blame] | 102 | |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 103 | __swig_getmethods__["file_addr"] = GetFileAddress |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 104 | 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 Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 105 | |
| 106 | __swig_getmethods__["size"] = GetByteSize |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 107 | if _newclass: size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes of this section as an integer.''') |
Greg Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 108 | |
| 109 | __swig_getmethods__["file_offset"] = GetFileOffset |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 110 | 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 Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 111 | |
| 112 | __swig_getmethods__["file_size"] = GetFileByteSize |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 113 | 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 Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 114 | |
| 115 | __swig_getmethods__["data"] = GetSectionData |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 116 | 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 Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 117 | |
| 118 | __swig_getmethods__["type"] = GetSectionType |
Greg Clayton | 2a94be1 | 2012-06-29 22:00:42 +0000 | [diff] [blame^] | 119 | 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 Clayton | 1b92520 | 2012-01-29 06:07:39 +0000 | [diff] [blame] | 120 | |
| 121 | %} |
| 122 | |
Greg Clayton | 432efbc | 2011-09-24 01:32:22 +0000 | [diff] [blame] | 123 | private: |
| 124 | |
| 125 | std::auto_ptr<lldb_private::SectionImpl> m_opaque_ap; |
| 126 | }; |
| 127 | |
| 128 | } // namespace lldb |