MCPcopy
hub / github.com/rocky/python-uncompyle6 / rem_or

Method rem_or

uncompyle6/scanners/scanner3.py:1537–1563  ·  view source on GitHub ↗

Find offsets of all requested between and , optionally ing specified offset, and return list found offsets which are not within any POP_JUMP_IF_TRUE jumps.

(self, start, end, instr, target=None, include_beyond_target=False)

Source from the content-addressed store, hash-verified

1535 count_SETUP_ += 1
1536
1537 def rem_or(self, start, end, instr, target=None, include_beyond_target=False):
1538 """
1539 Find offsets of all requested <instr> between <start> and <end>,
1540 optionally <target>ing specified offset, and return list found
1541 <instr> offsets which are not within any POP_JUMP_IF_TRUE jumps.
1542 """
1543 assert start >= 0 and end <= len(self.code) and start <= end
1544
1545 # Find all offsets of requested instructions
1546 instr_offsets = self.inst_matches(
1547 start, end, instr, target, include_beyond_target
1548 )
1549 # Get all POP_JUMP_IF_TRUE (or) offsets
1550 if self.version[:2] == (3, 0):
1551 jump_true_op = self.opc.JUMP_IF_TRUE
1552 else:
1553 jump_true_op = self.opc.POP_JUMP_IF_TRUE
1554 pjit_offsets = self.inst_matches(start, end, jump_true_op)
1555 filtered = []
1556 for pjit_offset in pjit_offsets:
1557 pjit_tgt = self.get_target(pjit_offset) - 3
1558 for instr_offset in instr_offsets:
1559 if instr_offset <= pjit_offset or instr_offset >= pjit_tgt:
1560 filtered.append(instr_offset)
1561 instr_offsets = filtered
1562 filtered = []
1563 return instr_offsets
1564
1565
1566if __name__ == "__main__":

Callers 2

detect_control_flowMethod · 0.95
detect_control_flowMethod · 0.45

Calls 3

inst_matchesMethod · 0.80
get_targetMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected