1 %extend lldb
::SBValueList
{
6 std
::string lldb
::SBValueList
::__str__
(){
7 lldb
::SBStream description
;
8 const size_t n
= $self-
>GetSize
();
11 for
(size_t i
=0; i
<n
; ++i
)
12 $self-
>GetValueAtIndex
(i
).GetDescription
(description
);
16 description.Printf
("<empty> lldb.SBValueList()");
18 const char
*desc
= description.GetData
();
19 size_t desc_len
= description.GetSize
();
20 if
(desc_len
> 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))
22 return std
::string
(desc
, desc_len
);
31 '''Iterate over all values in a lldb.SBValueList object.'''
32 return lldb_iter
(self
, 'GetSize'
, 'GetValueAtIndex'
)
35 return int
(self.GetSize
())
37 def __getitem__
(self
, key
):
39 #
------------------------------------------------------------
40 # Access with
"int" to get Nth item in the list
41 #
------------------------------------------------------------
43 if
-count
<= key
< count
:
45 return self.GetValueAtIndex
(key
)
46 #
------------------------------------------------------------
47 # Access with
"str" to get values by name
48 #
------------------------------------------------------------
49 elif type
(key
) is str
:
51 for idx in range
(count
):
52 value
= self.GetValueAtIndex
(idx
)
56 #
------------------------------------------------------------
58 #
------------------------------------------------------------
59 elif isinstance
(key
, type
(re.compile
('.'
))):
61 for idx in range
(count
):
62 value
= self.GetValueAtIndex
(idx
)
63 re_match
= key.search
(value.name
)