1 STRING_EXTENSION_OUTSIDE
(SBInstructionList
)
3 %extend lldb
::SBInstructionList
{
7 '''Iterate over all instructions in a lldb.SBInstructionList
9 return lldb_iter
(self
, 'GetSize'
, 'GetInstructionAtIndex'
)
12 '''Access len of the instruction list.'''
13 return int
(self.GetSize
())
15 def __getitem__
(self
, key
):
16 '''Access instructions by integer index for array access or by lldb.SBAddress to find an instruction that matches a section offset address object.'''
18 # Find an instruction by index
20 if
-count
<= key
< count
:
22 return self.GetInstructionAtIndex
(key
)
23 elif type
(key
) is SBAddress
:
24 # Find an instruction using a lldb.SBAddress object
25 lookup_file_addr
= key.file_addr
27 for idx in range
(self.GetSize
()):
28 inst
= self.GetInstructionAtIndex
(idx
)
29 inst_file_addr
= inst.addr.file_addr
30 if inst_file_addr
== lookup_file_addr
:
32 elif inst_file_addr
> lookup_file_addr
: