Skip to content

Commit 0e86ab8

Browse files
committed
Fix infinite recursion with cross-referencing indirect references (#3)
1 parent 7fc9bc7 commit 0e86ab8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

rtl2dot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,17 @@ def dump(func):
8787
# edge node
8888
return
8989
for ref in calls[func].keys():
90-
if calls[func][ref] == "call" or indirects:
90+
if calls[func][ref] is not None:
9191
style = "" if calls[func][ref] == "call" else ' [style="dashed"]'
92-
# Invalidate the reference to avoid loops
93-
calls[func][ref] = None
9492
if local and calls.get(ref, None) is None:
9593
# non-local function
9694
continue
95+
if not indirects and calls[func][ref] == "ref":
96+
# indirect reference, but not requested
97+
continue
9798
if ignore is None or re.match(ignore, ref) is None:
99+
# Invalidate the reference to avoid loops
100+
calls[func][ref] = None
98101
print('"' + func + '" -> "' + ref + '"' + style + ';')
99102
dump(ref)
100103

0 commit comments

Comments
 (0)