Ghidra is a software reverse engineering (SRE) framework
GP-2502: add option to set timeout
d-millar10d776fe096c
diff --git a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.htmlindex 85b03c32d1..253f121d12 100644--- a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html+++ b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerObjectsPlugin/DebuggerObjectsPlugin.html@@ -347,6 +347,10 @@resulting changes in the GUI may be distracting for some. To disable updates to the ObjectsViewer, toggle "Updates While Running" off.</P>+ <H3><A name="set_node_timout">Set Node Timeout</A></H3>++ <P>Set the default value for the timeout used when expanding a node, i.e. populating its children.</P>+<H2><A name="color"></A>Color Options</H2><P>The debugger represents different types of objects with different colors. Bear in mind thesediff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.javaindex c9f4b7835f..ceb22fca0f 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/DebuggerObjectsProvider.java@@ -182,6 +182,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapterImportFromXMLAction importFromXMLAction;ImportFromFactsAction importFromFactsAction;OpenWinDbgTraceAction openTraceAction;+ SetTimeoutAction setTimeoutAction;private ToggleDockingAction actionToggleBase;private ToggleDockingAction actionToggleSubscribe;@@ -204,6 +205,8 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapterprivate boolean updateWhileRunning = true;@AutoConfigStateFieldprivate boolean suppressDescent = false;+ @AutoConfigStateField+ private int nodeTimeout = 60;Set<TargetConfigurable> configurables = new HashSet<>();private String lastMethod = "";@@ -857,7 +860,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter.buildAndInstallLocal(this);groupTargetIndex++;-+/*actionSuppressDescent = new ToggleActionBuilder("Automatically populate containers", plugin.getName()).menuPath("Maintenance","&Auto-populate")@@ -1222,6 +1225,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapterimportFromXMLAction = new ImportFromXMLAction(tool, plugin.getName(), this);importFromFactsAction = new ImportFromFactsAction(tool, plugin.getName(), this);openTraceAction = new OpenWinDbgTraceAction(tool, plugin.getName(), this);+ setTimeoutAction = new SetTimeoutAction(tool, plugin.getName(), this);}//@formatter:on@@ -1858,6 +1862,14 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapterthis.autoRecord = autorecord;}+ public int getNodeTimeout() {+ return nodeTimeout;+ }++ public void setNodeTimeout(int timeout) {+ this.nodeTimeout = timeout;+ }+public void updateActions(ObjectContainer providerContainer) {TargetObject obj = getSelectedObject();if (obj != null) {@@ -1889,6 +1901,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapteractionToggleAutoRecord.setSelected(autoRecord);actionToggleHideIntrinsics.setSelected(hideIntrinsics);actionToggleSelectionOnly.setSelected(selectionOnly);+ setTimeoutAction.setNodeTimeout(nodeTimeout);methodDialog.readConfigState(saveState);}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/actions/SetTimeoutAction.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/actions/SetTimeoutAction.javanew file mode 100644index 0000000000..7b6fb803e8--- /dev/null+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/actions/SetTimeoutAction.java@@ -0,0 +1,61 @@+/* ###+ * IP: GHIDRA+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package ghidra.app.plugin.core.debug.gui.objects.actions;++import docking.ActionContext;+import docking.action.DockingAction;+import docking.action.MenuData;+import ghidra.app.plugin.core.debug.gui.objects.DebuggerObjectsProvider;+import ghidra.app.script.AskDialog;+import ghidra.framework.plugintool.PluginTool;+import ghidra.util.HelpLocation;++public class SetTimeoutAction extends DockingAction {++ DebuggerObjectsProvider provider;+ int timeout = 0;++ public SetTimeoutAction(PluginTool tool, String owner, DebuggerObjectsProvider provider) {+ super("SetTimeout", owner);+ setMenuBarData(+ new MenuData(new String[] { "Maintenance", "&Set Node Timeout" }, null, "M100"));+ setHelpLocation(new HelpLocation(owner, "set_node_timeout"));+ this.provider = provider;+ provider.addLocalAction(this);+ this.timeout = provider.getNodeTimeout();+ }++ @Override+ public boolean isEnabledForContext(ActionContext context) {+ return true;+ }++ @Override+ public void actionPerformed(ActionContext context) {+ AskDialog<String> dialog =+ new AskDialog<String>("Set Node Timeout", "Seconds", AskDialog.INT, timeout);+ if (dialog.isCanceled()) {+ return;+ }+ timeout = Integer.parseInt(dialog.getValueAsString());+ provider.setNodeTimeout(timeout);+ }++ public void setNodeTimeout(int timeout) {+ this.timeout = timeout;+ }++}diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.javaindex 6d3320822c..8f9e71f451 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java@@ -85,7 +85,8 @@ public class ObjectNode extends GTreeSlowLoadingNode { //extends GTreeNodeif (cf != null) {// NB: We're allowed to do this because we're guaranteed to be// in our own thread by the GTreeSlowLoadingNode- ObjectContainer oc = cf.get(60, TimeUnit.SECONDS);+ ObjectContainer oc =+ cf.get(tree.getProvider().getNodeTimeout(), TimeUnit.SECONDS);return tree.update(oc);}}