From ac6e5420d9a0cba37460296d4e63d25ae0bcdc38 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 16 Jan 2015 10:21:09 -0500 Subject: [PATCH] debug tests: Remove runToLine runToLine uses gdb's -exec-until, which has a very strange and unpredictable behaviour. It is safer to use runToLocation, which uses a temporary breakpoint + continue. Change-Id: If7bbbdd12570b50f38eb92f1748d10dff96f1f45 Signed-off-by: Simon Marchi Reviewed-on: https://git.eclipse.org/r/39769 Tested-by: Hudson CI Reviewed-by: Marc Khouzam Tested-by: Marc Khouzam --- .../cdt/tests/dsf/gdb/framework/SyncUtil.java | 48 ------------------- .../tests/dsf/gdb/tests/MIRegistersTest.java | 4 +- .../tests/dsf/gdb/tests/MIRunControlTest.java | 7 +-- 3 files changed, 4 insertions(+), 55 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 54be9145d37..6704a14a7b9 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -173,54 +173,6 @@ public class SyncUtil { return eventWaitor.waitForEvent(timeout); } - public static MIStoppedEvent runToLine(final IExecutionDMContext dmc, final String fileName, final int lineNo, - final boolean skipBreakpoints) throws Throwable { - return runToLine(dmc, fileName, lineNo, skipBreakpoints, DefaultTimeouts.get(ETimeout.runToLine)); - } - - public static MIStoppedEvent runToLine(final IExecutionDMContext dmc, final String fileName, final int lineNo, - final boolean skipBreakpoints, final int timeout) throws Throwable { - - final ServiceEventWaitor eventWaitor = - new ServiceEventWaitor( - fSession, - MIStoppedEvent.class); - - fRunControl.getExecutor().submit(new Runnable() { - @Override - public void run() { - // No need for a RequestMonitor since we will wait for the - // ServiceEvent telling us the program has been suspended again - - fGdbControl.queueCommand( - fCommandFactory.createMIExecUntil(dmc, fileName + ":" + lineNo), //$NON-NLS-1$ - null); - } - }); - - // Wait for the execution to suspend after the step - return eventWaitor.waitForEvent(timeout); - } - - public static MIStoppedEvent runToLine(String fileName, int lineNo, - boolean skipBreakpoints) throws Throwable { - return runToLine(fileName, lineNo, skipBreakpoints, DefaultTimeouts.get(ETimeout.runToLine)); - } - - public static MIStoppedEvent runToLine(String fileName, int lineNo, - boolean skipBreakpoints, int timeout) throws Throwable { - IContainerDMContext containerDmc = SyncUtil.getContainerContext(); - return runToLine(containerDmc, fileName, lineNo, skipBreakpoints, timeout); - } - - public static MIStoppedEvent runToLine(String fileName, int lineNo) throws Throwable { - return runToLine(fileName, lineNo, DefaultTimeouts.get(ETimeout.runToLine)); - } - - public static MIStoppedEvent runToLine(String fileName, int lineNo, int timeout) throws Throwable { - return runToLine(fileName, lineNo, false, timeout); - } - public static int addBreakpoint(String location) throws Throwable { return addBreakpoint(location, DefaultTimeouts.get(ETimeout.addBreakpoint)); } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java index 533ea0328e2..5d7010072a7 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java @@ -364,8 +364,8 @@ public class MIRegistersTest extends BaseTestCase { @Test public void compareRegisterForMultipleExecutionContexts() throws Throwable { - MIStoppedEvent stoppedEvent = SyncUtil.runToLine(SOURCE_NAME, - getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); + MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(SOURCE_NAME + ':' + + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); // Get the thread IDs final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(), IContainerDMContext.class); diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java index 2a1f439915b..836121bad39 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRunControlTest.java @@ -274,11 +274,8 @@ public class MIRunControlTest extends BaseTestCase { getGDBLaunch().getSession(), IStartedDMEvent.class); - SyncUtil.runToLine( - fContainerDmc, - SOURCE_NAME, - getLineForTag("LINE_MAIN_AFTER_THREAD_START"), - true); + SyncUtil.runToLocation(SOURCE_NAME + ':' + + getLineForTag("LINE_MAIN_AFTER_THREAD_START")); final IContainerDMContext containerDmc = SyncUtil.getContainerContext();