blob: f6e610531b6adbdfada503289cea83e2b8124604 [file] [log] [blame]
Johnny Chen7be5a4f2011-07-18 19:15:22 +00001//===-- SWIG Interface for SBValue ------------------------------*- C++ -*-===//
Johnny Chen854a1ba2011-07-18 19:08:30 +00002//
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",
13"Represents the value of a variable, a register, or an expression.
14
15SBValue supports iteration through its child, which in turn is represented
16as an SBValue. For example, we can get the general purpose registers of a
17frame as an SBValue, and iterate through all the registers,
18
19 registerSet = frame.GetRegisters() # Returns an SBValueList.
20 for regs in registerSet:
21 if 'general purpose registers' in regs.getName().lower():
22 GPRs = regs
23 break
24
25 print '%s (number of children = %d):' % (GPRs.GetName(), GPRs.GetNumChildren())
26 for reg in GPRs:
27 print 'Name: ', reg.GetName(), ' Value: ', reg.GetValue()
28
29produces the output:
30
31General Purpose Registers (number of children = 21):
32Name: rax Value: 0x0000000100000c5c
33Name: rbx Value: 0x0000000000000000
34Name: rcx Value: 0x00007fff5fbffec0
35Name: rdx Value: 0x00007fff5fbffeb8
36Name: rdi Value: 0x0000000000000001
37Name: rsi Value: 0x00007fff5fbffea8
38Name: rbp Value: 0x00007fff5fbffe80
39Name: rsp Value: 0x00007fff5fbffe60
40Name: r8 Value: 0x0000000008668682
41Name: r9 Value: 0x0000000000000000
42Name: r10 Value: 0x0000000000001200
43Name: r11 Value: 0x0000000000000206
44Name: r12 Value: 0x0000000000000000
45Name: r13 Value: 0x0000000000000000
46Name: r14 Value: 0x0000000000000000
47Name: r15 Value: 0x0000000000000000
48Name: rip Value: 0x0000000100000dae
49Name: rflags Value: 0x0000000000000206
50Name: cs Value: 0x0000000000000027
51Name: fs Value: 0x0000000000000010
Johnny Chenc3fba812011-07-18 20:13:38 +000052Name: gs Value: 0x0000000000000048"
53) SBValue;
Johnny Chen854a1ba2011-07-18 19:08:30 +000054class SBValue
55{
56public:
57 SBValue ();
58
59 SBValue (const SBValue &rhs);
60
61 ~SBValue ();
62
63 bool
64 IsValid() const;
65
66 SBError
67 GetError();
68
69 lldb::user_id_t
70 GetID ();
71
72 const char *
73 GetName();
74
75 const char *
76 GetTypeName ();
77
78 size_t
79 GetByteSize ();
80
81 bool
82 IsInScope (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
83
84 bool
85 IsInScope ();
86
87 lldb::Format
88 GetFormat () const;
89
90 void
91 SetFormat (lldb::Format format);
92
93 const char *
94 GetValue (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
95
96 const char *
97 GetValue ();
98
99 ValueType
100 GetValueType ();
101
102 bool
103 GetValueDidChange (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
104
105 bool
106 GetValueDidChange ();
107
108 const char *
109 GetSummary (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
110
111 const char *
112 GetSummary ();
113
114 const char *
115 GetObjectDescription (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
116
117 const char *
118 GetObjectDescription ();
119
120 const char *
121 GetLocation (const lldb::SBFrame &frame); // DEPRECATED - SBValues know their own frames.
122
123 const char *
124 GetLocation ();
125
126 bool
127 SetValueFromCString (const lldb::SBFrame &frame, const char *value_str); // DEPRECATED - SBValues know their own frames.
128
129 bool
130 SetValueFromCString (const char *value_str);
131
132 lldb::SBValue
133 GetChildAtIndex (uint32_t idx);
134
135 %feature("docstring", "
136 //------------------------------------------------------------------
137 /// Get a child value by index from a value.
138 ///
139 /// Structs, unions, classes, arrays and and pointers have child
140 /// values that can be access by index.
141 ///
142 /// Structs and unions access child members using a zero based index
143 /// for each child member. For
144 ///
145 /// Classes reserve the first indexes for base classes that have
146 /// members (empty base classes are omitted), and all members of the
147 /// current class will then follow the base classes.
148 ///
149 /// Pointers differ depending on what they point to. If the pointer
150 /// points to a simple type, the child at index zero
151 /// is the only child value available, unless \a synthetic_allowed
152 /// is \b true, in which case the pointer will be used as an array
153 /// and can create 'synthetic' child values using positive or
154 /// negative indexes. If the pointer points to an aggregate type
155 /// (an array, class, union, struct), then the pointee is
156 /// transparently skipped and any children are going to be the indexes
157 /// of the child values within the aggregate type. For example if
158 /// we have a 'Point' type and we have a SBValue that contains a
159 /// pointer to a 'Point' type, then the child at index zero will be
160 /// the 'x' member, and the child at index 1 will be the 'y' member
161 /// (the child at index zero won't be a 'Point' instance).
162 ///
163 /// Arrays have a preset number of children that can be accessed by
164 /// index and will returns invalid child values for indexes that are
165 /// out of bounds unless the \a synthetic_allowed is \b true. In this
166 /// case the array can create 'synthetic' child values for indexes
167 /// that aren't in the array bounds using positive or negative
168 /// indexes.
169 ///
170 /// @param[in] idx
171 /// The index of the child value to get
172 ///
173 /// @param[in] use_dynamic
174 /// An enumeration that specifies wether to get dynamic values,
175 /// and also if the target can be run to figure out the dynamic
176 /// type of the child value.
177 ///
178 /// @param[in] synthetic_allowed
179 /// If \b true, then allow child values to be created by index
180 /// for pointers and arrays for indexes that normally wouldn't
181 /// be allowed.
182 ///
183 /// @return
184 /// A new SBValue object that represents the child member value.
185 //------------------------------------------------------------------
186 ") GetChildAtIndex;
187 lldb::SBValue
188 GetChildAtIndex (uint32_t idx,
189 lldb::DynamicValueType use_dynamic,
190 bool can_create_synthetic);
191
192 %feature("docstring", "
193 //------------------------------------------------------------------
194 /// Returns the child member index.
195 ///
196 /// Matches children of this object only and will match base classes and
197 /// member names if this is a clang typed object.
198 ///
199 /// @param[in] name
200 /// The name of the child value to get
201 ///
202 /// @return
203 /// An index to the child member value.
204 //------------------------------------------------------------------
205 ") GetIndexOfChildWithName;
206 uint32_t
207 GetIndexOfChildWithName (const char *name);
208
209 lldb::SBValue
210 GetChildMemberWithName (const char *name);
211
212 %feature("docstring", "
213 //------------------------------------------------------------------
214 /// Returns the child member value.
215 ///
216 /// Matches child members of this object and child members of any base
217 /// classes.
218 ///
219 /// @param[in] name
220 /// The name of the child value to get
221 ///
222 /// @param[in] use_dynamic
223 /// An enumeration that specifies wether to get dynamic values,
224 /// and also if the target can be run to figure out the dynamic
225 /// type of the child value.
226 ///
227 /// @return
228 /// A new SBValue object that represents the child member value.
229 //------------------------------------------------------------------
230 ") GetChildMemberWithName;
231 lldb::SBValue
232 GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
233
234 %feature("docstring", "Expands nested expressions like .a->b[0].c[1]->d."
235 ) GetValueForExpressionPath;
236 lldb::SBValue
237 GetValueForExpressionPath(const char* expr_path);
238
239 uint32_t
240 GetNumChildren ();
241
242 void *
243 GetOpaqueType();
244
245
246 lldb::SBValue
247 Dereference ();
248
249 bool
250 TypeIsPointerType ();
251
252 bool
253 GetDescription (lldb::SBStream &description);
254
255 bool
256 GetExpressionPath (lldb::SBStream &description);
257
258 %feature("docstring", "Returns an expression path for this value."
259 ) GetValueForExpressionPath;
260 bool
261 GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
262};
263
264} // namespace lldb