Skip to content

Commit 4584151

Browse files
committed
Fix il magic variables for lifted, mmlil, mmlil_ssa
1 parent 9985498 commit 4584151

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

python/scriptingprovider.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,15 @@ def _get_current_llil(instance: PythonScriptingInstance):
15251525
PythonScriptingProvider.register_magic_variable("current_llil", _get_current_llil)
15261526

15271527

1528+
def _get_current_lifted_il(instance: PythonScriptingInstance):
1529+
if instance.interpreter.active_func is None:
1530+
return None
1531+
return instance.interpreter.active_func.lifted_il_if_available
1532+
1533+
1534+
PythonScriptingProvider.register_magic_variable("current_lifted_il", _get_current_lifted_il)
1535+
1536+
15281537
def _get_current_llil_ssa(instance: PythonScriptingInstance):
15291538
if instance.interpreter.locals["current_llil"] is None:
15301539
return None
@@ -1538,6 +1547,28 @@ def _get_current_llil_ssa(instance: PythonScriptingInstance):
15381547
)
15391548

15401549

1550+
def _get_current_mapped_mlil(instance: PythonScriptingInstance):
1551+
if instance.interpreter.active_func is None:
1552+
return None
1553+
return instance.interpreter.active_func.mmlil_if_available
1554+
1555+
1556+
PythonScriptingProvider.register_magic_variable("current_mapped_mlil", _get_current_mapped_mlil)
1557+
1558+
1559+
def _get_current_mapped_mlil_ssa(instance: PythonScriptingInstance):
1560+
if instance.interpreter.locals["current_mapped_mlil"] is None:
1561+
return None
1562+
return instance.interpreter.locals["current_mapped_mlil"].ssa_form
1563+
1564+
1565+
PythonScriptingProvider.register_magic_variable(
1566+
"current_mapped_mlil_ssa",
1567+
_get_current_mapped_mlil_ssa,
1568+
depends_on=["current_mapped_mlil"]
1569+
)
1570+
1571+
15411572
def _get_current_mlil(instance: PythonScriptingInstance):
15421573
if instance.interpreter.active_func is None:
15431574
return None
@@ -1770,8 +1801,14 @@ def _get_current_il_function(instance: PythonScriptingInstance):
17701801
ilType = instance.interpreter.locals["current_ui_view_location"].getILViewType()
17711802
if ilType == FunctionGraphType.LowLevelILFunctionGraph:
17721803
return instance.interpreter.locals["current_llil"]
1804+
elif ilType == FunctionGraphType.LiftedILFunctionGraph:
1805+
return instance.interpreter.locals["current_lifted_il"]
17731806
elif ilType == FunctionGraphType.LowLevelILSSAFormFunctionGraph:
17741807
return instance.interpreter.locals["current_llil_ssa"]
1808+
elif ilType == FunctionGraphType.MappedMediumLevelILFunctionGraph:
1809+
return instance.interpreter.locals["current_mapped_mlil"]
1810+
elif ilType == FunctionGraphType.MappedMediumLevelILSSAFormFunctionGraph:
1811+
return instance.interpreter.locals["current_mapped_mlil_ssa"]
17751812
elif ilType == FunctionGraphType.MediumLevelILFunctionGraph:
17761813
return instance.interpreter.locals["current_mlil"]
17771814
elif ilType == FunctionGraphType.MediumLevelILSSAFormFunctionGraph:
@@ -1789,11 +1826,14 @@ def _get_current_il_function(instance: PythonScriptingInstance):
17891826
depends_on=[
17901827
"current_ui_view_location",
17911828
"current_llil",
1829+
"current_lifted_il",
17921830
"current_llil_ssa",
1831+
"current_mapped_mlil",
1832+
"current_mapped_mlil_ssa",
17931833
"current_mlil",
17941834
"current_mlil_ssa",
17951835
"current_hlil",
1796-
"current_hlil_ssa"
1836+
"current_hlil_ssa",
17971837
]
17981838
)
17991839

0 commit comments

Comments
 (0)