Skip to content

Ghidra is a software reverse engineering (SRE) framework

Methods in headless were wrongly synchronized. Could lead to deadlock.

Ryan Kurtzd2db19cff70b
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 e47e7fcb6a..6bfcb50b82 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
@@ -58,10 +58,12 @@ import utilities.util.FileUtilities;
* broken out into their own class: {@link HeadlessOptions}. This class is intended to be used
* one of two ways:
* <ul>
- * <li>Used by analyzeHeadless.bat and {@link AnalyzeHeadless} to perform headless analysis based
- * on arguments specified on the command line.</li>
+ * <li>Used by {@link AnalyzeHeadless} to perform headless analysis based on arguments specified
+ * on the command line.</li>
* <li>Used by another tool as a library to perform headless analysis.</li>
* </ul>
+ * <p>
+ * Note: This class is not thread safe.
*/
public class HeadlessAnalyzer {
@@ -207,14 +209,12 @@ public class HeadlessAnalyzer {
* Resets the state of the headless analyzer to the default settings.
*/
public void reset() {
- synchronized (options) {
- options.reset();
- project = null;
- analysisTimedOut = false;
- saveDomainFolder = null;
- storage = new HashMap<>();
- classLoaderForDotClassScripts = null;
- }
+ options.reset();
+ project = null;
+ analysisTimedOut = false;
+ saveDomainFolder = null;
+ storage = new HashMap<>();
+ classLoaderForDotClassScripts = null;
}
/**
@@ -246,104 +246,101 @@ public class HeadlessAnalyzer {
public void processURL(URL ghidraURL, List<File> filesToImport)
throws IOException, MalformedURLException {
- synchronized (options) {
- if (options.readOnly && options.commit) {
- Msg.error(this,
- "Abort due to Headless analyzer error: The requested readOnly option is in conflict " +
- "with the commit option");
- return;
- }
+ if (options.readOnly && options.commit) {
+ Msg.error(this,
+ "Abort due to Headless analyzer error: The requested readOnly option is in conflict " +
+ "with the commit option");
+ return;
+ }
- if (!"ghidra".equals(ghidraURL.getProtocol())) {
- throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
- }
+ if (!"ghidra".equals(ghidraURL.getProtocol())) {
+ throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
+ }
- if (GhidraURL.isLocalProjectURL(ghidraURL)) {
- Msg.error(this,
- "Ghidra URL command form does not supported local project URLs (ghidra:/path...)");
- return;
- }
+ if (GhidraURL.isLocalProjectURL(ghidraURL)) {
+ Msg.error(this,
+ "Ghidra URL command form does not supported local project URLs (ghidra:/path...)");
+ return;
+ }
- String path = ghidraURL.getPath();
- if (path == null) {
- throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
- }
+ String path = ghidraURL.getPath();
+ if (path == null) {
+ throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
+ }
- path = path.trim();
- if (path.length() == 0) {
- throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
- }
+ path = path.trim();
+ if (path.length() == 0) {
+ throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
+ }
- if (!options.runScriptsNoImport) { // Running in -import mode
- if ((filesToImport == null || filesToImport.size() == 0) &&
- options.preScripts.isEmpty() && options.postScripts.isEmpty()) {
- Msg.warn(this, "REPORT: Nothing to do ... must specify files for import.");
- return;
- }
+ if (!options.runScriptsNoImport) { // Running in -import mode
+ if ((filesToImport == null || filesToImport.size() == 0) &&
+ options.preScripts.isEmpty() && options.postScripts.isEmpty()) {
+ Msg.warn(this, "REPORT: Nothing to do ... must specify files for import.");
+ return;
+ }
- if (!path.endsWith("/")) {
- // force explicit folder path so that non-existent folders are created on import
- ghidraURL =
- new URL("ghidra", ghidraURL.getHost(), ghidraURL.getPort(), path + "/");
- }
+ if (!path.endsWith("/")) {
+ // force explicit folder path so that non-existent folders are created on import
+ ghidraURL = new URL("ghidra", ghidraURL.getHost(), ghidraURL.getPort(), path + "/");
}
- else { // Running in -process mode
- if (path.endsWith("/") && path.length() > 1) {
- ghidraURL = new URL("ghidra", ghidraURL.getHost(), ghidraURL.getPort(),
- path.substring(0, path.length() - 1));
- }
+ }
+ else { // Running in -process mode
+ if (path.endsWith("/") && path.length() > 1) {
+ ghidraURL = new URL("ghidra", ghidraURL.getHost(), ghidraURL.getPort(),
+ path.substring(0, path.length() - 1));
}
+ }
- initializeScriptPaths();
- compileScripts();
+ initializeScriptPaths();
+ compileScripts();
- Msg.info(HeadlessAnalyzer.class, "HEADLESS: execution starts");
+ Msg.info(HeadlessAnalyzer.class, "HEADLESS: execution starts");
- GhidraURLConnection c = (GhidraURLConnection) ghidraURL.openConnection();
- c.setReadOnly(options.readOnly); // writable repository connection
+ GhidraURLConnection c = (GhidraURLConnection) ghidraURL.openConnection();
+ c.setReadOnly(options.readOnly); // writable repository connection
- if (c.getRepositoryName() == null) {
- throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
- }
+ if (c.getRepositoryName() == null) {
+ throw new MalformedURLException("Unsupported repository URL: " + ghidraURL);
+ }
- Msg.info(this, "Opening ghidra repository project: " + ghidraURL);
- Object obj = c.getContent();
- if (!(obj instanceof GhidraURLWrappedContent)) {
- throw new IOException(
- "Connect to repository folder failed. Response code: " + c.getResponseCode());
+ Msg.info(this, "Opening ghidra repository project: " + ghidraURL);
+ Object obj = c.getContent();
+ if (!(obj instanceof GhidraURLWrappedContent)) {
+ throw new IOException(
+ "Connect to repository folder failed. Response code: " + c.getResponseCode());
+ }
+ GhidraURLWrappedContent wrappedContent = (GhidraURLWrappedContent) obj;
+ Object content = null;
+ try {
+ content = wrappedContent.getContent(this);
+ if (!(content instanceof DomainFolder)) {
+ throw new IOException("Connect to repository folder failed");
}
- GhidraURLWrappedContent wrappedContent = (GhidraURLWrappedContent) obj;
- Object content = null;
- try {
- content = wrappedContent.getContent(this);
- if (!(content instanceof DomainFolder)) {
- throw new IOException("Connect to repository folder failed");
- }
- DomainFolder folder = (DomainFolder) content;
- project = new HeadlessProject(getProjectManager(), c);
+ DomainFolder folder = (DomainFolder) content;
+ project = new HeadlessProject(getProjectManager(), c);
- if (!checkUpdateOptions()) {
- return; // TODO: Should an exception be thrown?
- }
+ if (!checkUpdateOptions()) {
+ return; // TODO: Should an exception be thrown?
+ }
- if (options.runScriptsNoImport) {
- processNoImport(folder.getPathname());
- }
- else {
- processWithImport(folder.getPathname(), filesToImport);
- }
+ if (options.runScriptsNoImport) {
+ processNoImport(folder.getPathname());
}
- catch (NotFoundException e) {
- throw new IOException("Connect to repository folder failed");
+ else {
+ processWithImport(folder.getPathname(), filesToImport);
}
- finally {
- if (content != null) {
- wrappedContent.release(content, this);
- }
- if (project != null) {
- project.close();
- }
+ }
+ catch (NotFoundException e) {
+ throw new IOException("Connect to repository folder failed");
+ }
+ finally {
+ if (content != null) {
+ wrappedContent.release(content, this);
+ }
+ if (project != null) {
+ project.close();
}
}
}
@@ -369,81 +366,79 @@ public class HeadlessAnalyzer {
public void processLocal(String projectLocation, String projectName, String rootFolderPath,
List<File> filesToImport) throws IOException {
- synchronized (options) {
- if (options.readOnly && options.commit) {
- Msg.error(this,
- "Abort due to Headless analyzer error: The requested readOnly option is " +
- "in conflict with the commit option");
- return;
- }
+ if (options.readOnly && options.commit) {
+ Msg.error(this,
+ "Abort due to Headless analyzer error: The requested readOnly option is " +
+ "in conflict with the commit option");
+ return;
+ }
- // If not importing, remove trailing slash so that non-existent folders aren't created
- if (options.runScriptsNoImport) {
- if ((rootFolderPath.endsWith("/")) && (rootFolderPath.length() > 1)) {
- rootFolderPath = rootFolderPath.substring(0, rootFolderPath.length() - 1);
- }
+ // If not importing, remove trailing slash so that non-existent folders aren't created
+ if (options.runScriptsNoImport) {
+ if ((rootFolderPath.endsWith("/")) && (rootFolderPath.length() > 1)) {
+ rootFolderPath = rootFolderPath.substring(0, rootFolderPath.length() - 1);
+ }
+ }
+ else {
+ // If we are importing, need some files to import or at least a script to run!
+ if ((filesToImport == null || filesToImport.size() == 0) &&
+ options.preScripts.isEmpty() && options.postScripts.isEmpty()) {
+ Msg.warn(this, "REPORT: Nothing to do ... must specify file(s) for import.");
+ return;
}
- else {
- // If we are importing, need some files to import or at least a script to run!
- if ((filesToImport == null || filesToImport.size() == 0) &&
- options.preScripts.isEmpty() && options.postScripts.isEmpty()) {
- Msg.warn(this, "REPORT: Nothing to do ... must specify file(s) for import.");
- return;
- }
- // If importing, add trailing slash if it isn't there so that non-existent folders are created
- if (!rootFolderPath.endsWith("/")) {
- rootFolderPath += "/";
- }
+ // If importing, add trailing slash if it isn't there so that non-existent folders are created
+ if (!rootFolderPath.endsWith("/")) {
+ rootFolderPath += "/";
}
+ }
- initializeScriptPaths();
- compileScripts();
+ initializeScriptPaths();
+ compileScripts();
- Msg.info(HeadlessAnalyzer.class, "HEADLESS: execution starts");
+ Msg.info(HeadlessAnalyzer.class, "HEADLESS: execution starts");
- File dir = new File(projectLocation);
- ProjectLocator locator = new ProjectLocator(dir.getAbsolutePath(), projectName);
+ File dir = new File(projectLocation);
+ ProjectLocator locator = new ProjectLocator(dir.getAbsolutePath(), projectName);
- if (locator.getProjectDir().exists()) {
- project = openProject(locator);
+ if (locator.getProjectDir().exists()) {
+ project = openProject(locator);
+ }
+ else {
+ if (options.runScriptsNoImport) {
+ Msg.error(this, "Could not find project: " + locator +
+ " -- should already exist in -process mode.");
+ throw new IOException("Could not find project: " + locator);
}
- else {
- if (options.runScriptsNoImport) {
- Msg.error(this, "Could not find project: " + locator +
- " -- should already exist in -process mode.");
- throw new IOException("Could not find project: " + locator);
- }
-
- if (!options.runScriptsNoImport && options.readOnly) {
- // assume temporary when importing with readOnly option
- options.deleteProject = true;
- }
- Msg.info(this, "Creating " + (options.deleteProject ? "temporary " : "") +
- "project: " + locator);
- project = getProjectManager().createProject(locator, null, false);
+ if (!options.runScriptsNoImport && options.readOnly) {
+ // assume temporary when importing with readOnly option
+ options.deleteProject = true;
}
- try {
+ Msg.info(this,
+ "Creating " + (options.deleteProject ? "temporary " : "") + "project: " + locator);
+ project = getProjectManager().createProject(locator, null, false);
+ }
- if (!checkUpdateOptions()) {
- return; // TODO: Should an exception be thrown?
- }
+ try {
- if (options.runScriptsNoImport) {
- processNoImport(rootFolderPath);
- }
- else {
- processWithImport(rootFolderPath, filesToImport);
- }
+ if (!checkUpdateOptions()) {
+ return; // TODO: Should an exception be thrown?
}
- finally {
- project.close();
- if (!options.runScriptsNoImport && options.deleteProject) {
- FileUtilities.deleteDir(locator.getProjectDir());
- locator.getMarkerFile().delete();
- }
+
+ if (options.runScriptsNoImport) {
+ processNoImport(rootFolderPath);
+ }
+ else {
+ processWithImport(rootFolderPath, filesToImport);
+ }
+ }
+ finally {
+ project.close();
+ if (!options.runScriptsNoImport && options.deleteProject) {
+ FileUtilities.deleteDir(locator.getProjectDir());
+ locator.getMarkerFile().delete();
}
}
}
@@ -454,47 +449,37 @@ public class HeadlessAnalyzer {
* @return true if the most recent analysis timed out; otherwise, false.
*/
public boolean checkAnalysisTimedOut() {
- synchronized (options) {
- return analysisTimedOut;
- }
+ return analysisTimedOut;
}
void setSaveFolder(DomainFolder domFolder) {
- synchronized (options) {
- saveDomainFolder = domFolder;
+ saveDomainFolder = domFolder;
- if (domFolder != null) {
- Msg.info(this, "Save location changed to: " + domFolder.getPathname());
- }
+ if (domFolder != null) {
+ Msg.info(this, "Save location changed to: " + domFolder.getPathname());
}
}
void addVariableToStorage(String nameOfVar, Object valOfVar) {
- synchronized (options) {
- if (storage.containsKey(nameOfVar)) {
- Msg.warn(this, "Overwriting existing storage variable: " + nameOfVar);
- }
-
- storage.put(nameOfVar, valOfVar);
+ if (storage.containsKey(nameOfVar)) {
+ Msg.warn(this, "Overwriting existing storage variable: " + nameOfVar);
}
+
+ storage.put(nameOfVar, valOfVar);
}
Set<String> getStorageKeys() {
- synchronized (options) {
- return storage.keySet();
- }
+ return storage.keySet();
}
Object getVariableFromStorage(String nameOfVar) {
- synchronized (options) {
- if (!storage.containsKey(nameOfVar)) {
- Msg.warn(this, "The storage variable '" + nameOfVar +
- "' does not exist in HeadlessAnalyzer storage.");
- return null;
- }
-
- return storage.get(nameOfVar);
+ if (!storage.containsKey(nameOfVar)) {
+ Msg.warn(this, "The storage variable '" + nameOfVar +
+ "' does not exist in HeadlessAnalyzer storage.");
+ return null;
}
+
+ return storage.get(nameOfVar);
}
/**
@@ -509,52 +494,48 @@ public class HeadlessAnalyzer {
DomainFolder getDomainFolder(String folderPath, boolean create)
throws IOException, InvalidNameException {
- synchronized (options) {
- DomainFolder domFolder = project.getProjectData().getFolder(folderPath);
+ DomainFolder domFolder = project.getProjectData().getFolder(folderPath);
- if (create && domFolder == null) {
- // Create any folder that doesn't exist
- String cleanPath = folderPath.replaceAll("^" + DomainFolder.SEPARATOR + "+", "");
- cleanPath = cleanPath.replaceAll(DomainFolder.SEPARATOR + "+$", "");
+ if (create && domFolder == null) {
+ // Create any folder that doesn't exist
+ String cleanPath = folderPath.replaceAll("^" + DomainFolder.SEPARATOR + "+", "");
+ cleanPath = cleanPath.replaceAll(DomainFolder.SEPARATOR + "+$", "");
- String[] subfolders = cleanPath.split(DomainFolder.SEPARATOR + "+");
+ String[] subfolders = cleanPath.split(DomainFolder.SEPARATOR + "+");
- int folderIndex = 0;
- String currPath = DomainFolder.SEPARATOR + subfolders[folderIndex];
+ int folderIndex = 0;
+ String currPath = DomainFolder.SEPARATOR + subfolders[folderIndex];
- DomainFolder testFolder = project.getProjectData().getFolder(currPath);
- DomainFolder baseFolder = null;
+ DomainFolder testFolder = project.getProjectData().getFolder(currPath);
+ DomainFolder baseFolder = null;
- // Stay in loop while we see folders that exist
- while ((testFolder != null) && (folderIndex < (subfolders.length - 1))) {
- folderIndex++;
- baseFolder = testFolder;
- testFolder = baseFolder.getFolder(subfolders[folderIndex]);
- }
-
- // If none of the folders exist, create new files starting from the root
- if (folderIndex == 0) {
- baseFolder = project.getProjectData().getRootFolder();
- }
+ // Stay in loop while we see folders that exist
+ while ((testFolder != null) && (folderIndex < (subfolders.length - 1))) {
+ folderIndex++;
+ baseFolder = testFolder;
+ testFolder = baseFolder.getFolder(subfolders[folderIndex]);
+ }
- // Since this method is only called by import, we create any folder that
- // does not exist.
- for (int i = folderIndex; i < subfolders.length; i++) {
- baseFolder = baseFolder.createFolder(subfolders[i]);
- Msg.info(this, "Created project folder: " + subfolders[i]);
- }
+ // If none of the folders exist, create new files starting from the root
+ if (folderIndex == 0) {
+ baseFolder = project.getProjectData().getRootFolder();
+ }
- domFolder = baseFolder;
+ // Since this method is only called by import, we create any folder that
+ // does not exist.
+ for (int i = folderIndex; i < subfolders.length; i++) {
+ baseFolder = baseFolder.createFolder(subfolders[i]);
+ Msg.info(this, "Created project folder: " + subfolders[i]);
}
- return domFolder;
+ domFolder = baseFolder;
}
+
+ return domFolder;
}
boolean storageContainsKey(String nameOfVar) {
- synchronized (options) {
- return storage.containsKey(nameOfVar);
- }
+ return storage.containsKey(nameOfVar);
}
/**
@@ -886,7 +867,7 @@ public class HeadlessAnalyzer {
File parentFile = new File(
c.getResource(c.getSimpleName() + ".class").toURI()).getParentFile();
- currScript = (GhidraScript) c.newInstance();
+ currScript = (GhidraScript) c.getConstructor().newInstance();
currScript.setScriptArgs(scriptArgs);
if (options.propertiesFilePaths.size() > 0) {
@@ -1667,11 +1648,11 @@ public class HeadlessAnalyzer {
}
if (program == null) {
- Msg.error(this,
- "The AutoImporter could not successfully load " + file.getAbsolutePath() +
- " with the provided import parameters. Please ensure that any specified" +
- " processor/cspec arguments are compatible with the loader that is used during" +
- " import and try again.");
+ Msg.error(this, "The AutoImporter could not successfully load " +
+ file.getAbsolutePath() +
+ " with the provided import parameters. Please ensure that any specified" +
+ " processor/cspec arguments are compatible with the loader that is used during" +
+ " import and try again.");
if (options.loaderClass != null && options.loaderClass != BinaryLoader.class) {
Msg.error(this,
@@ -1750,8 +1731,7 @@ public class HeadlessAnalyzer {
}
}
- private void processWithImport(String folderPath, List<File> inputDirFiles)
- throws IOException {
+ private void processWithImport(String folderPath, List<File> inputDirFiles) throws IOException {
storage.clear();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessOptions.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessOptions.java
index d5f09682ba..2526ba033a 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessOptions.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessOptions.java
@@ -28,7 +28,8 @@ import ghidra.program.util.DefaultLanguageService;
import ghidra.util.exception.InvalidInputException;
/**
- * <code>HeadlessOptions</code>. Options for headless analyzer.
+ * Options for headless analyzer.
+ * <p>
* Option state may be adjusted to reflect assumed options
* during processing. If multiple invocations of either
* {@link HeadlessAnalyzer#processLocal(String, String, String, List)} or
@@ -115,7 +116,7 @@ public class HeadlessOptions {
/**
* Resets the options to its default settings.
*/
- public synchronized void reset() {
+ public void reset() {
domainFileNameToProcess = null;
runScriptsNoImport = false;
preScripts = new LinkedList<>();
@@ -160,7 +161,7 @@ public class HeadlessOptions {
* @throws IllegalArgumentException if the specified filename is invalid and contains the
* path separator character '/'.
*/
- public synchronized void setRunScriptsNoImport(boolean runScriptsOnly, String filename) {
+ public void setRunScriptsNoImport(boolean runScriptsOnly, String filename) {
if (filename != null) {
filename = filename.trim();
if (filename.indexOf("/") >= 0) {
@@ -178,7 +179,7 @@ public class HeadlessOptions {
*
* @param preScripts list of script names
*/
- public synchronized void setPreScripts(List<String> preScripts) {
+ public void setPreScripts(List<String> preScripts) {
List<Pair<String, String[]>> preScriptsEmptyArgs = new LinkedList<>();
for (String preScript : preScripts) {
preScriptsEmptyArgs.add(new Pair<>(preScript, new String[0]));
@@ -193,7 +194,7 @@ public class HeadlessOptions {
*
* @param preScripts list of script names/script argument pairs
*/
- public synchronized void setPreScriptsWithArgs(List<Pair<String, String[]>> preScripts) {
+ public void setPreScriptsWithArgs(List<Pair<String, String[]>> preScripts) {
this.preScripts = preScripts;
this.preScriptFileMap = null;
}
@@ -205,7 +206,7 @@ public class HeadlessOptions {
*
* @param postScripts list of script names
*/
- public synchronized void setPostScripts(List<String> postScripts) {
+ public void setPostScripts(List<String> postScripts) {
List<Pair<String, String[]>> postScriptsEmptyArgs = new LinkedList<>();
for (String postScript : postScripts) {
postScriptsEmptyArgs.add(new Pair<>(postScript, new String[0]));
@@ -220,7 +221,7 @@ public class HeadlessOptions {
*
* @param postScripts list of script names/script argument pairs
*/
- public synchronized void setPostScriptsWithArgs(List<Pair<String, String[]>> postScripts) {
+ public void setPostScriptsWithArgs(List<Pair<String, String[]>> postScripts) {
this.postScripts = postScripts;
this.postScriptFileMap = null;
}
@@ -239,7 +240,7 @@ public class HeadlessOptions {
*
* @param newPaths list of directories to be searched.
*/
- public synchronized void setScriptDirectories(List<String> newPaths) {
+ public void setScriptDirectories(List<String> newPaths) {
scriptPaths = newPaths;
}
@@ -256,7 +257,7 @@ public class HeadlessOptions {
* </pre>
* @param paths semicolon (';') separated list of directory paths
*/
- public synchronized void setScriptDirectories(String paths) {
+ public void setScriptDirectories(String paths) {
String[] pathArray = paths.split(";");
setScriptDirectories(Arrays.asList(pathArray));
}
@@ -270,7 +271,7 @@ public class HeadlessOptions {
*
* @param path location of .properties file(s)
*/
- public synchronized void setPropertiesFileDirectory(String path) {
+ public void setPropertiesFileDirectory(String path) {
propertiesFileStrPaths = new ArrayList<>();
propertiesFileStrPaths.add(path);
}
@@ -284,7 +285,7 @@ public class HeadlessOptions {
*
* @param newPaths potential locations of .properties file(s)
*/
- public synchronized void setPropertiesFileDirectories(List<String> newPaths) {
+ public void setPropertiesFileDirectories(List<String> newPaths) {
propertiesFileStrPaths = newPaths;
}
@@ -297,7 +298,7 @@ public class HeadlessOptions {
*
* @param paths String representation of directories (each separated by ';')
*/
- public synchronized void setPropertiesFileDirectories(String paths) {
+ public void setPropertiesFileDirectories(String paths) {
String[] pathArray = paths.split(";");
setPropertiesFileDirectories(Arrays.asList(pathArray));
}
@@ -312,7 +313,7 @@ public class HeadlessOptions {
* @param enabled if true conflicting domain files will be removed from the
* project prior to importing the new file.
*/
- public synchronized void enableOverwriteOnConflict(boolean enabled) {
+ public void enableOverwriteOnConflict(boolean enabled) {
this.overwrite = enabled;
}
@@ -324,7 +325,7 @@ public class HeadlessOptions {
*
* @param enabled if true, enables recursive processing
*/
- public synchronized void enableRecursiveProcessing(boolean enabled) {
+ public void enableRecursiveProcessing(boolean enabled) {
this.recursive = enabled;
}
@@ -335,7 +336,7 @@ public class HeadlessOptions {
*
* @param enabled if true, enables readOnly processing or import
*/
- public synchronized void enableReadOnlyProcessing(boolean enabled) {
+ public void enableReadOnlyProcessing(boolean enabled) {
this.readOnly = enabled;
}
@@ -348,7 +349,7 @@ public class HeadlessOptions {
* @param enabled if true a created project will be deleted when
* processing is complete.
*/
- public synchronized void setDeleteCreatedProjectOnClose(boolean enabled) {
+ public void setDeleteCreatedProjectOnClose(boolean enabled) {
this.deleteProject = enabled;
}
@@ -358,7 +359,7 @@ public class HeadlessOptions {
*
* @param enabled True if auto-analysis should be enabled; otherwise, false.
*/
- public synchronized void enableAnalysis(boolean enabled) {
+ public void enableAnalysis(boolean enabled) {
this.analyze = enabled;
}
@@ -370,7 +371,7 @@ public class HeadlessOptions {
* @param compilerSpecId The compiler spec to set.
* @throws InvalidInputException if the language and compiler spec combination is not valid.
*/
- public synchronized void setLanguageAndCompiler(String languageId, String compilerSpecId)
+ public void setLanguageAndCompiler(String languageId, String compilerSpecId)
throws InvalidInputException {
if (languageId == null && compilerSpecId == null) {
return;
@@ -407,8 +408,7 @@ public class HeadlessOptions {
* @param stringInSecs timeout value in seconds (as a String)
* @throws InvalidInputException if the timeout value was not a valid value
*/
- public synchronized void setPerFileAnalysisTimeout(String stringInSecs)
- throws InvalidInputException {
+ public void setPerFileAnalysisTimeout(String stringInSecs) throws InvalidInputException {
try {
perFileTimeout = Integer.parseInt(stringInSecs);
}
@@ -418,10 +418,10 @@ public class HeadlessOptions {
}
}
- public synchronized void setPerFileAnalysisTimeout(int secs) {
+ public void setPerFileAnalysisTimeout(int secs) {
perFileTimeout = secs;
}
-
+
/**
* Set Ghidra Server client credentials to be used with "shared" projects.
*
@@ -434,7 +434,7 @@ public class HeadlessOptions {
* the password entry to the terminal which may be undesirable.
* @throws IOException if an error occurs while opening the specified keystorePath.
*/
- public synchronized void setClientCredentials(String userID, String keystorePath,
+ public void setClientCredentials(String userID, String keystorePath,
boolean allowPasswordPrompt) throws IOException {
this.connectUserID = userID;
this.keystore = keystorePath;
@@ -450,12 +450,12 @@ public class HeadlessOptions {
* @param commit if true imported files will be committed
* @param comment optional comment to use when committing
*/
- public synchronized void setCommitFiles(boolean commit, String comment) {
+ public void setCommitFiles(boolean commit, String comment) {
this.commit = commit;
this.commitComment = comment;
}
- public synchronized void setOkToDelete(boolean deleteOk) {
+ public void setOkToDelete(boolean deleteOk) {
okToDelete = deleteOk;
}
@@ -465,7 +465,7 @@ public class HeadlessOptions {
* @param cpu The maximum number of cpu cores to use during headless processing.
* Setting it to 0 or a negative integer is equivalent to setting it to 1.
*/
- public synchronized void setMaxCpu(int cpu) {
+ public void setMaxCpu(int cpu) {
this.maxcpu = cpu;
System.setProperty("cpu.core.limit", Integer.toString(cpu));
@@ -481,7 +481,7 @@ public class HeadlessOptions {
* @throws InvalidInputException if an invalid loader name was specified, or if loader arguments
* were specified but a loader was not.
*/
- public synchronized void setLoader(String loaderName, List<Pair<String, String>> loaderArgs)
+ public void setLoader(String loaderName, List<Pair<String, String>> loaderArgs)
throws InvalidInputException {
if (loaderName != null) {
this.loaderClass = LoaderService.getLoaderClassByName(loaderName);