summaryrefslogtreecommitdiff
path: root/suite/api_test.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2022-06-23 13:57:56 -0400
committerPeter LaFosse <peter@vector35.com>2022-07-03 08:10:29 -0400
commitce335c283f87297855bd9360e7063f3b8ef34afc (patch)
tree7c7849153875187251d1dee02350fd2ab0b4c150 /suite/api_test.py
parent449595e320957a25e136605e04792d4f1237e7ac (diff)
Add some helper routines for getting the IL of callsites
Diffstat (limited to 'suite/api_test.py')
-rw-r--r--suite/api_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/suite/api_test.py b/suite/api_test.py
index 793b2b1a..8ef6aa04 100644
--- a/suite/api_test.py
+++ b/suite/api_test.py
@@ -2094,6 +2094,18 @@ class TestWithFunction(TestWithBinaryView):
self.func.add_user_code_ref(from_addr, to_addr)
refs = list(self.func.view.get_code_refs(from_addr))
+ f = self.bv.get_functions_by_name("puts")[0]
+ refs = list(f.caller_sites)
+ assert len(refs) == 2
+ assert str(refs[0].llil) == 'call(0x82dc)'
+ assert str(refs[1].llil) == 'call(0x82dc)'
+
+ assert str(refs[0].mlil) == '0x82dc("helloworld")'
+ assert str(refs[1].mlil) == '0x82dc("goodbyeworld")'
+
+ assert str(refs[0].hlil) == 'puts("helloworld")'
+ assert str(refs[1].hlil) == 'puts("goodbyeworld")'
+
def test_reg_values(self):
r0 = self.bv.arch.get_reg_index('r0')
r3 = self.bv.arch.get_reg_index('r3')