Skip to content

Commit

Permalink
optional arg for find_all_calls_to_within
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl OS committed Dec 8, 2020
1 parent 22259d0 commit 97b68f4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions FIDL/decompiler_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ def get_all_vars_in_node(cex):
return var_indexes


def find_all_calls_to_within(f_name, ea):
def find_all_calls_to_within(f_name, ea=0, c=None):
"""Finds all calls to a function with the given name \
within the function containing the ``ea`` address.
Expand All @@ -2336,17 +2336,21 @@ def find_all_calls_to_within(f_name, ea):
:type f_name: string
:param ea: any address within the function that may contain the calls
:type ea: int
:param c: if specified, work on this ``controlFlowinator`` object
:type c: :class:`controlFlowinator`, optional
:return: a list of :class:`callObj`
:rtype: list
"""

call_objs = []
try:
c = controlFlowinator(ea=ea, fast=False)
except Exception as e:
print("Failed to find_all_calls_to_within {}".format(f_name))
print(e)
return []

if c is None:
try:
c = controlFlowinator(ea=ea, fast=False)
except Exception as e:
print("Failed to find_all_calls_to_within {}".format(f_name))
print(e)
return []

for co in c.calls:
if f_name.lower() in co.name.lower():
Expand Down

0 comments on commit 97b68f4

Please sign in to comment.