mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-11-05 18:30:17 +00:00
Merge remote-tracking branch 'origin/GP-3303_Dan_advanceOnlyInControlTargetMode'
This commit is contained in:
commit
3ffe2878b1
3 changed files with 51 additions and 1 deletions
|
@ -37,6 +37,7 @@ import ghidra.framework.plugintool.util.PluginStatus;
|
|||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.util.MarkerLocation;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.trace.model.Trace;
|
||||
import ghidra.trace.model.program.TraceProgramView;
|
||||
import ghidra.trace.model.target.TraceObject;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -98,6 +99,8 @@ public class DebuggerMethodActionsPlugin extends Plugin implements PopupActionPr
|
|||
private DebuggerStaticMappingService mappingService;
|
||||
@AutoServiceConsumed
|
||||
private DebuggerConsoleService consoleService;
|
||||
@AutoServiceConsumed
|
||||
private DebuggerControlService controlService;
|
||||
@SuppressWarnings("unused")
|
||||
private final AutoService.Wiring autoServiceWiring;
|
||||
|
||||
|
@ -107,8 +110,23 @@ public class DebuggerMethodActionsPlugin extends Plugin implements PopupActionPr
|
|||
tool.addPopupActionProvider(this);
|
||||
}
|
||||
|
||||
protected boolean isControlTarget() {
|
||||
if (controlService == null || traceManager == null) {
|
||||
return true;
|
||||
}
|
||||
Trace trace = traceManager.getCurrentTrace();
|
||||
if (trace == null) {
|
||||
return true;
|
||||
}
|
||||
ControlMode mode = controlService.getCurrentMode(trace);
|
||||
return mode.isTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DockingActionIf> getPopupActions(Tool tool, ActionContext context) {
|
||||
if (!isControlTarget()) {
|
||||
return List.of();
|
||||
}
|
||||
TargetObject curObj = getCurrentTargetObject();
|
||||
if (curObj == null) {
|
||||
return List.of();
|
||||
|
|
|
@ -55,6 +55,11 @@ public enum ControlMode {
|
|||
*/
|
||||
RO_TARGET("Control Target w/ Edits Disabled", new GIcon(
|
||||
"icon.debugger.control.mode.ro.target")) {
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean followsPresent() {
|
||||
return true;
|
||||
|
@ -96,6 +101,11 @@ public enum ControlMode {
|
|||
* Control actions, breakpoint commands, and state edits are all directed to the target.
|
||||
*/
|
||||
RW_TARGET("Control Target", new GIcon("icon.debugger.control.mode.rw.target")) {
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean followsPresent() {
|
||||
return true;
|
||||
|
@ -153,6 +163,11 @@ public enum ControlMode {
|
|||
* and state edits are rejected.
|
||||
*/
|
||||
RO_TRACE("Control Trace w/ Edits Disabled", new GIcon("icon.debugger.control.mode.ro.trace")) {
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean followsPresent() {
|
||||
return false;
|
||||
|
@ -185,6 +200,11 @@ public enum ControlMode {
|
|||
* and state edits modify the current trace snapshot.
|
||||
*/
|
||||
RW_TRACE("Control Trace", new GIcon("icon.debugger.control.mode.rw.trace")) {
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean followsPresent() {
|
||||
return false;
|
||||
|
@ -251,6 +271,11 @@ public enum ControlMode {
|
|||
* schedule.
|
||||
*/
|
||||
RW_EMULATOR("Control Emulator", new GIcon("icon.debugger.control.mode.rw.emulator")) {
|
||||
@Override
|
||||
public boolean isTarget() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean followsPresent() {
|
||||
return false;
|
||||
|
@ -430,4 +455,11 @@ public enum ControlMode {
|
|||
}
|
||||
return getAlternative(coordinates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this mode controls the target
|
||||
*
|
||||
* @return true if it controls the target
|
||||
*/
|
||||
public abstract boolean isTarget();
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class DebuggerMethodActionsPluginTest extends AbstractGhidraHeadedDebugge
|
|||
List<String> commands = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
@Before
|
||||
public void setUpMethodAcitonsTest() throws Exception {
|
||||
public void setUpMethodActionsTest() throws Exception {
|
||||
listingPlugin = addPlugin(tool, DebuggerListingPlugin.class);
|
||||
mappingService = addPlugin(tool, DebuggerStaticMappingServicePlugin.class);
|
||||
methodsPlugin = addPlugin(tool, DebuggerMethodActionsPlugin.class);
|
||||
|
|
Loading…
Reference in a new issue