Merge remote-tracking branch 'origin/GP-1465_Dan_newMemoryAction' into patch

This commit is contained in:
ghidra1 2021-12-18 00:02:49 -05:00
commit e4a9a7f568
3 changed files with 32 additions and 1 deletions

View file

@ -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

View file

@ -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;

View file

@ -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,