diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2021-04-22 12:09:22 -0600 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2021-04-22 12:09:22 -0600 |
| commit | ace2b323e7bbc6bd612d1cb3be064275dc9f7a30 (patch) | |
| tree | 2f0d902f12380f0f60b3bfdd468af0c2bf196ba2 | |
| parent | fdbab52fd8ae36dc3474e2791636e8f884f4385f (diff) | |
Add unit test for HLIL arrays
| m--------- | suite/binaries | 0 | ||||
| -rw-r--r-- | suite/testcommon.py | 23 |
2 files changed, 23 insertions, 0 deletions
diff --git a/suite/binaries b/suite/binaries -Subproject 60f786ba50db076bd1ceb60687d8e5c975f1895 +Subproject 44d570b5b6873bdadbd67b5b472b08dc5656c73 diff --git a/suite/testcommon.py b/suite/testcommon.py index 95c10f85..19c7f143 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -1136,6 +1136,29 @@ class TestBuilder(Builder): self.delete_package("type_xref.bndb") return fixOutput(sorted(retinfo)) + def test_hlil_arrays(self): + """HLIL array resolution failure""" + + retinfo = [] + file_name = self.unpackage_file("array_test.bndb") + if not os.path.exists(file_name): + return retinfo + + with BinaryViewType.get_view_of_file(file_name) as bv: + if bv is None: + return retinfo + + for func in bv.functions: + for line in func.hlil.root.lines: + retinfo.append("Function: {:x} HLIL line: {}".format(func.start, str(line))) + for hlilins in func.hlil.instructions: + retinfo.append("Function: {:x} Instruction: {:x} HLIL->LLIL instruction: {}".format(func.start, hlilins.address, str(hlilins.llil))) + retinfo.append("Function: {:x} Instruction: {:x} HLIL->MLIL instruction: {}".format(func.start, hlilins.address, str(hlilins.mlil))) + retinfo.append("Function: {:x} Instruction: {:x} HLIL->MLILS instruction: {}".format(func.start, hlilins.address, str(sorted(list(map(str, hlilins.mlils)))))) + + self.delete_package("array_test.bndb") + return fixOutput(sorted(retinfo)) + class VerifyBuilder(Builder): """ The VerifyBuilder is for tests that verify Binary Ninja against expected output. |
