mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch 'origin/GP-6925_ryanmkurtz_one-shot-cleanup'
This commit is contained in:
@@ -232,6 +232,7 @@ public class AutoAnalysisManager {
|
||||
analyzer.optionsChanged(options.getOptions(analyzer.getName()), getProgram());
|
||||
|
||||
OneShotAnalysisCommand cmd = new OneShotAnalysisCommand(analyzer, set, log);
|
||||
addListener(cmd);
|
||||
schedule(cmd, analyzer.getPriority().priority());
|
||||
}
|
||||
|
||||
|
||||
@@ -360,9 +360,10 @@ public class AutoAnalysisPlugin extends Plugin implements AutoAnalysisManagerLis
|
||||
options = options.getOptions(analyzer.getName());
|
||||
analyzer.optionsChanged(options, program);
|
||||
|
||||
analysisMgr.schedule(
|
||||
new OneShotAnalysisCommand(analyzer, set, analysisMgr.getMessageLog()),
|
||||
analyzer.getPriority().priority());
|
||||
OneShotAnalysisCommand cmd =
|
||||
new OneShotAnalysisCommand(analyzer, set, analysisMgr.getMessageLog());
|
||||
analysisMgr.addListener(cmd);
|
||||
analysisMgr.schedule(cmd, analyzer.getPriority().priority());
|
||||
|
||||
tool.setStatusInfo("Analysis scheduled: " + analyzer.getName());
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -27,11 +27,14 @@ import ghidra.util.task.TaskMonitor;
|
||||
* Background task to artificially kick off Auto analysis by
|
||||
* calling anything that analyzes bytes.
|
||||
*/
|
||||
public class OneShotAnalysisCommand extends BackgroundCommand<Program> {
|
||||
public class OneShotAnalysisCommand extends BackgroundCommand<Program>
|
||||
implements AutoAnalysisManagerListener {
|
||||
private Analyzer analyzer;
|
||||
private AddressSetView set;
|
||||
private MessageLog log;
|
||||
|
||||
private Program lastProgram;
|
||||
|
||||
public OneShotAnalysisCommand(Analyzer analyzer, AddressSetView set, MessageLog log) {
|
||||
super(analyzer.getName() + " - One Time", true, true, false);
|
||||
this.analyzer = analyzer;
|
||||
@@ -41,6 +44,7 @@ public class OneShotAnalysisCommand extends BackgroundCommand<Program> {
|
||||
|
||||
@Override
|
||||
public boolean applyTo(Program program, TaskMonitor monitor) {
|
||||
this.lastProgram = program;
|
||||
try {
|
||||
monitor.setMessage(analyzer.getName());
|
||||
return analyzer.added(program, set, monitor, log);
|
||||
@@ -50,6 +54,13 @@ public class OneShotAnalysisCommand extends BackgroundCommand<Program> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisEnded(AutoAnalysisManager manager, boolean isCancelled) {
|
||||
if (lastProgram != null) {
|
||||
analyzer.analysisEnded(lastProgram);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusMsg() {
|
||||
String statusMessage = log.getStatus();
|
||||
@@ -60,4 +71,5 @@ public class OneShotAnalysisCommand extends BackgroundCommand<Program> {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user