mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-01 12:07:23 +02:00
GP-5562 added checks to AddProgramToH2BSimDatabaseScript
This commit is contained in:
@@ -25,7 +25,6 @@ import generic.lsh.vector.LSHVectorFactory;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.features.base.values.GhidraValuesMap;
|
||||
import ghidra.features.bsim.query.*;
|
||||
import ghidra.features.bsim.query.BSimServerInfo.DBType;
|
||||
import ghidra.features.bsim.query.FunctionDatabase.BSimError;
|
||||
import ghidra.features.bsim.query.FunctionDatabase.ErrorCategory;
|
||||
import ghidra.features.bsim.query.description.DatabaseInformation;
|
||||
@@ -56,6 +55,12 @@ public class AddProgramToH2BSimDatabaseScript extends GhidraScript {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentProgram.isChanged()) {
|
||||
popup(currentProgram.getName() + " has unsaved changes. Please save the program" +
|
||||
" before adding it to a BSim database.");
|
||||
return;
|
||||
}
|
||||
|
||||
GhidraValuesMap values = new GhidraValuesMap();
|
||||
values.defineFile(DATABASE, null, new File(System.getProperty("user.home")));
|
||||
values.setValidator((valueMap, status) -> {
|
||||
@@ -118,6 +123,11 @@ public class AddProgramToH2BSimDatabaseScript extends GhidraScript {
|
||||
final Iterator<Function> iter = fman.getFunctions(true);
|
||||
gensig.scanFunctions(iter, fman.getFunctionCount(), monitor);
|
||||
final DescriptionManager manager = gensig.getDescriptionManager();
|
||||
if (manager.numFunctions() == 0) {
|
||||
Msg.showWarn(this, null, "Skipping Insert",
|
||||
currentProgram.getName() + " contains no functions with bodies");
|
||||
return;
|
||||
}
|
||||
|
||||
//need to call sortCallGraph on each FunctionDescription
|
||||
//this de-dupes the list of callees for each function
|
||||
|
||||
Reference in New Issue
Block a user