You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Add debug option on Python 3 find_jump_targets()
This commit is contained in:
@@ -199,7 +199,7 @@ class Scanner3(Scanner):
|
|||||||
|
|
||||||
# Get jump targets
|
# Get jump targets
|
||||||
# Format: {target offset: [jump offsets]}
|
# Format: {target offset: [jump offsets]}
|
||||||
jump_targets = self.find_jump_targets()
|
jump_targets = self.find_jump_targets(show_asm)
|
||||||
|
|
||||||
for inst in bytecode:
|
for inst in bytecode:
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ class Scanner3(Scanner):
|
|||||||
for _ in range(self.op_size(op)):
|
for _ in range(self.op_size(op)):
|
||||||
self.prev_op.append(offset)
|
self.prev_op.append(offset)
|
||||||
|
|
||||||
def find_jump_targets(self):
|
def find_jump_targets(self, debug):
|
||||||
"""
|
"""
|
||||||
Detect all offsets in a byte code which are jump targets
|
Detect all offsets in a byte code which are jump targets
|
||||||
where we might insert a COME_FROM instruction.
|
where we might insert a COME_FROM instruction.
|
||||||
@@ -457,6 +457,13 @@ class Scanner3(Scanner):
|
|||||||
elif op == self.opc.END_FINALLY and offset in self.fixed_jumps:
|
elif op == self.opc.END_FINALLY and offset in self.fixed_jumps:
|
||||||
label = self.fixed_jumps[offset]
|
label = self.fixed_jumps[offset]
|
||||||
targets[label] = targets.get(label, []) + [offset]
|
targets[label] = targets.get(label, []) + [offset]
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
# DEBUG:
|
||||||
|
if debug in ('both', 'after'):
|
||||||
|
import pprint as pp
|
||||||
|
pp.pprint(self.structs)
|
||||||
|
|
||||||
return targets
|
return targets
|
||||||
|
|
||||||
def build_statement_indices(self):
|
def build_statement_indices(self):
|
||||||
|
Reference in New Issue
Block a user