Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2780 - Fixed option node with '.' in its name

dragonmacherbc1ecf4b8cf8
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerResources.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerResources.java
index 5ab2b73766..68b11afdea 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerResources.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/DebuggerResources.java
@@ -65,7 +65,8 @@ import resources.ResourceManager;
import resources.icons.RotateIcon;
public interface DebuggerResources {
- String OPTIONS_CATEGORY_WORKFLOW = "Debugger.Workflow";
+ String OPTIONS_CATEGORY_DEBUGGER = "Debugger";
+ String OPTIONS_CATEGORY_WORKFLOW = "Workflow";
ImageIcon ICON_DEBUGGER = ResourceManager.loadImage("images/debugger.png");
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/workflow/DebuggerWorkflowServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/workflow/DebuggerWorkflowServicePlugin.java
index a662a7d37d..8eeda6d604 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/workflow/DebuggerWorkflowServicePlugin.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/workflow/DebuggerWorkflowServicePlugin.java
@@ -128,7 +128,7 @@ public class DebuggerWorkflowServicePlugin extends Plugin
/* testing */ final List<DebuggerBot> allBots = new ArrayList<>();
// Cannot auto-wire, since they're dynamically populated
- private final ToolOptions options;
+ private final Options options;
@SuppressWarnings("hiding") // I'm FrontEndOnly
protected final FrontEndTool tool;
@@ -140,8 +140,9 @@ public class DebuggerWorkflowServicePlugin extends Plugin
this.tool = (FrontEndTool) tool; // I'm FrontEndOnly
this.autoServiceWiring = AutoService.wireServicesProvidedAndConsumed(this);
- this.options = tool.getOptions(DebuggerResources.OPTIONS_CATEGORY_WORKFLOW);
- this.options.addOptionsChangeListener(this);
+ ToolOptions rootOptions = tool.getOptions(DebuggerResources.OPTIONS_CATEGORY_DEBUGGER);
+ rootOptions.addOptionsChangeListener(this);
+ this.options = rootOptions.getOptions(DebuggerResources.OPTIONS_CATEGORY_WORKFLOW);
}
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/OptionsManager.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/OptionsManager.java
index 41cf86845c..fe83f61979 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/OptionsManager.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/mgr/OptionsManager.java
@@ -33,6 +33,7 @@ import ghidra.framework.plugintool.dialog.KeyBindingsPanel;
import ghidra.framework.plugintool.util.OptionsService;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
+import ghidra.util.exception.AssertException;
/**
* Created by PluginTool to manage the set of Options for each category.
@@ -61,6 +62,12 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
@Override
public ToolOptions getOptions(String category) {
+ if (category.contains(Options.DELIMITER_STRING)) {
+ throw new AssertException(
+ "Options category cannot contain the options path delimiter '" + Options.DELIMITER +
+ "'");
+ }
+
ToolOptions opt = optionsMap.get(category);
if (opt == null) {
opt = new ToolOptions(category);
@@ -245,8 +252,7 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
private void removeUnusedOptions(List<String> deleteList) {
- for (int i = 0; i < deleteList.size(); i++) {
- String name = deleteList.get(i);
+ for (String name : deleteList) {
ToolOptions options = optionsMap.remove(name);
options.removeOptionsChangeListener(this);
}