diff options
| author | Jon Palmisciano <jp@jonpalmisc.com> | 2021-06-02 16:38:01 -0400 |
|---|---|---|
| committer | Jon Palmisciano <jp@jonpalmisc.com> | 2021-06-12 12:57:02 -0400 |
| commit | c36c2f555fae8b5a707193e8d5a0d0a0697e9451 (patch) | |
| tree | deb4a06ce97a2a552cf66af1ee2d87a769636bfa /suite/testcommon.py | |
| parent | 38563222ee1c4ae4b5e9287277f04ec3cb4bd896 (diff) | |
Function: Added `BNGetFunctionILVariables()` / `get_il_vars()` method
Diffstat (limited to 'suite/testcommon.py')
| -rw-r--r-- | suite/testcommon.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/suite/testcommon.py b/suite/testcommon.py index 6941f8b3..a70ec09f 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -1302,6 +1302,26 @@ class VerifyBuilder(Builder): finally: self.delete_package("helloworld") + def test_get_il_vars(self): + file_name = self.unpackage_file("helloworld") + try: + with binja.BinaryViewType.get_view_of_file(file_name) as bv: + main_func = bv.get_functions_by_name("main")[0] + + mlil_vars = main_func.get_il_vars(FunctionGraphType.MediumLevelILFunctionGraph) + mlil_vars = list(map(lambda v: v.name, mlil_vars)) + mlil_vars.sort() + + hlil_vars = main_func.get_il_vars(FunctionGraphType.HighLevelILFunctionGraph) + hlil_vars = list(map(lambda v: v.name, hlil_vars)) + hlil_vars.sort() + + assert mlil_vars == ['argc', 'argv', 'envp', 'r0', 'r3', 'var_10', 'var_c'] + assert hlil_vars == ['argc', 'argv', 'envp'] + return True + finally: + self.delete_package("helloworld") + def test_verify_BNDB_round_trip(self): """Binary Ninja Database output doesn't match its input""" # This will test Binja's ability to save and restore databases |
