Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-435: Action to set ineffective, but mapped, breakpoints.

Dan7aa641732589
diff --git a/Ghidra/Debug/Debugger/certification.manifest b/Ghidra/Debug/Debugger/certification.manifest
index 9f50cd3e65..21cd0f0421 100644
--- a/Ghidra/Debug/Debugger/certification.manifest
+++ b/Ghidra/Debug/Debugger/certification.manifest
@@ -132,6 +132,7 @@ src/main/resources/images/breakpoint-set.png||GHIDRA||||END|
src/main/resources/images/breakpoints-clear-all.png||GHIDRA||||END|
src/main/resources/images/breakpoints-disable-all.png||GHIDRA||||END|
src/main/resources/images/breakpoints-enable-all.png||GHIDRA||||END|
+src/main/resources/images/breakpoints-make-effective.png||GHIDRA||||END|
src/main/resources/images/breakpoints.png||GHIDRA||||END|
src/main/resources/images/closedFolder.png||Modified Nuvola Icons - LGPL 2.1||||END|
src/main/resources/images/connect.png||GHIDRA||||END|
@@ -179,6 +180,7 @@ src/main/svg/breakpoint-set.svg||GHIDRA||||END|
src/main/svg/breakpoints-clear-all.svg||GHIDRA||||END|
src/main/svg/breakpoints-disable-all.svg||GHIDRA||||END|
src/main/svg/breakpoints-enable-all.svg||GHIDRA||||END|
+src/main/svg/breakpoints-make-effective.svg||GHIDRA||||END|
src/main/svg/breakpoints.svg||GHIDRA||||END|
src/main/svg/connect.svg||GHIDRA||||END|
src/main/svg/console.svg||GHIDRA||||END|
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 ed272717a1..175c099d1f 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
@@ -99,6 +99,8 @@ public interface DebuggerResources {
ResourceManager.loadImage("images/breakpoints-disable-all.png");
ImageIcon ICON_CLEAR_ALL_BREAKPOINTS =
ResourceManager.loadImage("images/breakpoints-clear-all.png");
+ ImageIcon ICON_MAKE_BREAKPOINTS_EFFECTIVE =
+ ResourceManager.loadImage("images/breakpoints-make-effective.png");
// TODO: Some overlay to indicate dynamic, or new icon altogether
ImageIcon ICON_LISTING = ResourceManager.loadImage("images/Browser.gif");
@@ -1158,6 +1160,18 @@ public interface DebuggerResources {
}
}
+ abstract class AbstractMakeBreakpointsEffectiveAction extends DockingAction {
+ public static final String NAME = "Make Breakpoints Effective";
+ public static final Icon ICON = ICON_MAKE_BREAKPOINTS_EFFECTIVE;
+ public static final String HELP_ANCHOR = "make_breakpoints_effective";
+
+ public AbstractMakeBreakpointsEffectiveAction(Plugin owner) {
+ super(NAME, owner.getName());
+ setDescription("Place enabled but ineffective breakpoints where possible");
+ setHelpLocation(new HelpLocation(owner.getName(), HELP_ANCHOR));
+ }
+ }
+
interface MapModulesAction {
String NAME = "Map Modules";
String DESCRIPTION = "Map selected modules to program images";
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsPlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsPlugin.java
index 493a9e9f2d..3dcf0ca4b5 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsPlugin.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsPlugin.java
@@ -25,19 +25,20 @@ import ghidra.framework.plugintool.*;
import ghidra.framework.plugintool.util.PluginStatus;
@PluginInfo( //
- shortDescription = "Debugger breakpoints manager", //
- description = "GUI to manage breakpoints", //
- category = PluginCategoryNames.DEBUGGER, //
- packageName = DebuggerPluginPackage.NAME, //
- status = PluginStatus.RELEASED, //
- servicesRequired = { //
- DebuggerLogicalBreakpointService.class, //
- DebuggerModelService.class, //
- }, eventsConsumed = {
- TraceOpenedPluginEvent.class, //
- TraceClosedPluginEvent.class, //
- TraceActivatedPluginEvent.class, //
- } //
+ shortDescription = "Debugger breakpoints manager", //
+ description = "GUI to manage breakpoints", //
+ category = PluginCategoryNames.DEBUGGER, //
+ packageName = DebuggerPluginPackage.NAME, //
+ status = PluginStatus.RELEASED, //
+ servicesRequired = { //
+ DebuggerLogicalBreakpointService.class, //
+ DebuggerModelService.class, //
+ },
+ eventsConsumed = {
+ TraceOpenedPluginEvent.class, //
+ TraceClosedPluginEvent.class, //
+ TraceActivatedPluginEvent.class, //
+ } //
)
public class DebuggerBreakpointsPlugin extends AbstractDebuggerPlugin {
protected DebuggerBreakpointsProvider provider;
@@ -54,6 +55,7 @@ public class DebuggerBreakpointsPlugin extends AbstractDebuggerPlugin {
@Override
protected void dispose() {
+ provider.dispose();
tool.removeComponentProvider(provider);
super.dispose();
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProvider.java
index d5bfae71ef..c8f49fe2d8 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProvider.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProvider.java
@@ -365,7 +365,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
}
protected class ClearSelectedBreakpointsAction extends AbstractClearSelectedBreakpointsAction {
- public static final String GROUP = DebuggerResources.GROUP_BREAKPOINTS;
+ public static final String GROUP = DebuggerResources.GROUP_BREAKPOINTS + "Clear";
public ClearSelectedBreakpointsAction() {
super(plugin);
@@ -401,7 +401,7 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
}
protected class ClearAllBreakpointsAction extends AbstractClearAllBreakpointsAction {
- public static final String GROUP = DebuggerResources.GROUP_BREAKPOINTS;
+ public static final String GROUP = DebuggerResources.GROUP_BREAKPOINTS + "Clear";
public ClearAllBreakpointsAction() {
super(plugin);
@@ -426,6 +426,64 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
}
}
+ protected abstract class CommonMakeBreakpointsEffectiveAction
+ extends AbstractMakeBreakpointsEffectiveAction {
+ public static final String GROUP = DebuggerResources.GROUP_BREAKPOINTS;
+
+ public CommonMakeBreakpointsEffectiveAction() {
+ super(plugin);
+ setToolBarData(new ToolBarData(ICON, GROUP));
+ }
+
+ @Override
+ public void actionPerformed(ActionContext context) {
+ Set<LogicalBreakpoint> all = breakpointService.getAllBreakpoints();
+ for (LogicalBreakpoint lb : all) {
+ if (lb.computeEnablement() != Enablement.INEFFECTIVE_ENABLED) {
+ continue;
+ }
+ if (lb.getMappedTraces().isEmpty()) {
+ continue;
+ }
+ lb.enable();
+ }
+ }
+ }
+
+ protected class MakeBreakpointsEffectiveAction extends CommonMakeBreakpointsEffectiveAction {
+ public MakeBreakpointsEffectiveAction() {
+ super();
+ addLocalAction(this);
+ setEnabled(false);
+ }
+
+ @Override
+ public boolean isEnabledForContext(ActionContext context) {
+ if (breakpointService == null) {
+ return false;
+ }
+ Set<LogicalBreakpoint> all = breakpointService.getAllBreakpoints();
+ for (LogicalBreakpoint lb : all) {
+ if (lb.computeEnablement() != Enablement.INEFFECTIVE_ENABLED) {
+ continue;
+ }
+ if (lb.getMappedTraces().isEmpty()) {
+ continue;
+ }
+ return true;
+ }
+ return false;
+ }
+ }
+
+ protected class MakeBreakpointsEffectiveResolutionAction
+ extends CommonMakeBreakpointsEffectiveAction {
+ @Override
+ public boolean isValidContext(ActionContext context) {
+ return context instanceof DebuggerMakeBreakpointsEffectiveActionContext;
+ }
+ }
+
class LocationsBySelectedBreakpointsTableFilter implements TableFilter<BreakpointLocationRow> {
@Override
public boolean acceptsRow(BreakpointLocationRow locationRow) {
@@ -547,6 +605,8 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
@AutoServiceConsumed
private DebuggerTraceManagerService traceManager;
@AutoServiceConsumed
+ private DebuggerConsoleService consoleService;
+ @AutoServiceConsumed
private GoToService goToService;
@SuppressWarnings("unused")
private AutoService.Wiring autoServiceWiring;
@@ -571,13 +631,18 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
private ActionContext myActionContext;
+ private final DebuggerMakeBreakpointsEffectiveActionContext makeEffectiveResolutionContext =
+ new DebuggerMakeBreakpointsEffectiveActionContext();
+
// package access for testing
- EnableSelectedBreakpointsAction actionEnableSelectedBreakpointsAction;
- EnableAllBreakpointsAction actionEnableAllBreakpointsAction;
- DisableSelectedBreakpointsAction actionDisableSelectedBreakpointsAction;
- DisableAllBreakpointsAction actionDisableAllBreakpointsAction;
- ClearSelectedBreakpointsAction actionClearSelectedBreakpointsAction;
- ClearAllBreakpointsAction actionClearAllBreakpointsAction;
+ EnableSelectedBreakpointsAction actionEnableSelectedBreakpoints;
+ EnableAllBreakpointsAction actionEnableAllBreakpoints;
+ DisableSelectedBreakpointsAction actionDisableSelectedBreakpoints;
+ DisableAllBreakpointsAction actionDisableAllBreakpoints;
+ ClearSelectedBreakpointsAction actionClearSelectedBreakpoints;
+ ClearAllBreakpointsAction actionClearAllBreakpoints;
+ MakeBreakpointsEffectiveAction actionMakeBreakpointsEffective;
+ MakeBreakpointsEffectiveResolutionAction actionMakeBreakpointsEffectiveResolution;
ToggleDockingAction actionFilterByCurrentTrace;
ToggleDockingAction actionFilterLocationsByBreakpoints;
@@ -598,6 +663,35 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
createActions();
}
+ protected void dispose() {
+ if (consoleService != null) {
+ if (actionMakeBreakpointsEffectiveResolution != null) {
+ consoleService.removeResolutionAction(actionMakeBreakpointsEffectiveResolution);
+ }
+ }
+ }
+
+ @Override
+ public void contextChanged() {
+ super.contextChanged();
+ if (consoleService == null) {
+ return;
+ }
+ // TODO: This should probably check for its existence first
+ // Kind of a hack, but it works.
+ if (actionMakeBreakpointsEffective != null &&
+ actionMakeBreakpointsEffective.isEnabledForContext(myActionContext)) {
+ if (!consoleService.logContains(makeEffectiveResolutionContext)) {
+ consoleService.log(DebuggerResources.ICON_PROVIDER_BREAKPOINTS,
+ "There are ineffective breakpoints that can be placed",
+ makeEffectiveResolutionContext);
+ }
+ }
+ else {
+ consoleService.removeFromLog(makeEffectiveResolutionContext);
+ }
+ }
+
@AutoServiceConsumed
private void setBreakpointService(DebuggerLogicalBreakpointService breakpointService) {
if (this.breakpointService != null) {
@@ -623,6 +717,15 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
}
}
+ @AutoServiceConsumed
+ private void setConsoleService(DebuggerConsoleService consoleService) {
+ if (consoleService != null) {
+ if (actionMakeBreakpointsEffectiveResolution != null) {
+ consoleService.addResolutionAction(actionMakeBreakpointsEffectiveResolution);
+ }
+ }
+ }
+
protected void loadBreakpoints() {
Set<LogicalBreakpoint> all = breakpointService.getAllBreakpoints();
breakpointTableModel.addAllItems(all);
@@ -921,12 +1024,13 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
}
protected void createActions() {
- actionEnableSelectedBreakpointsAction = new EnableSelectedBreakpointsAction();
- actionEnableAllBreakpointsAction = new EnableAllBreakpointsAction();
- actionDisableSelectedBreakpointsAction = new DisableSelectedBreakpointsAction();
- actionDisableAllBreakpointsAction = new DisableAllBreakpointsAction();
- actionClearSelectedBreakpointsAction = new ClearSelectedBreakpointsAction();
- actionClearAllBreakpointsAction = new ClearAllBreakpointsAction();
+ actionEnableSelectedBreakpoints = new EnableSelectedBreakpointsAction();
+ actionEnableAllBreakpoints = new EnableAllBreakpointsAction();
+ actionDisableSelectedBreakpoints = new DisableSelectedBreakpointsAction();
+ actionDisableAllBreakpoints = new DisableAllBreakpointsAction();
+ actionClearSelectedBreakpoints = new ClearSelectedBreakpointsAction();
+ actionClearAllBreakpoints = new ClearAllBreakpointsAction();
+ actionMakeBreakpointsEffective = new MakeBreakpointsEffectiveAction();
actionFilterByCurrentTrace = FilterAction.builder(plugin)
.toolBarIcon(DebuggerResources.ICON_TRACE)
.description("Filter locations to those in current trace")
@@ -938,6 +1042,8 @@ public class DebuggerBreakpointsProvider extends ComponentProviderAdapter
.helpLocation(new HelpLocation(plugin.getName(), "filter_by_logical"))
.onAction(this::toggledFilterLocationsByBreakpoints)
.buildAndInstallLocal(this);
+
+ actionMakeBreakpointsEffectiveResolution = new MakeBreakpointsEffectiveResolutionAction();
}
private void toggledFilterByCurrentTrace(ActionContext ignored) {
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java
new file mode 100644
index 0000000000..e6c14bc6f0
--- /dev/null
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerMakeBreakpointsEffectiveActionContext.java
@@ -0,0 +1,23 @@
+/* ###
+ * 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.breakpoint;
+
+import docking.ActionContext;
+
+// TODO: Any granularity, or just one suggested action on the global tool?
+public class DebuggerMakeBreakpointsEffectiveActionContext extends ActionContext {
+ // Nothing to add
+}
diff --git a/Ghidra/Debug/Debugger/src/main/resources/images/breakpoints-make-effective.png b/Ghidra/Debug/Debugger/src/main/resources/images/breakpoints-make-effective.png
new file mode 100644
index 0000000000..b1e1ab4ede
Binary files /dev/null and b/Ghidra/Debug/Debugger/src/main/resources/images/breakpoints-make-effective.png differ
diff --git a/Ghidra/Debug/Debugger/src/main/svg/breakpoints-make-effective.svg b/Ghidra/Debug/Debugger/src/main/svg/breakpoints-make-effective.svg
new file mode 100644
index 0000000000..cfb79a2e09
--- /dev/null
+++ b/Ghidra/Debug/Debugger/src/main/svg/breakpoints-make-effective.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16px"
+ height="16px"
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="SVGRoot"
+ sodipodi:docname="breakpoints-make-effective.svg"
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="757"
+ inkscape:window-height="480"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="8"
+ inkscape:cy="8"
+ inkscape:window-x="1405"
+ inkscape:window-y="650"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="layer1" />
+ <defs
+ id="defs5287" />
+ <metadata
+ id="metadata5290">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1">
+ <circle
+ style="opacity:1;fill:#aa0000;fill-opacity:1;stroke:none;stroke-width:1.14285719;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path821"
+ cx="11"
+ cy="11.000002"
+ r="4" />
+ <path
+ style="opacity:1;fill:#7f7f7f;fill-opacity:1;stroke:none;stroke-width:1.14285719;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 5,1 C 2.790861,1 1,2.790861 1,5 1,7.209139 2.790861,9 5,9 7.209139,9 9,7.209139 9,5 9,2.790861 7.209139,1 5,1 Z"
+ id="path821-7" />
+ </g>
+</svg>
diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProviderTest.java
index 235171dc9a..afa7879316 100644
--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProviderTest.java
+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/DebuggerBreakpointsProviderTest.java
@@ -31,6 +31,7 @@ import generic.Unique;
import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.DebuggerResources.*;
import ghidra.app.plugin.core.debug.gui.breakpoint.DebuggerBreakpointsProvider.LogicalBreakpointTableModel;
+import ghidra.app.plugin.core.debug.gui.console.DebuggerConsolePlugin;
import ghidra.app.services.*;
import ghidra.app.services.LogicalBreakpoint.Enablement;
import ghidra.async.AsyncTestUtils;
@@ -260,12 +261,12 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
LogicalBreakpointRow row =
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
@@ -274,28 +275,28 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
waitForSwing();
assertEquals(Enablement.INEFFECTIVE_DISABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionEnableSelectedBreakpointsAction);
+ performAction(breakpointsProvider.actionEnableSelectedBreakpoints);
assertEquals(Enablement.INEFFECTIVE_ENABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointTable.clearSelection();
waitForSwing();
- assertFalse(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointFilterPanel.setSelectedItem(row);
waitForSwing();
- assertTrue(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
// Bookmark part should actually be synchronous.
waitOn(row.getLogicalBreakpoint().delete());
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionEnableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableSelectedBreakpoints.isEnabled());
}
@Test
@@ -304,12 +305,12 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionEnableAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableAllBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertTrue(breakpointsProvider.actionEnableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableAllBreakpoints.isEnabled());
LogicalBreakpointRow row =
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
@@ -317,18 +318,18 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
waitForSwing();
assertEquals(Enablement.INEFFECTIVE_DISABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionEnableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableAllBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionEnableAllBreakpointsAction);
+ performAction(breakpointsProvider.actionEnableAllBreakpoints);
assertEquals(Enablement.INEFFECTIVE_ENABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionEnableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionEnableAllBreakpoints.isEnabled());
// Bookmark part should actually be synchronous.
row.getLogicalBreakpoint().delete().get(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionEnableAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionEnableAllBreakpoints.isEnabled());
}
@Test
@@ -337,12 +338,12 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
LogicalBreakpointRow row =
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
@@ -350,28 +351,28 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
waitForSwing();
assertEquals(Enablement.INEFFECTIVE_ENABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionDisableSelectedBreakpointsAction);
+ performAction(breakpointsProvider.actionDisableSelectedBreakpoints);
assertEquals(Enablement.INEFFECTIVE_DISABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointTable.clearSelection();
waitForSwing();
- assertFalse(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointFilterPanel.setSelectedItem(row);
waitForSwing();
- assertTrue(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
// Bookmark part should actually be synchronous.
waitOn(row.getLogicalBreakpoint().delete());
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionDisableSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableSelectedBreakpoints.isEnabled());
}
@Test
@@ -380,27 +381,27 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionDisableAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableAllBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertTrue(breakpointsProvider.actionDisableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableAllBreakpoints.isEnabled());
LogicalBreakpointRow row =
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
assertEquals(Enablement.INEFFECTIVE_ENABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionDisableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableAllBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionDisableAllBreakpointsAction);
+ performAction(breakpointsProvider.actionDisableAllBreakpoints);
assertEquals(Enablement.INEFFECTIVE_DISABLED, row.getEnablement());
- assertTrue(breakpointsProvider.actionDisableAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionDisableAllBreakpoints.isEnabled());
// Bookmark part should actually be synchronous.
row.getLogicalBreakpoint().delete().get(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionDisableAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionDisableAllBreakpoints.isEnabled());
}
@Test
@@ -409,34 +410,34 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertFalse(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
LogicalBreakpointRow row =
Unique.assertOne(breakpointsProvider.breakpointTableModel.getModelData());
breakpointsProvider.breakpointFilterPanel.setSelectedItem(row);
waitForSwing();
- assertTrue(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointTable.clearSelection();
waitForSwing();
- assertFalse(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
breakpointsProvider.breakpointFilterPanel.setSelectedItem(row);
waitForSwing();
- assertTrue(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionClearSelectedBreakpointsAction);
+ performAction(breakpointsProvider.actionClearSelectedBreakpoints);
assertProviderEmpty();
- assertFalse(breakpointsProvider.actionClearSelectedBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearSelectedBreakpoints.isEnabled());
}
@Test
@@ -445,17 +446,54 @@ public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebugge
programManager.openProgram(program);
waitForSwing();
- assertFalse(breakpointsProvider.actionClearAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearAllBreakpoints.isEnabled());
addStaticMemoryAndBreakpoint();
waitForDomainObject(program);
- assertTrue(breakpointsProvider.actionClearAllBreakpointsAction.isEnabled());
+ assertTrue(breakpointsProvider.actionClearAllBreakpoints.isEnabled());
- performAction(breakpointsProvider.actionClearAllBreakpointsAction);
+ performAction(breakpointsProvider.actionClearAllBreakpoints);
assertProviderEmpty();
- assertFalse(breakpointsProvider.actionClearAllBreakpointsAction.isEnabled());
+ assertFalse(breakpointsProvider.actionClearAllBreakpoints.isEnabled());
+ }
+
+ @Test
+ public void testActionMakeBreakpointsEffective() throws Exception {
+ DebuggerConsolePlugin consolePlugin = addPlugin(tool, DebuggerConsolePlugin.class);
+
+ createTestModel();
+ mb.createTestProcessesAndThreads();
+ TraceRecorder recorder = modelService.recordTarget(mb.testProcess1,
+ new TestDebuggerTargetTraceMapper(mb.testProcess1));
+ Trace trace = recorder.getTrace();
+ createProgramFromTrace(trace);
+ intoProject(trace);
+ intoProject(program);
+
+ assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+ programManager.openProgram(program);
+ assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+ traceManager.openTrace(trace);
+ assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+ addStaticMemoryAndBreakpoint();
+ assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+
+ addMapping(trace, program);
+ waitForPass(() -> {
+ assertTrue(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+ assertEquals(1,
+ consolePlugin.getRowCount(DebuggerMakeBreakpointsEffectiveActionContext.class));
+ });
+
+ performAction(breakpointsProvider.actionMakeBreakpointsEffective);
+
+ waitForPass(() -> {
+ assertFalse(breakpointsProvider.actionMakeBreakpointsEffective.isEnabled());
+ assertEquals(0,
+ consolePlugin.getRowCount(DebuggerMakeBreakpointsEffectiveActionContext.class));
+ });
}
@Test