From 975b4a852c57599276bc69ef9d93cd553c8eff09 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Sat, 28 Jun 2025 16:43:47 -0400 Subject: args_render_layer example: Fix python errors --- python/examples/args_render_layer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'python/examples') diff --git a/python/examples/args_render_layer.py b/python/examples/args_render_layer.py index 4941bbd1..3f2f6e6d 100644 --- a/python/examples/args_render_layer.py +++ b/python/examples/args_render_layer.py @@ -45,7 +45,7 @@ def get_param_sites(mlil: MediumLevelILFunction) -> Mapping[LowLevelILInstructio :param mlil: MLIL function to search :return: Map of param sites as described above """ - call_sites = {} + call_sites: dict[MediumLevelILInstruction, List[Tuple[int, LowLevelILInstruction]]] = {} mlil = mlil.ssa_form # As a function to handle call and tailcall identically @@ -54,7 +54,7 @@ def get_param_sites(mlil: MediumLevelILFunction) -> Mapping[LowLevelILInstructio for i, param in enumerate(params): llil = param.llil if llil is not None: - def_sites.append((param, llil)) + def_sites.append((i, llil)) continue match param: @@ -73,10 +73,11 @@ def get_param_sites(mlil: MediumLevelILFunction) -> Mapping[LowLevelILInstructio case MediumLevelILConstBase(): # This is wrong, but it works (sometimes) # Oh god, have I just quoted php.net - def_site_idx = mlil.llil.get_instruction_start(param.address) - if def_site_idx is not None: - def_sites.append((i, mlil.llil[def_site_idx].ssa_form)) - continue + if mlil.llil is not None: + def_site_idx = mlil.llil.get_instruction_start(param.address) + if def_site_idx is not None: + def_sites.append((i, mlil.llil[def_site_idx].ssa_form)) + continue if len(def_sites) == 0: log_debug(f"Could not find def site for param {i} in call at {call_site.address:#x}") -- cgit v1.3.1