• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- SWIG Interface for SBSymbolContextList ------------------*- 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",
13 "Represents a list of symbol context object. See also SBSymbolContext.
14 
15 For example (from test/python_api/target/TestTargetAPI.py),
16 
17     def find_functions(self, exe_name):
18         '''Exercise SBTaget.FindFunctions() API.'''
19         exe = os.path.join(os.getcwd(), exe_name)
20 
21         # Create a target by the debugger.
22         target = self.dbg.CreateTarget(exe)
23         self.assertTrue(target, VALID_TARGET)
24 
25         list = lldb.SBSymbolContextList()
26         num = target.FindFunctions('c', lldb.eFunctionNameTypeAuto, False, list)
27         self.assertTrue(num == 1 and list.GetSize() == 1)
28 
29         for sc in list:
30             self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
31             self.assertTrue(sc.GetSymbol().GetName() == 'c')
32 ") SBSymbolContextList;
33 class SBSymbolContextList
34 {
35 public:
36     SBSymbolContextList ();
37 
38     SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
39 
40     ~SBSymbolContextList ();
41 
42     bool
43     IsValid () const;
44 
45     uint32_t
46     GetSize() const;
47 
48     SBSymbolContext
49     GetContextAtIndex (uint32_t idx);
50 
51     void
52     Append (lldb::SBSymbolContext &sc);
53 
54     void
55     Append (lldb::SBSymbolContextList &sc_list);
56 
57     bool
58     GetDescription (lldb::SBStream &description);
59 
60     void
61     Clear();
62 
63     %pythoncode %{
64         def __len__(self):
65             return int(self.GetSize())
66 
67         def __getitem__(self, key):
68             count = len(self)
69             if type(key) is int:
70                 if key < count:
71                     return self.GetContextAtIndex(key)
72                 else:
73                     raise IndexError
74             raise TypeError
75 
76         def get_module_array(self):
77             a = []
78             for i in range(len(self)):
79                 obj = self.GetContextAtIndex(i).module
80                 if obj:
81                     a.append(obj)
82             return a
83 
84         def get_compile_unit_array(self):
85             a = []
86             for i in range(len(self)):
87                 obj = self.GetContextAtIndex(i).compile_unit
88                 if obj:
89                     a.append(obj)
90             return a
91         def get_function_array(self):
92             a = []
93             for i in range(len(self)):
94                 obj = self.GetContextAtIndex(i).function
95                 if obj:
96                     a.append(obj)
97             return a
98         def get_block_array(self):
99             a = []
100             for i in range(len(self)):
101                 obj = self.GetContextAtIndex(i).block
102                 if obj:
103                     a.append(obj)
104             return a
105         def get_symbol_array(self):
106             a = []
107             for i in range(len(self)):
108                 obj = self.GetContextAtIndex(i).symbol
109                 if obj:
110                     a.append(obj)
111             return a
112         def get_line_entry_array(self):
113             a = []
114             for i in range(len(self)):
115                 obj = self.GetContextAtIndex(i).line_entry
116                 if obj:
117                     a.append(obj)
118             return a
119         __swig_getmethods__["modules"] = get_module_array
120         if _newclass: modules = property(get_module_array, None, doc='''Returns a list() of lldb.SBModule objects, one for each module in each SBSymbolContext object in this list.''')
121 
122         __swig_getmethods__["compile_units"] = get_compile_unit_array
123         if _newclass: compile_units = property(get_compile_unit_array, None, doc='''Returns a list() of lldb.SBCompileUnit objects, one for each compile unit in each SBSymbolContext object in this list.''')
124 
125         __swig_getmethods__["functions"] = get_function_array
126         if _newclass: functions = property(get_function_array, None, doc='''Returns a list() of lldb.SBFunction objects, one for each function in each SBSymbolContext object in this list.''')
127 
128         __swig_getmethods__["blocks"] = get_block_array
129         if _newclass: blocks = property(get_block_array, None, doc='''Returns a list() of lldb.SBBlock objects, one for each block in each SBSymbolContext object in this list.''')
130 
131         __swig_getmethods__["line_entries"] = get_line_entry_array
132         if _newclass: line_entries = property(get_line_entry_array, None, doc='''Returns a list() of lldb.SBLineEntry objects, one for each line entry in each SBSymbolContext object in this list.''')
133 
134         __swig_getmethods__["symbols"] = get_symbol_array
135         if _newclass: symbols = property(get_symbol_array, None, doc='''Returns a list() of lldb.SBSymbol objects, one for each symbol in each SBSymbolContext object in this list.''')
136     %}
137 
138 };
139 
140 } // namespace lldb
141