Merge remote-tracking branch

'origin/GP-4865_ghidra007_PR-6833_epinter_nsa-fixrttiloop' into
Ghidra_11.2 (Closes #6832, Closes #6833)
This commit is contained in:
Ryan Kurtz 2024-09-13 10:24:02 -04:00
commit b4d7747853

View File

@ -404,12 +404,15 @@ public class RecoveredClassHelper {
* @param function the given function
* @param getThunkedFunction if true, use the thunked function in the map, if false use the
* directly called function from the calling function even if it is a thunk
* @param visited the set of function entry point addresses already processed
* @return a map of the given functions calling addresses to the called functions
* @throws CancelledException if cancelled
*/
public Map<Address, Function> getFunctionCallMap(Function function, boolean getThunkedFunction)
public Map<Address, Function> getFunctionCallMap(Function function, boolean getThunkedFunction,
Set<Address> visited)
throws CancelledException {
visited.add(function.getEntryPoint());
Map<Address, Function> functionCallMap = new HashMap<Address, Function>();
InstructionIterator instructions =
@ -435,9 +438,10 @@ public class RecoveredClassHelper {
Address functionAddress = reference.getFromAddress();
Function secondHalfOfFunction =
extendedFlatAPI.getReferencedFunction(functionAddress);
if (secondHalfOfFunction != null) {
if (secondHalfOfFunction != null &&
!visited.contains(secondHalfOfFunction.getEntryPoint())) {
Map<Address, Function> functionCallMap2 =
getFunctionCallMap(secondHalfOfFunction, false);
getFunctionCallMap(secondHalfOfFunction, false, visited);
for (Address addr : functionCallMap2.keySet()) {
monitor.checkCancelled();
functionCallMap.put(addr, functionCallMap2.get(addr));
@ -449,6 +453,11 @@ public class RecoveredClassHelper {
return functionCallMap;
}
public Map<Address, Function> getFunctionCallMap(Function function, boolean getThunkedFunction)
throws CancelledException {
return getFunctionCallMap(function, getThunkedFunction, new HashSet<>());
}
public void updateNamespaceToClassMap(Namespace namespace, RecoveredClass recoveredClass) {
namespaceToClassMap.put(namespace, recoveredClass);
}