diff --git a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java index ddacceaac8..b483c10e3b 100644 --- a/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java +++ b/Ghidra/Features/Decompiler/ghidra_scripts/classrecovery/RecoveredClassHelper.java @@ -407,9 +407,9 @@ public class RecoveredClassHelper { * @return a map of the given functions calling addresses to the called functions * @throws CancelledException if cancelled */ - public Map
getFunctionCallMap(Function function, boolean getThunkedFunction) + public Map getFunctionCallMap(Function function, boolean getThunkedFunction, Set visited) throws CancelledException { - + visited.add(function.getEntryPoint()); Map functionCallMap = new HashMap(); InstructionIterator instructions = @@ -435,9 +435,9 @@ public class RecoveredClassHelper { Address functionAddress = reference.getFromAddress(); Function secondHalfOfFunction = extendedFlatAPI.getReferencedFunction(functionAddress); - if (secondHalfOfFunction != null) { + if (secondHalfOfFunction != null && !visited.contains(secondHalfOfFunction.getEntryPoint())) { Map functionCallMap2 = - getFunctionCallMap(secondHalfOfFunction, false); + getFunctionCallMap(secondHalfOfFunction, false, visited); for (Address addr : functionCallMap2.keySet()) { monitor.checkCancelled(); functionCallMap.put(addr, functionCallMap2.get(addr)); @@ -449,6 +449,10 @@ public class RecoveredClassHelper { return functionCallMap; } + public Map getFunctionCallMap(Function function, boolean getThunkedFunction) throws CancelledException { + return getFunctionCallMap(function, getThunkedFunction, new HashSet<>()); + } + public void updateNamespaceToClassMap(Namespace namespace, RecoveredClass recoveredClass) { namespaceToClassMap.put(namespace, recoveredClass); }