1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

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 <simon.marchi@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/39769
Tested-by: Hudson CI
Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Simon Marchi 2015-01-16 10:21:09 -05:00 committed by Marc Khouzam
parent 568e8a995b
commit ac6e5420d9
3 changed files with 4 additions and 55 deletions

View file

@ -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<MIStoppedEvent> eventWaitor =
new ServiceEventWaitor<MIStoppedEvent>(
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));
}

View file

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

View file

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