Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-698 - ANALYZED flag fixed better

ghizard90dd0e6dd57c
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
index 0ff7a1f3a9..d8a52fba89 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisManager.java
@@ -1110,13 +1110,14 @@ public class AutoAnalysisManager implements DomainObjectListener, DomainObjectCl
int answer = OptionDialog.showYesNoDialog(tool.getToolFrame(), "Analyze",
"<html>" + HTMLUtilities.escapeHTML(program.getDomainFile().getName()) +
" has not been analyzed. Would you like to analyze it now?");
- boolean analyze = answer == OptionDialog.OPTION_ONE;
- if (!analyze) {
- // Must set this to false at each fall-out location. Setting it true too early
- // results in false positives. It is set true only at the beginning of analysis.
- GhidraProgramUtilities.setAnalyzedFlag(program, false);
- }
- return analyze;
+ //Set to false for now. ANALYZED is a tri-valued variable:
+ // null means not asked.
+ // false means asked but could still turn true when analysis happens.
+ // true means analysis has started.
+ //Setting false here only works due to this code only being reachable
+ // because of the behavior of GhidraProgramUtilities.shouldAskToAnalyze(program) above.
+ GhidraProgramUtilities.setAnalyzedFlag(program, false);
+ return answer == OptionDialog.OPTION_ONE; //Analyze
}
return false;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
index 96cfa1e16f..802540285e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AutoAnalysisPlugin.java
@@ -188,9 +188,6 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
analysisMgr.initializeOptions(); // get initial options
if (!showOptionsDialog(program)) {
- // Must set this to false at each fall-out location. Setting it true too early
- // results in false positives. It is set true only at the beginning of analysis.
- GhidraProgramUtilities.setAnalyzedFlag(program, false);
return;
}