Skip to content

Commit 19c951b

Browse files
committed
fix default cg param
1 parent cc768af commit 19c951b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ghidrecomp/callgraph.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,17 @@ def get_called_funcs_memo(f: "ghidra.program.model.listing.Function"):
321321

322322

323323
# Recursively calling to build calling graph
324-
def get_calling(f: "ghidra.program.model.listing.Function", cgraph: CallGraph = CallGraph(), depth: int = 0, visited: tuple = None, verbose=False, include_ns=True, start_time=None, max_run_time=None, max_depth=MAX_DEPTH):
324+
def get_calling(f: "ghidra.program.model.listing.Function", cgraph: CallGraph = None, depth: int = 0, visited: tuple = None, verbose=False, include_ns=True, start_time=None, max_run_time=None, max_depth=MAX_DEPTH):
325325
"""
326326
Build a call graph of all calling functions
327327
Traverses depth first
328328
"""
329329

330330
if f == None:
331331
return None
332+
333+
if cgraph is None:
334+
cgraph = CallGraph()
332335

333336
if depth == 0:
334337
if verbose:
@@ -390,14 +393,17 @@ def func_is_external(f: "ghidra.program.model.listing.Function"):
390393
# Recursively calling to build called graph
391394

392395

393-
def get_called(f: "ghidra.program.model.listing.Function", cgraph: CallGraph = CallGraph(), depth: int = 0, visited: list = [], verbose=False, include_ns=True, start_time=None, max_run_time=None, max_depth=MAX_DEPTH):
396+
def get_called(f: "ghidra.program.model.listing.Function", cgraph: CallGraph = None, depth: int = 0, visited: list = [], verbose=False, include_ns=True, start_time=None, max_run_time=None, max_depth=MAX_DEPTH):
394397
"""
395398
Build a call graph of all called functions
396399
Traverses depth first
397400
"""
398401

399402
if f == None:
400403
return None
404+
405+
if cgraph is None:
406+
cgraph = CallGraph()
401407

402408
if depth == 0:
403409
if verbose:

0 commit comments

Comments
 (0)