mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-6347: SourceLanguageAnalyzer now tells user to rerun analysis if new
languages were found
This commit is contained in:
@@ -17,6 +17,7 @@ package ghidra.app.plugin.core.analysis;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import ghidra.app.services.*;
|
import ghidra.app.services.*;
|
||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
@@ -64,20 +65,23 @@ public class SourceLanguageAnalyzer extends AbstractAnalyzer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for new source languages in the program
|
Set<SourceLanguageID> currentIds = program.getSourceLanguageIDs();
|
||||||
Set<SourceLanguageID> ids = SourceLanguageService.find(program, log, monitor);
|
Set<SourceLanguageID> newIds = SourceLanguageService.find(program, log, monitor);
|
||||||
|
program.setSourceLanguageIDs(newIds);
|
||||||
|
|
||||||
// Update the "Source Languages" program property
|
if (newIds.stream().anyMatch(Predicate.not(currentIds::contains))) {
|
||||||
program.setSourceLanguageIDs(ids);
|
log.appendMsg(NAME + "> New source languages were found.\n" +
|
||||||
|
"New analyzers may be available if the program is reopened and Auto Analysis is run again.");
|
||||||
|
}
|
||||||
|
|
||||||
// Optionally add source language spec extensions
|
// Optionally add source language spec extensions
|
||||||
if (addSpecExtensions) {
|
if (addSpecExtensions) {
|
||||||
if (program.hasExclusiveAccess()) {
|
if (program.hasExclusiveAccess()) {
|
||||||
SourceLanguageService.addSpecExtensions(program, ids, log, monitor);
|
SourceLanguageService.addSpecExtensions(program, newIds, log, monitor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log.appendMsg(
|
log.appendMsg(
|
||||||
NAME + ": Cannot add spec extensions without exclusive access to program.");
|
NAME + "> Cannot add spec extensions without exclusive access to program.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user