From 409d3f7e976ed1ab67afc7d7d04b87ce82bba143 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Fri, 19 Jun 2020 13:58:50 -0400 Subject: add callers/callees documentation, fixes #1687 --- python/function.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'python/function.py') diff --git a/python/function.py b/python/function.py index 114881cf..15f67b35 100644 --- a/python/function.py +++ b/python/function.py @@ -2429,9 +2429,9 @@ class Function(object): @property def call_sites(self): """ - ``call_sites`` returns a list of possible call sites. + ``call_sites`` returns a list of possible call sites contained in this function. This includes ordinary calls, tail calls, and indirect jumps. Not all of the returned call sites - may be true call sites; some may simply be unresolved indirect jumps. + are necessarily true call sites; some may simply be unresolved indirect jumps, for example. :return: List of References that represent the sources of possible calls in this function :rtype: list(ReferenceSource) @@ -2455,6 +2455,13 @@ class Function(object): @property def callees(self): + """ + ``callees`` returns a list of functions that this function calls + 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. + + :return: List of Functions that this function calls + :rtype: list(Function) + """ called = [] for callee_addr in self.callee_addresses: func = self.view.get_function_at(callee_addr, self.platform) @@ -2464,6 +2471,13 @@ class Function(object): @property def callee_addresses(self): + """ + ``callee_addressses`` returns a list of start addresses for functions that call this function. + Does not point to the actual address where the call occurs, just the start of the function that contains the reference. + + :return: List of start addresess for Functions that call this function + :rtype: list(int) + """ result = [] for ref in self.call_sites: result.extend(self.view.get_callees(ref.address, ref.function, ref.arch)) @@ -2471,6 +2485,13 @@ class Function(object): @property def callers(self): + """ + ``callers`` returns a list of functions that call this function + Does not point to the actual address where the call occurs, just the start of the function that contains the call. + + :return: List of start addresess for Functions that call this function + :rtype: list(int) + """ functions = [] for ref in self.view.get_code_refs(self.start): if ref.function is not None: -- cgit v1.3.1