Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1 ProgramLoader javadoc update

ghidra181a379c09a44
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java
index cfe8a786c8..710bdef42f 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java
@@ -1228,7 +1228,7 @@ public class HeadlessAnalyzer {
program = null;
// Only commit if it's a shared project.
- commitProgram(domFile);
+ commit(domFile);
}
}
catch (VersionException e) {
@@ -1469,7 +1469,7 @@ public class HeadlessAnalyzer {
return true;
}
- private void commitProgram(DomainFile df) throws IOException {
+ private void commit(DomainFile df) throws IOException {
RepositoryAdapter rep = project.getRepository();
if (rep != null) {
@@ -1636,7 +1636,7 @@ public class HeadlessAnalyzer {
for (Loaded<? extends DomainObject> loaded : loadResults) {
if (!loaded.check(DomainObject::isTemporary)) {
loaded.close(); // we need to close before committing
- commitProgram(loaded.getSavedDomainFile());
+ commit(loaded.getSavedDomainFile());
}
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/ProgramLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/ProgramLoader.java
index 02e041c7fd..5fb0452b59 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/ProgramLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/ProgramLoader.java
@@ -37,13 +37,15 @@ import ghidra.util.exception.*;
import ghidra.util.task.TaskMonitor;
/**
- * Used to load (import) a new {@link Program}
+ * Used to load (import) a new {@link Program} or other {@link DomainObject}.
*/
public class ProgramLoader {
/**
* Gets a new {@link ProgramLoader} {@link Builder} which can be used to load a new
- * {@link Program}
+ * {@link Program}. This builder may optionally support loading of other {@link DomainObject}
+ * implementations through the use of the {@link Builder#loadAll()} method in place of the
+ * Program-specific load methods.
*
* @return A new {@link ProgramLoader} {@link Builder} which can be used to load a new
* {@link Program}
@@ -490,7 +492,9 @@ public class ProgramLoader {
/**
* Loads the specified {@link #source(ByteProvider) source} with this {@link Builder}'s
- * current configuration
+ * current configuration. This method is intended to handle various {@link DomainObject}
+ * implementations unlike the other Program specific load methods. Care must be taken to
+ * check the specific implementation class before casting.
*
* @return The {@link LoadResults} which contains one or more {@link Loaded}
* {@link DomainObject}s (created but not saved)
@@ -508,7 +512,9 @@ public class ProgramLoader {
/**
* Loads the specified {@link #source(ByteProvider) source} with this {@link Builder}'s
- * current configuration
+ * current configuration. This method is intended to handle various {@link DomainObject}
+ * implementations unlike the other Program specific load methods. Care must be taken to
+ * check the specific implementation class before casting.
*
* @param consumer A reference to the object "consuming" the returned {@link LoadResults},
* used to ensure the underlying {@link DomainObject}s are only closed when every consumer