diff --git a/decompiler/frontend/binaryninja/frontend.py b/decompiler/frontend/binaryninja/frontend.py index 94c2c8546..ba0e7879d 100644 --- a/decompiler/frontend/binaryninja/frontend.py +++ b/decompiler/frontend/binaryninja/frontend.py @@ -7,12 +7,12 @@ from binaryninja import BinaryView, BinaryViewType, Function from binaryninja.types import SymbolType from decompiler.structures.graphs.cfg import ControlFlowGraph +from decompiler.structures.pseudo.complextypes import ComplexTypeMap from decompiler.structures.pseudo.expressions import Variable from decompiler.structures.pseudo.typing import Type from decompiler.task import DecompilerTask from decompiler.util.options import Options -from decompiler.structures.pseudo.complextypes import ComplexTypeMap from ..frontend import Frontend from .lifter import BinaryninjaLifter from .parser import BinaryninjaParser diff --git a/decompiler/frontend/binaryninja/handlers/assignments.py b/decompiler/frontend/binaryninja/handlers/assignments.py index 7991ce8f2..fbd1e1d65 100644 --- a/decompiler/frontend/binaryninja/handlers/assignments.py +++ b/decompiler/frontend/binaryninja/handlers/assignments.py @@ -18,8 +18,7 @@ RegisterPair, UnaryOperation, ) -from decompiler.structures.pseudo.complextypes import Struct -from decompiler.structures.pseudo.complextypes import Union +from decompiler.structures.pseudo.complextypes import Struct, Union from decompiler.structures.pseudo.operations import MemberAccess diff --git a/tests/test_sample_binaries.py b/tests/test_sample_binaries.py index 8537c0660..d013b2e18 100644 --- a/tests/test_sample_binaries.py +++ b/tests/test_sample_binaries.py @@ -260,6 +260,17 @@ def test_tailcall_display(): assert output.count("return fseeko(") == 1 +def test_member_access_is_in_decompiled_code(): + """Test that arg1#0->_IO_read_ptr, arg1#0->_IO_write_base and arg1#0->_IO_save_base + are displayed as member accesses in the decompiled code.""" + args = ["python", "decompile.py", "tests/coreutils/binaries/sha224sum", "rpl_fseeko"] + output = str(subprocess.run(args, check=True, capture_output=True).stdout) + + assert "->_IO_read_ptr" in output + assert "->_IO_save" in output + assert "->_IO_write_base" in output + + def test_issue_70(): """Test Issue #70.""" args = ["python", "decompile.py", "tests/samples/others/issue-70.bin", "main"]