blob: 95838755c59eb3e159cedd237f301b563d9410cc [file] [log] [blame]
Greg Clayton432efbc2011-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 Chendc0cbd12011-09-24 04:51:43 +000013"Represents an executable image section.
14
15SBSection supports iteration through its subsection, represented as SBSection
Johnny Chen681bb5e2011-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 Clayton432efbc2011-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 Clayton980c7502011-09-24 01:37:21 +000053 const char *
54 GetName ();
55
Greg Clayton432efbc2011-09-24 01:32:22 +000056 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
69 GetByteSize ();
70
71 uint64_t
72 GetFileOffset ();
73
74 uint64_t
75 GetFileByteSize ();
76
77 lldb::SBData
Greg Clayton15ef51e2011-09-24 05:04:40 +000078 GetSectionData ();
79
80 lldb::SBData
Greg Clayton432efbc2011-09-24 01:32:22 +000081 GetSectionData (uint64_t offset,
82 uint64_t size);
83
84 SectionType
85 GetSectionType ();
86
87 bool
88 GetDescription (lldb::SBStream &description);
89
Greg Clayton1b925202012-01-29 06:07:39 +000090 %pythoncode %{
Greg Clayton39f54ea2012-02-04 02:58:17 +000091 def get_addr(self):
92 return SBAddress(self, 0)
93
Greg Clayton1b925202012-01-29 06:07:39 +000094 __swig_getmethods__["name"] = GetName
95 if _newclass: x = property(GetName, None)
96
Greg Clayton39f54ea2012-02-04 02:58:17 +000097 __swig_getmethods__["addr"] = get_addr
98 if _newclass: x = property(get_addr, None)
99
Greg Clayton1b925202012-01-29 06:07:39 +0000100 __swig_getmethods__["file_addr"] = GetFileAddress
101 if _newclass: x = property(GetFileAddress, None)
102
103 __swig_getmethods__["size"] = GetByteSize
104 if _newclass: x = property(GetByteSize, None)
105
106 __swig_getmethods__["file_offset"] = GetFileOffset
107 if _newclass: x = property(GetFileOffset, None)
108
109 __swig_getmethods__["file_size"] = GetFileByteSize
110 if _newclass: x = property(GetFileByteSize, None)
111
112 __swig_getmethods__["data"] = GetSectionData
113 if _newclass: x = property(GetSectionData, None)
114
115 __swig_getmethods__["type"] = GetSectionType
116 if _newclass: x = property(GetSectionType, None)
117
118 %}
119
Greg Clayton432efbc2011-09-24 01:32:22 +0000120private:
121
122 std::auto_ptr<lldb_private::SectionImpl> m_opaque_ap;
123};
124
125} // namespace lldb