Ghidra is a software reverse engineering (SRE) framework
FunctionPurgeAnalysisCmd: compute progress without rebuilding the entry-point set
ayam0481e777df6212
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionPurgeAnalysisCmd.java b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionPurgeAnalysisCmd.javaindex 8f0ad57ab4..1cb55d8fad 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionPurgeAnalysisCmd.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/FunctionPurgeAnalysisCmd.java@@ -67,7 +67,7 @@ public class FunctionPurgeAnalysisCmd extends BackgroundCommand<Program> {setupNearFarModels();}- AddressSetView set = entryPoints;+ AddressSet set = new AddressSet(entryPoints);long maxCount = set.getNumAddresses();@@ -79,8 +79,11 @@ public class FunctionPurgeAnalysisCmd extends BackgroundCommand<Program> {break;}- set = set.subtract(- new AddressSet(program, entryPoints.getMinAddress(), function.getEntryPoint()));+ // Progress is the number of entry-point addresses consumed so far. Removing the+ // processed range from one copy of the set avoids the full set copy that+ // AddressSet.subtract() made on each iteration, which was quadratic in the+ // number of functions.+ set.deleteFromMin(function.getBody().getMaxAddress());monitor.setProgress(maxCount - set.getNumAddresses());monitor.setMessage("Purge " + function.getName());