Ghidra is a software reverse engineering (SRE) framework
GP-0: Improve pop-up test reliability. Fix typo in GDB.
Dan0432872e22a0
diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/methods.py b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/methods.pyindex bae891bd95..3cdca5b4f9 100644--- a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/methods.py+++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/methods.py@@ -484,7 +484,7 @@ def launch_loader(inferior: sch.Schema('Inferior'),''')[email protected](action='launch', display='Land and Run')[email protected](action='launch', display='Launch and Run')def launch_run(inferior: sch.Schema('Inferior'),file: ParamDesc(str, display='File'),args: ParamDesc(str, display='Arguments')=''):diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.javaindex 47aa6e33ca..e1641374c8 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java@@ -412,6 +412,16 @@ public abstract class AbstractGhidraHeadedDebuggerTestrobot.keyRelease(KeyEvent.VK_ESCAPE);}+ protected static void escapePopupMenu() {+ waitForPass(noExc(() -> {+ pressEscape();+ assertEquals(0, runSwing(() -> {+ return MenuSelectionManager.defaultManager().getSelectedPath().length;+ }).intValue());+ }));+ waitForSwing();+ }+protected static Point getViewportPosition(Component comp) {Component parent = comp.getParent();if (!(parent instanceof JViewport)) {diff --git a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/AbstractDebuggerBreakpointMarkerPluginTest.java b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/AbstractDebuggerBreakpointMarkerPluginTest.javaindex f52ba692c8..2f8a2c21ea 100644--- a/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/AbstractDebuggerBreakpointMarkerPluginTest.java+++ b/Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/gui/breakpoint/AbstractDebuggerBreakpointMarkerPluginTest.java@@ -346,26 +346,31 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>waitForPass(() -> assertEquals(State.ENABLED, lb.computeStateForProgram(program)));- clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),- MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ waitForPass(noExc(() -> {+ clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS, Set.of(+ AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,AbstractDisableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();lb.disableForProgram();waitForDomainObject(program);waitForPass(- () -> assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForProgram(program)));-- clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),- MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,- AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,- AbstractClearBreakpointAction.NAME));+ () -> assertEquals(State.INCONSISTENT_DISABLED,+ lb.computeStateForProgram(program)));++ waitForPass(noExc(() -> {+ clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS,+ Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,+ AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();CompletableFuture<Void> dis = lb.disableForTrace(trace);handleToggleBreakpointInvocation(Unique.assertOne(lb.getTraceBreakpoints(trace)), false);waitOn(dis);@@ -373,24 +378,29 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>waitForPass(() -> assertEquals(State.DISABLED, lb.computeStateForProgram(program)));- clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),- MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,- AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));+ waitForPass(noExc(() -> {+ clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS,+ Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();lb.enableForProgram();waitForDomainObject(program);waitForPass(() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForProgram(program)));- clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),- MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,- AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,- AbstractClearBreakpointAction.NAME));+ waitForPass(noExc(() -> {+ clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS,+ Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,+ AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();// TODO: Margin, too?}@@ -405,24 +415,30 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>waitForPass(() -> assertEquals(State.ENABLED, lb.computeStateForTrace(trace)));- clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ waitForPass(noExc(() -> {+ clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS, Set.of(+ AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,AbstractDisableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();lb.disableForProgram(); // Adds "enable", which will only affect bookmarkwaitForDomainObject(program);waitForPass(() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForTrace(trace)));- clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ waitForPass(noExc(() -> {+ clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS, Set.of(+ AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();CompletableFuture<Void> dis = lb.disableForTrace(trace);handleToggleBreakpointInvocation(Unique.assertOne(lb.getTraceBreakpoints(trace)), false);waitOn(dis);@@ -430,22 +446,29 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>waitForPass(() -> assertEquals(State.DISABLED, lb.computeStateForTrace(trace)));- clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ waitForPass(noExc(() -> {+ clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS, Set.of(+ AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();- pressEscape();lb.enableForProgram(); // This time, adds "disable", which will only affect bookmarkwaitForDomainObject(program);waitForPass(() -> assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForTrace(trace)));- clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);- assertMenu(POPUP_ACTIONS,- Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,+ waitForPass(noExc(() -> {+ clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),+ MouseEvent.BUTTON3);+ assertMenu(POPUP_ACTIONS, Set.of(+ AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,AbstractClearBreakpointAction.NAME));+ }));+ escapePopupMenu();// TODO: Should mixed trace enablement be considered?// TODO: Margin, too?