Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1465: Added "New Memory View" to Window->Debugger

Dan9817e1f95fb7
diff --git a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerMemoryBytesPlugin/DebuggerMemoryBytesPlugin.html b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerMemoryBytesPlugin/DebuggerMemoryBytesPlugin.html
index e03884984f..ee531aed6a 100644
--- a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerMemoryBytesPlugin/DebuggerMemoryBytesPlugin.html
+++ b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerMemoryBytesPlugin/DebuggerMemoryBytesPlugin.html
@@ -56,6 +56,12 @@
<P>The memory window provides a variety of actions, some for managing and configuring windows,
and others for capturing memory from a target.</P>
+ <H3><A name="new_memory"></A>New Memory View</H3>
+
+ <P>This action is always available in the <SPAN class="menu">Window &rarr; Debugger</SPAN>
+ menu. It creates a new memory window with the same configuration as the primary memory window.
+ It is equivalent to "snapshotting" the primary memory window.</P>
+
<H3><A name="follows_thread"></A>Follows Selected Thread</H3>
<P>This action is only available on snapshot memory windows. The primary window always follows
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 b99fd8d9b0..7619b829f4 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
@@ -1500,6 +1500,24 @@ public interface DebuggerResources {
}
}
+ interface NewMemoryAction{
+ String NAME = "New Memory View";
+ String DESCRIPTION = "Open a new memory bytes view";
+ String GROUP = GROUP_TRANSIENT_VIEWS;
+ Icon ICON = ICON_MEMORY_BYTES;
+ String HELP_ANCHOR = "new_memory";
+
+ static ActionBuilder builder(Plugin owner) {
+ String ownerName = owner.getName();
+ return new ActionBuilder(NAME,ownerName)
+ .description(DESCRIPTION)
+ .menuGroup(GROUP)
+ .menuIcon(ICON)
+ .menuPath("Window", DebuggerPluginPackage.NAME, NAME)
+ .helpLocation(new HelpLocation(ownerName, HELP_ANCHOR));
+ }
+ }
+
abstract class AbstractStepSnapForwardAction extends DockingAction {
public static final String NAME = "Step Trace Snap Forward";
public static final Icon ICON = ICON_SNAP_FORWARD;
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerMemoryBytesPlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerMemoryBytesPlugin.java
index e4372833a8..9c6391205a 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerMemoryBytesPlugin.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/memory/DebuggerMemoryBytesPlugin.java
@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import org.jdom.Element;
+import docking.action.DockingAction;
import ghidra.app.events.ProgramLocationPluginEvent;
import ghidra.app.events.ProgramSelectionPluginEvent;
import ghidra.app.plugin.PluginCategoryNames;
@@ -31,6 +32,7 @@ import ghidra.app.plugin.core.byteviewer.*;
import ghidra.app.plugin.core.debug.DebuggerCoordinates;
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
import ghidra.app.plugin.core.debug.event.*;
+import ghidra.app.plugin.core.debug.gui.DebuggerResources.NewMemoryAction;
import ghidra.app.plugin.core.debug.gui.action.LocationTrackingSpec;
import ghidra.app.plugin.core.debug.gui.action.NoneLocationTrackingSpec;
import ghidra.app.services.*;
@@ -71,6 +73,8 @@ public class DebuggerMemoryBytesPlugin
private static final String KEY_DISCONNECTED_COUNT = "disconnectedCount";
private static final String PREFIX_DISCONNECTED_PROVIDER = "disconnectedProvider";
+ protected DockingAction actionNewMemory;
+
@AutoServiceConsumed
private ProgramManager programManager;
// NOTE: This plugin doesn't extend AbstractDebuggerPlugin
@@ -102,7 +106,10 @@ public class DebuggerMemoryBytesPlugin
}
private void createActions() {
- // TODO
+ actionNewMemory = NewMemoryAction.builder(this)
+ .enabled(true)
+ .onAction(c -> createNewDisconnectedProvider())
+ .buildAndInstall(tool);
}
public DebuggerMemoryBytesProvider createViewerIfMissing(LocationTrackingSpec spec,