MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / __getitem__

Method __getitem__

python/basicblock.py:187–199  ·  view source on GitHub ↗
(self, i)

Source from the content-addressed store, hash-verified

185 yield text, size
186
187 def __getitem__(self, i):
188 self._buildStartCache()
189 assert self._instStarts is not None
190 assert self._instLengths is not None
191 if self.view is None:
192 raise Exception("Attempting to iterate a Basic Block with no BinaryView")
193
194 if isinstance(i, slice):
195 return [self[index] for index in range(*i.indices(len(self._instStarts)))]
196 start = self._instStarts[i]
197 length = self._instLengths[i]
198 data = self.view.read(start, length)
199 return self.arch.get_instruction_text(data, start)
200
201 def __contains__(self, i: int):
202 return self.start <= i < self.end

Callers

nothing calls this directly

Calls 3

_buildStartCacheMethod · 0.95
readMethod · 0.45
get_instruction_textMethod · 0.45

Tested by

no test coverage detected