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

Method __iter__

python/basicblock.py:162–185  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

160 return hash((self.start, self.end, self.arch))
161
162 def __iter__(self) -> Generator[Tuple[List['_function.InstructionTextToken'], int], None, None]:
163 if self.view is None:
164 raise Exception("Attempting to iterate a Basic Block with no BinaryView")
165 if self._instStarts is None:
166 # don't add instruction start cache--the object is likely ephemeral
167 idx = self.start
168 while idx < self.end:
169 data = self.view.read(idx, min(self.arch.max_instr_length, self.end - idx))
170 result = self.arch.get_instruction_text(data, idx)
171 assert result is not None
172 text, size = result
173 if size == 0:
174 break
175 yield text, size
176 idx += size
177 else:
178 assert self._instLengths is not None
179 for start, length in zip(self._instStarts, self._instLengths):
180 result = self.arch.get_instruction_text(self.view.read(start, length), start)
181 assert result is not None
182 text, size = result
183 if size == 0:
184 break
185 yield text, size
186
187 def __getitem__(self, i):
188 self._buildStartCache()

Callers

nothing calls this directly

Calls 2

readMethod · 0.45
get_instruction_textMethod · 0.45

Tested by

no test coverage detected