Skip to content

Commit 2897f79

Browse files
committed
Fix imported functions being ignored when building call sites, and fix python callers listing referenced calls
Fixes #7308
1 parent 0151725 commit 2897f79

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

python/function.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3242,6 +3242,7 @@ def callees(self) -> List['Function']:
32423242
"""
32433243
``callees`` returns a list of functions that this function calls
32443244
This does not include the address of those calls, rather just the function objects themselves. Use :py:meth:`call_sites` to identify the location of these calls.
3245+
This does not include calls to imported functions, as they do not have a function object, use :py:meth:`callee_addresses` for that.
32453246
32463247
:return: List of Functions that this function calls
32473248
:rtype: list(Function)
@@ -3259,7 +3260,7 @@ def callees(self) -> List['Function']:
32593260
@property
32603261
def callee_addresses(self) -> List[int]:
32613262
"""
3262-
``callee_addressses`` returns a list of start addresses for functions that this function calls.
3263+
``callee_addresses`` returns a list of start addresses for functions that this function calls.
32633264
Does not point to the actual address where the call occurs, just the start of the function that contains the reference.
32643265
32653266
:return: List of start address for functions that this function calls
@@ -3280,7 +3281,7 @@ def callers(self) -> List['Function']:
32803281
:rtype: list(Function)
32813282
"""
32823283
functions = []
3283-
for ref in self.view.get_code_refs(self.start):
3284+
for ref in self.caller_sites:
32843285
if ref.function is not None:
32853286
functions.append(ref.function)
32863287
return functions
@@ -3289,15 +3290,12 @@ def callers(self) -> List['Function']:
32893290
def caller_sites(self) -> Generator['binaryview.ReferenceSource', None, None]:
32903291
"""
32913292
``caller_sites`` returns a list of ReferenceSource objects corresponding to the addresses
3292-
in functions which reference this function
3293+
in functions which call this function
32933294
32943295
:return: List of ReferenceSource objects of the call sites to this function
32953296
:rtype: list(ReferenceSource)
32963297
"""
3297-
for site in self.view.get_code_refs(self.start):
3298-
for llil in site.llils:
3299-
if isinstance(llil, Localcall) and llil.dest.value == self.start:
3300-
yield site
3298+
return self.view.get_callers(self.start)
33013299

33023300
@property
33033301
def workflow(self):

0 commit comments

Comments
 (0)