Merge remote-tracking branch 'origin/Ghidra_11.2'

This commit is contained in:
Ryan Kurtz 2024-09-13 10:29:50 -04:00
commit 2d8c0fbdd8
2 changed files with 16 additions and 5 deletions

View File

@ -810,12 +810,14 @@ public class TraceRmiTarget extends AbstractTarget {
public MatchedMethod getBest(String name, ActionName action,
Supplier<List<? extends MethodMatcher>> preferredSupplier) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferredSupplier.get()));
return getBest(name, action, preferredSupplier.get());
}
public MatchedMethod getBest(String name, ActionName action,
List<? extends MethodMatcher> preferred) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferred));
synchronized (map) {
return map.computeIfAbsent(name, n -> chooseBest(action, preferred));
}
}
private MatchedMethod chooseBest(ActionName name, List<? extends MethodMatcher> preferred) {

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);
}