Skip to content

Commit

Permalink
Fix isort errors, add test to check member access in decompiler output
Browse files Browse the repository at this point in the history
  • Loading branch information
mari-mari committed Sep 7, 2023
1 parent 752fd97 commit 4c91671
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion decompiler/frontend/binaryninja/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from binaryninja import BinaryView, Function, load
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
Expand Down
3 changes: 1 addition & 2 deletions decompiler/frontend/binaryninja/handlers/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
11 changes: 11 additions & 0 deletions tests/test_sample_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 4c91671

Please sign in to comment.