Skip to content

Commit

Permalink
[Lifter] Fix tailcall lifting (#61)
Browse files Browse the repository at this point in the history
* Fix spelling error
* Add testcase for tailcall
  • Loading branch information
exuehui authored Feb 15, 2022
1 parent d39078b commit 93ddcab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decompiler/frontend/binaryninja/handlers/calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def lift_call(self, call: mediumlevelil.MediumLevelILCall, ssa: bool = False, **
[self._lifter.lift(parameter, parent=call) for parameter in call.params],
vartype=dest.type.copy(),
writes_memory=call.output_dest_memory if ssa else None,
meta_data={"param_names": self._lift_call_parameter_names(call), "is_failcall": isinstance(call, Tailcall)},
meta_data={"param_names": self._lift_call_parameter_names(call), "is_tailcall": isinstance(call, Tailcall)},
),
)

Expand Down
8 changes: 8 additions & 0 deletions tests/test_sample_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ def test_global_import_address_symbol():
assert output1.count("g_35_1 = &(g_35)") == 1
assert output1.count("g_38 = ") == 1
assert output1.count("g_38_1 = &(g_38)") == 1


def test_tailcall_display():
"""Test that we display tailcalls correctly."""
args = ["python", "decompile.py", "tests/coreutils/binaries/sha224sum", "rpl_fseeko"]
output = str(subprocess.run(args, check=True, capture_output=True).stdout)

assert output.count("return fseeko(") == 1

0 comments on commit 93ddcab

Please sign in to comment.