From f28fb80b7b49226006bbb1696c3c2bec07df891e Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 8 Aug 2022 13:57:05 -0400 Subject: implement is_thunk, closes PR #3343 --- python/function.py | 8 ++++++++ python/lowlevelil.py | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'python') diff --git a/python/function.py b/python/function.py index e909ed0a..9a0f099a 100644 --- a/python/function.py +++ b/python/function.py @@ -566,6 +566,14 @@ class Function: """function.BasicBlockList of BasicBlocks in the current function (read-only)""" return BasicBlockList(self) + @property + def is_thunk(self) -> bool: + """Returns True if the function starts with a Tailcall (read-only)""" + if self.llil_if_available is not None: + return self.llil_if_available.is_thunk + else: + return False + @property def comments(self) -> Dict[int, str]: """Dict of comments (read-only)""" diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 137a2d77..74b9e104 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -2876,6 +2876,13 @@ class LowLevelILFunction: finally: core.BNFreeLLILVariablesList(registers) + @property + def is_thunk(self) -> bool: + """Returns True if the function starts with a Tailcall (read-only)""" + if len(self.basic_blocks) == 1: + return isinstance(self.basic_blocks[0][-1], Tailcall) + return False + @property def register_stacks(self) -> List[ILRegisterStack]: """ List of register stacks used in this IL """ -- cgit v1.3.1