diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java index 82eb71059f0..42a78b94f62 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunchDelegate.java @@ -439,7 +439,7 @@ public class GdbLaunchDelegate extends AbstractCLaunchDelegate2 * @since 4.0 */ protected boolean isNonStopSupportedInGdbVersion(String version) { - if (NON_STOP_FIRST_VERSION.compareTo(version) <= 0) { + if (NON_STOP_FIRST_VERSION.compareTo(version) <= 0) {// XXX: 7.2 > 7.11 !!! return true; } return false; diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.classpath b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.classpath index 3bc247511f0..eca7bdba8f0 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.classpath +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.classpath @@ -1,7 +1,7 @@ - - + + diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.settings/org.eclipse.jdt.core.prefs b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.settings/org.eclipse.jdt.core.prefs index 0cabaef07ca..b68ee6d28ec 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.settings/org.eclipse.jdt.core.prefs +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/.settings/org.eclipse.jdt.core.prefs @@ -1,9 +1,8 @@ -#Tue Jun 24 11:05:41 PDT 2008 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -67,4 +66,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF index 98b7c97617d..9e8f7038d7d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/META-INF/MANIFEST.MF @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.core.runtime, org.mockito, org.hamcrest Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ClassPath: . Export-Package: org.eclipse.cdt.dsf.mi.service;x-internal:=true, org.eclipse.cdt.tests.dsf.gdb.framework;x-internal:=true, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml index 0051c2b123a..073c486e4f5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml @@ -19,6 +19,7 @@ /shared/common/gdb/gdb-all/bin AutomatedSuite.java 1 + gdb.7.11,gdbserver.7.11 @@ -58,7 +59,7 @@ ${tycho-version} false - ${tycho.testArgLine} ${base.ui.test.vmargs} -ea -Xms256m -Xmx512m -XX:MaxPermSize=256M -Dcdt.tests.dsf.gdb.path=${dsf.gdb.tests.gdbPath} -Ddsf.gdb.tests.timeout.multiplier=${dsf.gdb.tests.timeout.multiplier} + ${tycho.testArgLine} ${base.ui.test.vmargs} -ea -Xms256m -Xmx512m -XX:MaxPermSize=256M -Dcdt.tests.dsf.gdb.path=${dsf.gdb.tests.gdbPath} -Ddsf.gdb.tests.timeout.multiplier=${dsf.gdb.tests.timeout.multiplier} -Dcdt.tests.dsf.gdb.versions=${cdt.tests.dsf.gdb.versions} **/${dsf.gdb.tests.gdbTestSuite} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java new file mode 100644 index 00000000000..9af11771574 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseParametrizedTestCase.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2016 QNX Software System and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Elena Laskavaia (QNX Software System) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.framework; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; + +/** + * This is base test class for all parametrized classes (classes parameter is + * gdb version) + */ +@RunWith(Parameterized.class) +public abstract class BaseParametrizedTestCase extends BaseTestCase { + @Parameterized.Parameters(name = "{0}") + public static Collection getVersions() { + return calculateVersions(); + } + @Parameter public String parameter; + // other fields + private String gdbVersionPostfix; // this is how we want to invoke it + private boolean remote; // this is if we want remote tests (gdbserver) + + protected static List calculateVersions() { + if (globalVersion != null) { + // this is old tests. Version specific suite will set this value + return Collections.singletonList(globalVersion); + } + String gdbVersions = System.getProperty("cdt.tests.dsf.gdb.versions"); + if (gdbVersions == null) { + // this has to be put in maven using -Dcdt.tests.dsf.gdb.versions or in junit config if you run locally + // like this -Dcdt.tests.dsf.gdb.versions=gdb.7.7,gdbserver.7.7 + gdbVersions = "gdb,gdbserver"; + } + String[] versions = gdbVersions.split(","); + return Arrays.asList(versions); + } + + protected void parseParameter() { + if (gdbVersionPostfix == null && parameter != null) { + parameter = parameter.trim(); + if (parameter.startsWith("gdbserver")) { // remote + remote = true; + gdbVersionPostfix = parameter.replaceAll("^gdbserver\\.?", ""); + } else if (parameter.startsWith("gdb")) { // local + remote = false; + gdbVersionPostfix = parameter.replaceAll("^gdb\\.?", ""); + } else { // then it is just local and just version number + remote = false; + gdbVersionPostfix = parameter; + } + if (gdbVersionPostfix.isEmpty()) + gdbVersionPostfix = "default"; + } + } + + public static void resetGlobalState() { + BaseTestCase.removeGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); + BaseTestCase.removeGlobalLaunchAttribute(BaseTestCase.ATTR_DEBUG_SERVER_NAME); + BaseTestCase.removeGlobalLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE); + globalVersion = null; + } + + public void assumeGdbVersionLowerThen(String checkVersion) { + String gdbVersion = getGdbVersion(); + // otherwise it has to be strictly lower + boolean isLower = LaunchUtils.compareVersions(checkVersion, gdbVersion) > 0; + Assume.assumeTrue( + "Skipped because gdb " + gdbVersion + " does not support this feature: removed since " + checkVersion, + isLower); + } + + protected String getGdbVersion() { + if (gdbVersionPostfix==null) gdbVersionPostfix=globalVersion; + String gdbPath = getProgramPath("gdb", gdbVersionPostfix); + return getGdbVersion(gdbPath); + } + + public void assumeGdbVersionAtLeast(String checkVersion) { + String gdbVersion = getGdbVersion(); + if (gdbVersion == GDB_NOT_FOUND) { + String gdbPath = getProgramPath("gdb", gdbVersionPostfix); + // fail assumption + Assume.assumeFalse("GDB cannot be run " + gdbPath, true); + } + if (checkVersion == null || checkVersion.isEmpty() || checkVersion.equals("default")) + return; // no version restrictions + if (checkVersion.equals(gdbVersion)) + return; + // otherwise it has to be same of higher + boolean isSupported = LaunchUtils.compareVersions(checkVersion, gdbVersion) <= 0; + Assume.assumeTrue("Skipped because gdb " + gdbVersion + " does not support this feature: since " + checkVersion, + isSupported); + } + + @Override + protected void setGdbVersion() { + // this will be ignored in new style tests + } + + @Override + protected void initializeLaunchAttributes() { + parseParameter(); + if (gdbVersionPostfix == null) { + // we are not running parametrized + setGdbVersion(); // old way + gdbVersionPostfix = globalVersion; + } else { + String gdbPath = getProgramPath("gdb", gdbVersionPostfix); + String gdbServerPath = getProgramPath("gdbserver", gdbVersionPostfix); + assumeGdbVersionAtLeast(gdbVersionPostfix); + setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, gdbPath); + setLaunchAttribute(ATTR_DEBUG_SERVER_NAME, gdbServerPath); + if (remote) + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, + IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); + } + } + + @AfterClass + public static void afterClass() { + BaseParametrizedTestCase.resetGlobalState(); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java index 8ee9698b9af..fb60f5b91d7 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Ericsson - Initial Implementation * Simon Marchi (Ericsson) - Add and use runningOnWindows(). @@ -25,6 +25,8 @@ import java.util.HashSet; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.dsf.datamodel.IDMEvent; @@ -33,6 +35,7 @@ import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions; import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; +import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils; import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent; import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent; import org.eclipse.cdt.dsf.mi.service.command.output.MIFrame; @@ -83,61 +86,75 @@ public class BaseTestCase { // Timeout value for each individual test private final static int TEST_TIMEOUT = 5 * 60 * 1000; // 5 minutes in milliseconds - + // Make the current test name available through testName.getMethodName() @Rule public TestName testName = new TestName(); - + // Add a timeout for each test, to make sure no test hangs - @Rule public TestRule timeout = new Timeout(TEST_TIMEOUT); - + @Rule public TestRule timeout = new Timeout(TEST_TIMEOUT, TimeUnit.MILLISECONDS); + public static final String ATTR_DEBUG_SERVER_NAME = TestsPlugin.PLUGIN_ID + ".DEBUG_SERVER_NAME"; private static final String DEFAULT_EXEC_NAME = "GDBMIGenericTestApp.exe"; - + private static GdbLaunch fLaunch; // The set of attributes used for the launch of a single test. private Map launchAttributes; - + // A set of global launch attributes which are not // reset when we load a new class of tests. - // This allows a Suite to set an attribute + // This allows a SuiteGdb to set an attribute // The suite is responsible for clearing those attributes // once it is finished private static Map globalLaunchAttributes = new HashMap(); private static Process gdbserverProc; - + /** The MI event associated with the breakpoint at main() */ private MIStoppedEvent fInitialStoppedEvent; - + /** Flag we set to true when the target has reached the breakpoint at main() */ private boolean fTargetSuspended; - - /** Event semaphore we set when the target has reached the breakpoint at main() */ - final private String fTargetSuspendedSem = new String(); // just used as a semaphore + + /** Event semaphore we set when the target has reached the breakpoint at main() */ + final private Object fTargetSuspendedSem = new Object(); // just used as a semaphore private static boolean fgStatusHandlersEnabled = true; + /** global cache of gdb versions, to avoid running gdb every time just to check if it is present*/ + private static Map gdbCache = new HashMap<>(); + protected static String globalVersion; + protected static final String GDB_NOT_FOUND = "not found"; + + private HashMap fTagLocations = new HashMap<>(); public GdbLaunch getGDBLaunch() { return fLaunch; } - - public void setLaunchAttribute(String key, Object value) { + + public void setLaunchAttribute(String key, Object value) { launchAttributes.put(key, value); } - public void removeLaunchAttribute(String key) { + public void removeLaunchAttribute(String key) { launchAttributes.remove(key); } + + public Object getLaunchAttribute(String key) { + return launchAttributes.get(key); + } public static void setGlobalLaunchAttribute(String key, Object value) { globalLaunchAttributes.put(key, value); } + + public static Object getGlobalLaunchAttribite(String key){ + return globalLaunchAttributes.get(key); + } public static void removeGlobalLaunchAttribute(String key) { globalLaunchAttributes.remove(key); } - + public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; } public boolean isRemoteSession() { @@ -158,16 +175,16 @@ public class BaseTestCase { fSession = session; Assert.assertNotNull(session); } - - @DsfServiceEventHandler + + @DsfServiceEventHandler public void eventDispatched(IDMEvent event) { // Wait for the program to have stopped on main. // // We have to jump through hoops to properly handle the remote // case, because of differences between GDB <= 68 and GDB >= 7.0. // - // With GDB >= 7.0, when connecting to the remote gdbserver, - // we get a first *stopped event at connection time. This is + // With GDB >= 7.0, when connecting to the remote gdbserver, + // we get a first *stopped event at connection time. This is // not the ISuspendedDMEvent event we want. We could instead // listen for an IBreakpointHitDMEvent instead. // However, with GDB <= 6.8, temporary breakpoints are not @@ -190,14 +207,14 @@ public class BaseTestCase { // Check the content of the frame for the method we should stop at String stopAt = (String)launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL); if (stopAt == null) stopAt = "main"; - + MIFrame frame = fInitialStoppedEvent.getFrame(); - if (frame != null && + if (frame != null && frame.getFunction() != null && frame.getFunction().indexOf(stopAt) != -1) { // Set the event semaphore that will allow the test to proceed synchronized (fTargetSuspendedSem) { fTargetSuspended = true; - fTargetSuspendedSem.notify(); + fTargetSuspendedSem.notify(); } // We found our event, no further need for this listener @@ -241,17 +258,17 @@ public class BaseTestCase { protected void setLaunchAttributes() { // Clear all launch attributes before starting a new test launchAttributes = new HashMap(); - + launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + DEFAULT_EXEC_NAME); launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, true); launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); - if (launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE) == null) { - launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); - } - + + launchAttributes.put(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); + + // Set these up in case we will be running Remote tests. They will be ignored if we don't launchAttributes.put(ATTR_DEBUG_SERVER_NAME, "gdbserver"); launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true); @@ -259,12 +276,23 @@ public class BaseTestCase { launchAttributes.put(IGDBLaunchConfigurationConstants.ATTR_PORT, "9999"); launchAttributes.put(ITestConstants.LAUNCH_GDB_SERVER, true); - setGdbVersion(); - + initializeLaunchAttributes(); + // Set the global launch attributes launchAttributes.putAll(globalLaunchAttributes); } + /** + * Override this method to initialize test specific launch attributes. + * Use {@link #setLaunchAttribute(String, Object)} method to set them. + * Don't need to clean it up its local to a specific test method. + * Note that global attributes will override these values. + * If it is undesired override {@link #setLaunchAttributes()} method instead + */ + protected void initializeLaunchAttributes() { + setGdbVersion(); + } + /** * Given a set of tags (strings) to find in sourceFile, populate the * fTagLocations map with the line numbers where they are found. @@ -280,32 +308,24 @@ public class BaseTestCase { new BufferedReader(new FileReader(SOURCE_PATH + sourceName))) { Set tagsToFind = new HashSet<>(Arrays.asList(tags)); String line; - int lineNumber = 1; - int numberFound = 0; - line = reader.readLine(); - while (line != null) { + for (int lineNumber = 1; (line = reader.readLine()) != null; lineNumber++) { for (String tag : tagsToFind) { if (line.contains(tag)) { if (fTagLocations.containsKey(tag)) { throw new RuntimeException("Tag " + tag + " was found twice in " + sourceName); } - fTagLocations.put(tag, lineNumber); - numberFound++; + tagsToFind.remove(tag); break; } } - - lineNumber++; - line = reader.readLine(); } - /* Make sure all tags have been found */ - if (numberFound != tagsToFind.size()) { + if (!tagsToFind.isEmpty()) { throw new RuntimeException( - "Some tags were not found in " + sourceName); + "Tags " + tagsToFind + " were not found in " + sourceName); } } } @@ -332,31 +352,31 @@ public class BaseTestCase { */ protected void doLaunch() throws Exception { boolean remote = isRemoteSession(); - + if (GdbDebugOptions.DEBUG) { GdbDebugOptions.trace("===============================================================================================\n"); - GdbDebugOptions.trace(String.format("%s \"%s\" launching %s %s\n", + GdbDebugOptions.trace(String.format("%s \"%s\" launching %s %s\n", GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : "")); GdbDebugOptions.trace("===============================================================================================\n"); } - + boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE) .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); - + launchGdbServer(); - + ILaunchManager launchMgr = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType lcType = launchMgr.getLaunchConfigurationType("org.eclipse.cdt.tests.dsf.gdb.TestLaunch"); assert lcType != null; ILaunchConfigurationWorkingCopy lcWorkingCopy = lcType.newInstance( - null, + null, launchMgr.generateLaunchConfigurationName("Test Launch")); //$NON-NLS-1$ assert lcWorkingCopy != null; lcWorkingCopy.setAttributes(launchAttributes); final ILaunchConfiguration lc = lcWorkingCopy.doSave(); - + // Register ourselves as a listener for the new session so that we can // register ourselves with that particular session before any events // occur. We want to find out when the break on main() occurs. @@ -365,7 +385,7 @@ public class BaseTestCase { public void sessionStarted(DsfSession session) { session.addServiceEventListener(new SessionEventListener(session), null); } - }; + }; // Launch the debug session. The session-started listener will be called // before the launch() call returns (unless, of course, there was a @@ -374,7 +394,7 @@ public class BaseTestCase { fLaunch = (GdbLaunch)lc.launch(ILaunchManager.DEBUG_MODE, new NullProgressMonitor()); DsfSession.removeSessionStartedListener(sessionStartedListener); - // If we haven't hit main() yet, + // If we haven't hit main() yet, // wait for the program to hit the breakpoint at main() before // proceeding. All tests assume that stable initial state. Two // seconds is plenty; we typically get to that state in a few @@ -392,12 +412,12 @@ public class BaseTestCase { Assert.assertNotNull(fInitialStoppedEvent); } } - + // If we started a gdbserver add it to the launch to make sure it is killed at the end if (gdbserverProc != null) { DebugPlugin.newProcess(fLaunch, gdbserverProc, "gdbserver"); } - + // Now initialize our SyncUtility, since we have the launcher SyncUtil.initialize(fLaunch.getSession()); @@ -462,7 +482,7 @@ public class BaseTestCase { GdbDebugOptions.trace("Error while launching command: " + commandLine + "\n"); e.printStackTrace(); assert false; - } + } } } } @@ -470,29 +490,34 @@ public class BaseTestCase { /** * Sets the name of the gdb and gdbserver programs into the launch * configuration used by the test class. - * + * *

* Leaf subclasses are specific to a particular version of GDB and must call * this from their "@BeforeClass" static method so that we end up invoking * the appropriate gdb. - * + * * @param version * string that contains the major and minor version number, e.g., - * "6.8" + * "6.8", special constant "default" represent default gdb on the box (called as "gdb") */ public static void setGdbProgramNamesLaunchAttributes(String version) { - // See bugzilla 303811 for why we have to append ".exe" on Windows - boolean isWindows = runningOnWindows(); - String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path"); - String debugName = "gdb." + version + (isWindows ? ".exe" : ""); - String debugServerName = "gdbserver." + version + (isWindows ? ".exe" : ""); - if (gdbPath != null) { - debugName = gdbPath + "/" + debugName; - debugServerName = gdbPath + "/" + debugServerName; - } - setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, debugName); - setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, debugServerName); + globalVersion = version; + setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, getProgramPath("gdb", version)); + setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, getProgramPath("gdbserver", version)); } + + public static String getProgramPath(String main, String version) { + // See bugzilla 303811 for why we have to append ".exe" on Windows + boolean isWindows = runningOnWindows(); + String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path"); + String fileExtension = isWindows ? ".exe" : ""; + String versionPostfix = (!version.equals("default")) ? "." + version : ""; + String debugName = main + versionPostfix + fileExtension; + if (gdbPath != null) { + debugName = gdbPath + "/" + debugName; + } + return debugName; + } public static boolean supportsNonStop() { return !(runningOnWindows() || runningOnMac()); @@ -504,19 +529,49 @@ public class BaseTestCase { /** * This method will verify that the GDB binary is available, and if it is not, the test will - * be ignored. This method should be called by a Suite that specifies a specific GDB version. + * be ignored. This method should be called by a SuiteGdb that specifies a specific GDB version. */ - public static void ignoreIfGDBMissing() { - try { - // See if we can find GDB by actually running it. - String gdb = (String)globalLaunchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); - Process process = ProcessFactory.getFactory().exec(gdb + " --version"); - process.destroy(); - } catch (IOException e) { - // If we cannot run GDB, just ignore the test case. - Assume.assumeNoException(e); - } - } + public static void ignoreIfGDBMissing() { + String gdb = (String) globalLaunchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); + String version = getGdbVersion(gdb); + // If we cannot run GDB, just ignore the test case. + Assume.assumeFalse("GDB cannot be run " + gdb, version == GDB_NOT_FOUND); + } + + protected static String getGdbVersion(String gdb) { + try { + // See if we can find GDB by actually running it. + String version = gdbCache.get(gdb); + if (version == null) { + version = doReadGdbVersion(gdb); + gdbCache.put(gdb, version); + } + return version; + } catch (IOException e) { + gdbCache.put(gdb, GDB_NOT_FOUND); + return GDB_NOT_FOUND; + } + } + + protected static String doReadGdbVersion(String gdb) throws IOException { + Process process = ProcessFactory.getFactory().exec(gdb + " --version"); + try { + String streamOutput; + try (BufferedReader buffer = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + streamOutput = buffer.lines().collect(Collectors.joining("\n")); + } + String gdbVersion = LaunchUtils.getGDBVersionFromText(streamOutput); + return gdbVersion; + } finally { + try { + process.getOutputStream().close(); + process.getErrorStream().close(); + process.destroy(); + } catch (IOException e) { + // ignore these + } + } + } protected static boolean runningOnWindows() { return Platform.getOS().equals(Platform.OS_WIN32); @@ -538,5 +593,5 @@ public class BaseTestCase { public static void restoreGlobalPreferences() { IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier()); node.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, fgStatusHandlersEnabled); - } + } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuites.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuites.java index b4e3cdcff16..50c7f4265ed 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuites.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuites.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Ericsson - Initial Implementation *******************************************************************************/ @@ -29,7 +29,7 @@ import org.junit.runners.Suite; * the annotations which list all the different JUnit suites we * want to run. When creating a new suite class, it should be * added to the list below. - * + * * This suite runs all the other suites. */ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java index ba597599937..dcf4137dce7 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java @@ -4,27 +4,22 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Marc Khouzam (Ericsson) - Initial Implementation *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.tests; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.Suite_7_11; import org.junit.runner.RunWith; import org.junit.runners.Suite; /** - * This suite runs all suites that are part of the tests - * automatically run with each CDT build. + * This suite runs all suites that are part of the tests automatically run with + * each CDT build. */ - @RunWith(Suite.class) @Suite.SuiteClasses({ - Suite_7_11.class, - // Can't run the Remote test just yet because they - // have the same names on the local tests, which is - // not handled by JUnit (https://bugs.eclipse.org/172256) + SuiteGdb.class, }) - -public class AutomatedSuite {} \ No newline at end of file +public class AutomatedSuite { +} \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java index 80809b2ba03..0e5bd4bc78c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Ericsson - Initial Implementation * Simon Marchi (Ericsson) - Use runningOnWindows(). @@ -19,6 +19,7 @@ import java.math.BigInteger; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.debug.core.model.ICBreakpoint; @@ -57,263 +58,253 @@ import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor; -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.model.IBreakpoint; import org.junit.Assert; +import org.junit.Assume; import org.junit.Ignore; import org.junit.Test; +import org.junit.rules.Timeout; import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.model.Statement; /* * This is the Breakpoint Service test suite. - * + * * It is meant to be a regression suite to be executed automatically against * the DSF nightly builds. - * + * * It is also meant to be augmented with a proper test case(s) every time a * feature is added or in the event (unlikely :-) that a bug is found in the * Breakpoint Service. - * + * * Refer to the JUnit4 documentation for an explanation of the annotations. */ +@RunWith(Parameterized.class) +public class MIBreakpointsTest extends BaseParametrizedTestCase { + // Global constants + public static final String PLUGIN_ID = "org.eclipse.cdt.debug.core"; //$NON-NLS-1$ + public static final String SOURCE_PROJECT = "MIBreakpointsTest"; + public static final String SOURCE_FOLDER = "src"; + public static final String SOURCE_NAME = "BreakpointTestApp.cc"; //$NON-NLS-1$ + public static final String EXEC_NAME = "BreakpointTestApp.exe"; //$NON-NLS-1$ + // Asynchronous Completion + protected final AsyncCompletionWaitor fWait = new AsyncCompletionWaitor(); + // Services references + protected DsfSession fSession; + protected IBreakpointsTargetDMContext fBreakpointsDmc; + protected DsfServicesTracker fServicesTracker; + protected MIRunControl fRunControl; + protected IBreakpoints fBreakpointService; + protected IExpressions fExpressionService; + protected IGDBControl fCommandControl; + // Event Management + protected static Boolean lock = true; -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest extends BaseTestCase { - - // Global constants - public static final String PLUGIN_ID = "org.eclipse.cdt.debug.core" ; //$NON-NLS-1$ - - public static final String SOURCE_PROJECT = "MIBreakpointsTest"; - public static final String SOURCE_FOLDER = "src"; - public static final String SOURCE_NAME = "BreakpointTestApp.cc"; //$NON-NLS-1$ - public static final String EXEC_NAME = "BreakpointTestApp.exe"; //$NON-NLS-1$ - - // Asynchronous Completion - protected final AsyncCompletionWaitor fWait = new AsyncCompletionWaitor(); - - // Services references - protected DsfSession fSession; - protected IBreakpointsTargetDMContext fBreakpointsDmc; - protected DsfServicesTracker fServicesTracker; - protected MIRunControl fRunControl; - protected IBreakpoints fBreakpointService; - protected IExpressions fExpressionService; - protected IGDBControl fCommandControl; - - // Event Management - protected static Boolean lock = true; - protected enum Events { BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT, WP_HIT, WP_OOS } - protected final int BP_ADDED = Events.BP_ADDED.ordinal(); - protected final int BP_UPDATED = Events.BP_UPDATED.ordinal(); - protected final int BP_REMOVED = Events.BP_REMOVED.ordinal(); - protected final int BP_HIT = Events.BP_HIT.ordinal(); - protected final int WP_HIT = Events.WP_HIT.ordinal(); - protected final int WP_OOS = Events.WP_OOS.ordinal(); - protected int[] fBreakpointEvents = new int[Events.values().length]; - protected int fBreakpointEventCount; - protected int fBreakpointRef; - - // Some useful constants + protected enum Events { + BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT, WP_HIT, WP_OOS + } + protected final int BP_ADDED = Events.BP_ADDED.ordinal(); + protected final int BP_UPDATED = Events.BP_UPDATED.ordinal(); + protected final int BP_REMOVED = Events.BP_REMOVED.ordinal(); + protected final int BP_HIT = Events.BP_HIT.ordinal(); + protected final int WP_HIT = Events.WP_HIT.ordinal(); + protected final int WP_OOS = Events.WP_OOS.ordinal(); + protected int[] fBreakpointEvents = new int[Events.values().length]; + protected int fBreakpointEventCount; + protected int fBreakpointRef; + // Some useful constants protected final String BREAKPOINT_TYPE_TAG = MIBreakpoints.BREAKPOINT_TYPE; protected final String BREAKPOINT_TAG = MIBreakpoints.BREAKPOINT; protected final String WATCHPOINT_TAG = MIBreakpoints.WATCHPOINT; - - protected final String FILE_NAME_TAG = MIBreakpoints.FILE_NAME; - protected final String LINE_NUMBER_TAG = MIBreakpoints.LINE_NUMBER; - protected final String FUNCTION_TAG = MIBreakpoints.FUNCTION; - protected final String ADDRESS_TAG = MIBreakpoints.ADDRESS; - protected final String CONDITION_TAG = MIBreakpoints.CONDITION; + protected final String FILE_NAME_TAG = MIBreakpoints.FILE_NAME; + protected final String LINE_NUMBER_TAG = MIBreakpoints.LINE_NUMBER; + protected final String FUNCTION_TAG = MIBreakpoints.FUNCTION; + protected final String ADDRESS_TAG = MIBreakpoints.ADDRESS; + protected final String CONDITION_TAG = MIBreakpoints.CONDITION; protected final String IGNORE_COUNT_TAG = MIBreakpoints.IGNORE_COUNT; - protected final String IS_ENABLED_TAG = MIBreakpoints.IS_ENABLED; - protected final String THREAD_ID_TAG = MIBreakpointDMData.THREAD_ID; - protected final String NUMBER_TAG = MIBreakpointDMData.NUMBER; + protected final String IS_ENABLED_TAG = MIBreakpoints.IS_ENABLED; + protected final String THREAD_ID_TAG = MIBreakpointDMData.THREAD_ID; + protected final String NUMBER_TAG = MIBreakpointDMData.NUMBER; + protected final String EXPRESSION_TAG = MIBreakpoints.EXPRESSION; + protected final String READ_TAG = MIBreakpoints.READ; + protected final String WRITE_TAG = MIBreakpoints.WRITE; + // Target application 'special' locations + protected final int LINE_NUMBER_1 = 20; + protected final int LINE_NUMBER_2 = 21; + protected final int LINE_NUMBER_3 = 27; + protected final int LINE_NUMBER_4 = 36; + protected final int LINE_NUMBER_5 = 49; + protected final int LINE_NUMBER_6 = 50; + protected final String FUNCTION = "zeroBlocks"; + protected final String SIGNED_FUNCTION = "zeroBlocks(int)"; + protected final String NO_CONDITION = ""; + // NOTE: The back-end can reformat the condition. In order for the + // comparison to work, better specify the condition as the back-end + // would have it. + private final String CONDITION_1 = "i == 128"; + private final String CONDITION_2 = "i == 64"; + private final String CONDITION_3 = "j == 20"; + private final String CONDITION_4 = "a == 20"; + private final String CONDITION_5 = "a == 10"; + private final int IGNORE_COUNT_1 = 128; + private final int IGNORE_COUNT_2 = 20; + private final String EXPRESSION_1 = "charBlock[20]"; + private final String EXPRESSION_2 = "j"; + private final String EXPRESSION_3 = "a"; + // Error messages + protected final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context"; + protected final String INVALID_BREAKPOINT_LOCATION = "Invalid breakpoint location"; + protected final String BREAKPOINT_INSERTION_FAILURE = "Breakpoint insertion failure"; + protected final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; - protected final String EXPRESSION_TAG = MIBreakpoints.EXPRESSION; - protected final String READ_TAG = MIBreakpoints.READ; - protected final String WRITE_TAG = MIBreakpoints.WRITE; + // ======================================================================== + // Housekeeping stuff + // ======================================================================== + @Override + protected void setLaunchAttributes() { + super.setLaunchAttributes(); + // Select the binary to run the tests against + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME); + } - // Target application 'special' locations - protected final int LINE_NUMBER_1 = 20; - protected final int LINE_NUMBER_2 = 21; - protected final int LINE_NUMBER_3 = 27; - protected final int LINE_NUMBER_4 = 36; - protected final int LINE_NUMBER_5 = 49; - protected final int LINE_NUMBER_6 = 50; - protected final String FUNCTION = "zeroBlocks"; - protected final String SIGNED_FUNCTION = "zeroBlocks(int)"; - protected final String NO_CONDITION = ""; - - // NOTE: The back-end can reformat the condition. In order for the - // comparison to work, better specify the condition as the back-end - // would have it. - private final String CONDITION_1 = "i == 128"; - private final String CONDITION_2 = "i == 64"; - private final String CONDITION_3 = "j == 20"; - private final String CONDITION_4 = "a == 20"; - private final String CONDITION_5 = "a == 10"; - private final int IGNORE_COUNT_1 = 128; - private final int IGNORE_COUNT_2 = 20; - - private final String EXPRESSION_1 = "charBlock[20]"; - private final String EXPRESSION_2 = "j"; - private final String EXPRESSION_3 = "a"; - - // Error messages - protected final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context"; - protected final String INVALID_BREAKPOINT_LOCATION = "Invalid breakpoint location"; - protected final String BREAKPOINT_INSERTION_FAILURE = "Breakpoint insertion failure"; - protected final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; - - // ======================================================================== - // Housekeeping stuff - // ======================================================================== - - @Override - protected void setLaunchAttributes() { - super.setLaunchAttributes(); - - // Select the binary to run the tests against - setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME); - } - - @Override - public void doBeforeTest() throws Exception { - super.doBeforeTest(); - - // Get a reference to the breakpoint service - fSession = getGDBLaunch().getSession(); - Runnable runnable = new Runnable() { - @Override + @Override + public void doBeforeTest() throws Exception { + super.doBeforeTest(); + // Get a reference to the breakpoint service + fSession = getGDBLaunch().getSession(); + Runnable runnable = new Runnable() { + @Override public void run() { - fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); - assert(fServicesTracker != null); - - fRunControl = fServicesTracker.getService(MIRunControl.class); - assert(fRunControl != null); + fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); + assert (fServicesTracker != null); + fRunControl = fServicesTracker.getService(MIRunControl.class); + assert (fRunControl != null); + fBreakpointService = fServicesTracker.getService(IBreakpoints.class); + assert (fBreakpointService != null); + fExpressionService = fServicesTracker.getService(IExpressions.class); + assert (fExpressionService != null); + fCommandControl = fServicesTracker.getService(IGDBControl.class); + assert (fCommandControl != null); + // Register to breakpoint events + fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null); + clearEventCounters(); + } + }; + fSession.getExecutor().submit(runnable).get(); + IContainerDMContext containerDmc = SyncUtil.getContainerContext(); + fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); + assert (fBreakpointsDmc != null); + } - fBreakpointService = fServicesTracker.getService(IBreakpoints.class); - assert(fBreakpointService != null); + @Override + public void doAfterTest() throws Exception { + super.doAfterTest(); + // cleanup cannot assume sane state since it runs even test is failed or skipped + if (fSession != null) { + // Clear the references (not strictly necessary) + Runnable runnable = new Runnable() { + @Override + public void run() { + fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this); + } + }; + fSession.getExecutor().submit(runnable).get(); + } + fBreakpointService = null; + fRunControl = null; + if (fServicesTracker != null) + fServicesTracker.dispose(); + fServicesTracker = null; + clearEventCounters(); + } + // ======================================================================== + // Event Management Functions + // ======================================================================== - fExpressionService = fServicesTracker.getService(IExpressions.class); - assert(fExpressionService != null); - - fCommandControl = fServicesTracker.getService(IGDBControl.class); - assert(fCommandControl != null); - - // Register to breakpoint events - fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null); - - clearEventCounters(); - } - }; - fSession.getExecutor().submit(runnable).get(); - - IContainerDMContext containerDmc = SyncUtil.getContainerContext(); - fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); - assert(fBreakpointsDmc != null); - } - - @Override - public void doAfterTest() throws Exception { - super.doAfterTest(); - - // Clear the references (not strictly necessary) - Runnable runnable = new Runnable() { - @Override - public void run() { - fRunControl.getSession().removeServiceEventListener(MIBreakpointsTest.this); - } - }; - fSession.getExecutor().submit(runnable).get(); - fBreakpointService = null; - fRunControl = null; - fServicesTracker.dispose(); - fServicesTracker = null; - - clearEventCounters(); - } - - // ======================================================================== - // Event Management Functions - // ======================================================================== - - /* ----------------------------------------------------------------------- - * eventDispatched - * ------------------------------------------------------------------------ - * Processes BreakpointHitEvent. - * ------------------------------------------------------------------------ - * @param e The BreakpointEvent - * ------------------------------------------------------------------------ - */ - @DsfServiceEventHandler + /* ----------------------------------------------------------------------- + * eventDispatched + * ------------------------------------------------------------------------ + * Processes BreakpointHitEvent. + * ------------------------------------------------------------------------ + * @param e The BreakpointEvent + * ------------------------------------------------------------------------ + */ + @DsfServiceEventHandler public void eventDispatched(IBreakpointsAddedEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event\n"); - fBreakpointEvents[BP_ADDED]++; - fBreakpointEventCount++; - fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event\n"); + fBreakpointEvents[BP_ADDED]++; + fBreakpointEventCount++; + fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); + lock.notifyAll(); + } } - @DsfServiceEventHandler + @DsfServiceEventHandler public void eventDispatched(IBreakpointsUpdatedEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event\n"); - fBreakpointEvents[BP_UPDATED]++; - fBreakpointEventCount++; - fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event\n"); + fBreakpointEvents[BP_UPDATED]++; + fBreakpointEventCount++; + fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); + lock.notifyAll(); + } } - @DsfServiceEventHandler + @DsfServiceEventHandler public void eventDispatched(IBreakpointsRemovedEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event\n"); - fBreakpointEvents[BP_REMOVED]++; - fBreakpointEventCount++; - fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event\n"); + fBreakpointEvents[BP_REMOVED]++; + fBreakpointEventCount++; + fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference(); + lock.notifyAll(); + } } - @DsfServiceEventHandler + @DsfServiceEventHandler public void eventDispatched(MIBreakpointHitEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event\n"); - fBreakpointEvents[BP_HIT]++; - fBreakpointEventCount++; - fBreakpointRef = e.getNumber(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event\n"); + fBreakpointEvents[BP_HIT]++; + fBreakpointEventCount++; + fBreakpointRef = e.getNumber(); + lock.notifyAll(); + } } - @DsfServiceEventHandler + @DsfServiceEventHandler public void eventDispatched(MIWatchpointTriggerEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp hit event\n"); - fBreakpointEvents[WP_HIT]++; - fBreakpointEventCount++; - fBreakpointRef = e.getNumber(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp hit event\n"); + fBreakpointEvents[WP_HIT]++; + fBreakpointEventCount++; + fBreakpointRef = e.getNumber(); + lock.notifyAll(); + } } - @DsfServiceEventHandler + @DsfServiceEventHandler public void eventDispatched(MIWatchpointScopeEvent e) { - synchronized (lock) { - if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp scope event\n"); - fBreakpointEvents[WP_OOS]++; - fBreakpointEventCount++; - fBreakpointRef = e.getNumber(); - lock.notifyAll(); - } + synchronized (lock) { + if (GdbDebugOptions.DEBUG) + GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp scope event\n"); + fBreakpointEvents[WP_OOS]++; + fBreakpointEventCount++; + fBreakpointRef = e.getNumber(); + lock.notifyAll(); + } } // Clears the counters @@ -329,9 +320,9 @@ public class MIBreakpointsTest extends BaseTestCase { // Get the breakpoint hit count protected int getBreakpointEventCount(int event) { int count = 0; - synchronized (lock) { - count = fBreakpointEvents[event]; - } + synchronized (lock) { + count = fBreakpointEvents[event]; + } return count; } @@ -339,62 +330,73 @@ public class MIBreakpointsTest extends BaseTestCase { * Suspends the calling thread until [count] number of breakpoint events * have been received in the current test. NOTE: too simple for real life * but good enough for this test suite - * + * * @param count * the number breakpoint events to wait for * @param timeout * max wait time, in milliseconds */ - private void waitForBreakpointEvent(int count, int timeout) throws Exception { - long startMs = System.currentTimeMillis(); + private void waitForBreakpointEvent(int count, final int timeout) throws Exception { + try { + Timeout.builder().withTimeout(timeout, TimeUnit.MILLISECONDS).build().apply( + new Statement() { + @Override + public void evaluate() throws Throwable { + synchronized (lock) { + while (fBreakpointEventCount < count) { + try { + lock.wait(timeout); + } catch (InterruptedException ex) { + break; + } + } + } + } + }, null).evaluate(); + } catch (TimeoutException e) { + throw new Exception("Timed out waiting for " + count + " breakpoint events to occur. Only " + + fBreakpointEventCount + " occurred.", e); + } catch (Throwable e) { + // evaluate should not throw anything bad + } synchronized (lock) { - // Make sure we don't wait forever, in case an event never - // arrives. The test will check if everything was received - while (fBreakpointEventCount < count) { - try { - lock.wait(30); - } catch (InterruptedException ex) { - } - if (System.currentTimeMillis() - startMs > timeout) { - throw new Exception("Timed out waiting for " + count + " breakpoint events to occur. Only " + fBreakpointEventCount + " occurred."); - } + if (fBreakpointEventCount < count) { + throw new Exception("Interrupted while waiting for " + count + " breakpoint events to occur. Only " + + fBreakpointEventCount + " occurred."); } } } - + /** * Simplified variant that just waits up to two seconds */ protected void waitForBreakpointEvent(int count) throws Exception { waitForBreakpointEvent(count, TestsPlugin.massageTimeout(2000)); } + // ======================================================================== + // Helper Functions + // ======================================================================== - // ======================================================================== - // Helper Functions - // ======================================================================== - - /* ------------------------------------------------------------------------ - * evaluateExpression - * ------------------------------------------------------------------------ - * Invokes the ExpressionService to evaluate an expression. In theory, - * we shouldn't rely on another service to test this one but we need a - * way to access a variable from the test application in order verify - * that the memory operations (read/write) are working properly. - * ------------------------------------------------------------------------ - * @param expression Expression to resolve @return Resolved expression - * @throws InterruptedException - * ------------------------------------------------------------------------ - */ - private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable { - - // Get a stack context (temporary - should be an MIcontainerDMC) + /* ------------------------------------------------------------------------ + * evaluateExpression + * ------------------------------------------------------------------------ + * Invokes the ExpressionService to evaluate an expression. In theory, + * we shouldn't rely on another service to test this one but we need a + * way to access a variable from the test application in order verify + * that the memory operations (read/write) are working properly. + * ------------------------------------------------------------------------ + * @param expression Expression to resolve @return Resolved expression + * @throws InterruptedException + * ------------------------------------------------------------------------ + */ + private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable { + // Get a stack context (temporary - should be an MIcontainerDMC) final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression); final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpressionService, expressionDMC, IFormattedValues.DECIMAL_FORMAT); - // Create the DataRequestMonitor which will store the operation result in the wait object - final DataRequestMonitor drm = - new DataRequestMonitor(fSession.getExecutor(), null) { + final DataRequestMonitor drm = new DataRequestMonitor( + fSession.getExecutor(), null) { @Override protected void handleCompleted() { if (isSuccess()) { @@ -403,7 +405,6 @@ public class MIBreakpointsTest extends BaseTestCase { fWait.waitFinished(getStatus()); } }; - // Evaluate the expression (asynchronously) fWait.waitReset(); fSession.getExecutor().submit(new Runnable() { @@ -412,331 +413,294 @@ public class MIBreakpointsTest extends BaseTestCase { fExpressionService.getFormattedExpressionValue(formattedValueDMC, drm); } }); - // Wait for completion fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); assertTrue(fWait.getMessage(), fWait.isOK()); - // Return the string formatted by the back-end String result = ""; Object returnInfo = fWait.getReturnInfo(); if (returnInfo instanceof FormattedValueDMData) result = ((FormattedValueDMData) returnInfo).getFormattedValue(); return new BigInteger(result); - } + } - /* ------------------------------------------------------------------------ - * getBreakpoints - * ------------------------------------------------------------------------ - * Retrieves the installed breakpoints list - * ------------------------------------------------------------------------ - * Typical usage: - * IBreakpointDMContext[] breakpoints = getBreakpoints(context); - * ------------------------------------------------------------------------ - * @param context the execution context - * ------------------------------------------------------------------------ - */ - protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws InterruptedException - { - // Clear the completion waiter + /* ------------------------------------------------------------------------ + * getBreakpoints + * ------------------------------------------------------------------------ + * Retrieves the installed breakpoints list + * ------------------------------------------------------------------------ + * Typical usage: + * IBreakpointDMContext[] breakpoints = getBreakpoints(context); + * ------------------------------------------------------------------------ + * @param context the execution context + * ------------------------------------------------------------------------ + */ + protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) + throws InterruptedException { + // Clear the completion waiter fWait.waitReset(); - - // Set the Request Monitor - final DataRequestMonitor drm = - new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - fWait.waitFinished(getStatus()); - } - }; - - // Issue the breakpoint request - fWait.waitReset(); - fBreakpointService.getExecutor().submit(new Runnable() { - @Override - public void run() { - fBreakpointService.getBreakpoints(context, drm); - } - }); - - // Wait for completion - fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); - assertTrue(fWait.getMessage(), fWait.isOK()); - - // Return the string formatted by the back-end - return drm.getData(); - } - - /* ------------------------------------------------------------------------ - * getBreakpoint - * ------------------------------------------------------------------------ - * Retrieves the installed breakpoint - * ------------------------------------------------------------------------ - * Typical usage: - * IBreakpointDMContext breakpoint = ...; - * IBreakpointDMData bp = getBreakpoint(breakpoint); - * ------------------------------------------------------------------------ - * @param breakpoint the breakpoint to retrieve - * ------------------------------------------------------------------------ - */ - protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException - { - // Clear the completion waiter + // Set the Request Monitor + final DataRequestMonitor drm = new DataRequestMonitor( + fBreakpointService.getExecutor(), null) { + @Override + protected void handleCompleted() { + fWait.waitFinished(getStatus()); + } + }; + // Issue the breakpoint request fWait.waitReset(); - - // Set the Request Monitor - final DataRequestMonitor drm = - new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - fWait.waitFinished(getStatus()); - } - }; - - // Issue the breakpoint request - fWait.waitReset(); - fBreakpointService.getExecutor().submit(new Runnable() { - @Override + fBreakpointService.getExecutor().submit(new Runnable() { + @Override public void run() { - fBreakpointService.getBreakpointDMData(breakpoint, drm); - } - }); + fBreakpointService.getBreakpoints(context, drm); + } + }); + // Wait for completion + fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); + assertTrue(fWait.getMessage(), fWait.isOK()); + // Return the string formatted by the back-end + return drm.getData(); + } - // Wait for completion - fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); - assertTrue(fWait.getMessage(), fWait.isOK()); - - // Return the string formatted by the back-end - return drm.getData(); - } + /* ------------------------------------------------------------------------ + * getBreakpoint + * ------------------------------------------------------------------------ + * Retrieves the installed breakpoint + * ------------------------------------------------------------------------ + * Typical usage: + * IBreakpointDMContext breakpoint = ...; + * IBreakpointDMData bp = getBreakpoint(breakpoint); + * ------------------------------------------------------------------------ + * @param breakpoint the breakpoint to retrieve + * ------------------------------------------------------------------------ + */ + protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException { + // Clear the completion waiter + fWait.waitReset(); + // Set the Request Monitor + final DataRequestMonitor drm = new DataRequestMonitor( + fBreakpointService.getExecutor(), null) { + @Override + protected void handleCompleted() { + fWait.waitFinished(getStatus()); + } + }; + // Issue the breakpoint request + fWait.waitReset(); + fBreakpointService.getExecutor().submit(new Runnable() { + @Override + public void run() { + fBreakpointService.getBreakpointDMData(breakpoint, drm); + } + }); + // Wait for completion + fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); + assertTrue(fWait.getMessage(), fWait.isOK()); + // Return the string formatted by the back-end + return drm.getData(); + } /** * Utility method for setting a line breakpoint in the test's source file and * then running to it. - * + * * @param lineNumber the line to set the breakpoint on * @return the breakpoint DM context * @throws Throwable */ - private IBreakpointDMContext insertAndRunToLineBreakpoint(int lineNumber) throws Throwable { - clearEventCounters(); - + private IBreakpointDMContext insertAndRunToLineBreakpoint(int lineNumber) throws Throwable { + clearEventCounters(); // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, lineNumber); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); SyncUtil.resumeUntilStopped(2000); - waitForBreakpointEvent(1); // breakpoint hit + waitForBreakpointEvent(1); // breakpoint hit clearEventCounters(); - return ref; - } - - /* ------------------------------------------------------------------------ - * insertBreakpoint - * ------------------------------------------------------------------------ - * Issues an add breakpoint request. - * ------------------------------------------------------------------------ - * Typical usage: - * bp = insertBreakpoint(context, attributes); - * assertTrue(fWait.getMessage(), fWait.isOK()); - * ------------------------------------------------------------------------ - * @param context the execution context - * @param attributes the breakpoint attributes - * ------------------------------------------------------------------------ - */ - protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context, - final Map attributes) throws InterruptedException - { - // Clear the completion waiter - fWait.waitReset(); + } + /* ------------------------------------------------------------------------ + * insertBreakpoint + * ------------------------------------------------------------------------ + * Issues an add breakpoint request. + * ------------------------------------------------------------------------ + * Typical usage: + * bp = insertBreakpoint(context, attributes); + * assertTrue(fWait.getMessage(), fWait.isOK()); + * ------------------------------------------------------------------------ + * @param context the execution context + * @param attributes the breakpoint attributes + * ------------------------------------------------------------------------ + */ + protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context, + final Map attributes) throws InterruptedException { + // Clear the completion waiter + fWait.waitReset(); // Set the Request Monitor - final DataRequestMonitor drm = - new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - fWait.waitFinished(getStatus()); - } - }; - - // Issue the remove insertion request - fBreakpointService.getExecutor().submit(new Runnable() { - @Override + final DataRequestMonitor drm = new DataRequestMonitor( + fBreakpointService.getExecutor(), null) { + @Override + protected void handleCompleted() { + fWait.waitFinished(getStatus()); + } + }; + // Issue the remove insertion request + fBreakpointService.getExecutor().submit(new Runnable() { + @Override public void run() { - fBreakpointService.insertBreakpoint(context, attributes, drm); - } - }); + fBreakpointService.insertBreakpoint(context, attributes, drm); + } + }); + // Wait for the result and return the breakpoint id + fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); + return drm.getData(); + } - // Wait for the result and return the breakpoint id - fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); - return drm.getData(); - } - - /* ------------------------------------------------------------------------ - * removeBreakpoint - * ------------------------------------------------------------------------ - * Issues a remove breakpoint request. - * ------------------------------------------------------------------------ - * Typical usage: - * IBreakpointDMContext breakpoint = ...; - * removeBreakpoint(context, breakpoint); - * assertTrue(fWait.getMessage(), fWait.isOK()); - * ------------------------------------------------------------------------ - * @param breakpoint the breakpoint to remove - * ------------------------------------------------------------------------ - */ - private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException - { - // Clear the completion waiter + /* ------------------------------------------------------------------------ + * removeBreakpoint + * ------------------------------------------------------------------------ + * Issues a remove breakpoint request. + * ------------------------------------------------------------------------ + * Typical usage: + * IBreakpointDMContext breakpoint = ...; + * removeBreakpoint(context, breakpoint); + * assertTrue(fWait.getMessage(), fWait.isOK()); + * ------------------------------------------------------------------------ + * @param breakpoint the breakpoint to remove + * ------------------------------------------------------------------------ + */ + private void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException { + // Clear the completion waiter fWait.waitReset(); - - // Set the Request Monitor - final RequestMonitor rm = - new RequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - fWait.waitFinished(getStatus()); - } - }; - - // Issue the add breakpoint request - fBreakpointService.getExecutor().submit(new Runnable() { - @Override + // Set the Request Monitor + final RequestMonitor rm = new RequestMonitor(fBreakpointService.getExecutor(), null) { + @Override + protected void handleCompleted() { + fWait.waitFinished(getStatus()); + } + }; + // Issue the add breakpoint request + fBreakpointService.getExecutor().submit(new Runnable() { + @Override public void run() { - fBreakpointService.removeBreakpoint(breakpoint, rm); - } - }); + fBreakpointService.removeBreakpoint(breakpoint, rm); + } + }); + // Wait for the result + fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); + } - // Wait for the result - fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); - } - - /* ------------------------------------------------------------------------ - * updateBreakpoint - * ------------------------------------------------------------------------ - * Issues an update breakpoint request. - * ------------------------------------------------------------------------ - * Typical usage: - * updateBreakpoint(context, breakpoint, properties); - * assertTrue(fWait.getMessage(), fWait.isOK()); - * ------------------------------------------------------------------------ - * @param breakpoint the breakpoint to update - * @param delta the delta properties - * ------------------------------------------------------------------------ - */ - private void updateBreakpoint(final IBreakpointDMContext breakpoint, - final Map delta) throws InterruptedException - { - // Clear the completion waiter + /* ------------------------------------------------------------------------ + * updateBreakpoint + * ------------------------------------------------------------------------ + * Issues an update breakpoint request. + * ------------------------------------------------------------------------ + * Typical usage: + * updateBreakpoint(context, breakpoint, properties); + * assertTrue(fWait.getMessage(), fWait.isOK()); + * ------------------------------------------------------------------------ + * @param breakpoint the breakpoint to update + * @param delta the delta properties + * ------------------------------------------------------------------------ + */ + private void updateBreakpoint(final IBreakpointDMContext breakpoint, + final Map delta) throws InterruptedException { + // Clear the completion waiter fWait.waitReset(); - - // Set the Request Monitor - final RequestMonitor rm = - new RequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - fWait.waitFinished(getStatus()); - } - }; - - // Issue the update breakpoint request - fBreakpointService.getExecutor().submit(new Runnable() { - @Override + // Set the Request Monitor + final RequestMonitor rm = new RequestMonitor(fBreakpointService.getExecutor(), null) { + @Override + protected void handleCompleted() { + fWait.waitFinished(getStatus()); + } + }; + // Issue the update breakpoint request + fBreakpointService.getExecutor().submit(new Runnable() { + @Override public void run() { - fBreakpointService.updateBreakpoint(breakpoint, delta, rm); - } - }); - - // Wait for the result - fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); - } - - // ======================================================================== - // Test Cases - // ------------------------------------------------------------------------ - // Templates: - // ------------------------------------------------------------------------ - // @Test - // public void basicTest() { - // // First test to run - // assertTrue("", true); - // } - // ------------------------------------------------------------------------ - // @Test(timeout=5000) - // public void timeoutTest() { - // // Second test to run, which will timeout if not finished on time - // assertTrue("", true); - // } - // ------------------------------------------------------------------------ - // @Test(expected=FileNotFoundException.class) - // public void exceptionTest() throws FileNotFoundException { - // // Third test to run which expects an exception - // throw new FileNotFoundException("Just testing"); - // } - // ======================================================================== - + fBreakpointService.updateBreakpoint(breakpoint, delta, rm); + } + }); + // Wait for the result + fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); + } + // ======================================================================== + // Test Cases + // ------------------------------------------------------------------------ + // Templates: + // ------------------------------------------------------------------------ + // @Test + // public void basicTest() { + // // First test to run + // assertTrue("", true); + // } + // ------------------------------------------------------------------------ + // @Test(timeout=5000) + // public void timeoutTest() { + // // Second test to run, which will timeout if not finished on time + // assertTrue("", true); + // } + // ------------------------------------------------------------------------ + // @Test(expected=FileNotFoundException.class) + // public void exceptionTest() throws FileNotFoundException { + // // Third test to run which expects an exception + // throw new FileNotFoundException("Just testing"); + // } + // ======================================================================== + /////////////////////////////////////////////////////////////////////////// + // Add Breakpoint tests /////////////////////////////////////////////////////////////////////////// - // Add Breakpoint tests - /////////////////////////////////////////////////////////////////////////// - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ // insertBreakpoint_InvalidContext // ------------------------------------------------------------------------ - @Test + @Test public void insertBreakpoint_InvalidContext() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Perform the test String expected = UNKNOWN_EXECUTION_CONTEXT; insertBreakpoint(null, breakpoint); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); - } + } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ // insertBreakpoint_InvalidFileName // ------------------------------------------------------------------------ @Test public void insertBreakpoint_InvalidFileName() throws Throwable { - + assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_6_8); // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME + "_bad"); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Perform the test String expected = BREAKPOINT_INSERTION_FAILURE; insertBreakpoint(fBreakpointsDmc, breakpoint); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); @@ -747,20 +711,18 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_InvalidLineNumber() throws Throwable { - + assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_7_4); // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, 0); - // Perform the test String expected = BREAKPOINT_INSERTION_FAILURE; insertBreakpoint(fBreakpointsDmc, breakpoint); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); @@ -771,20 +733,18 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_InvalidFunctionName() throws Throwable { - + assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_6_8); // Create a function breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(FUNCTION_TAG, "invalid-function-name"); - // Perform the test String expected = BREAKPOINT_INSERTION_FAILURE; insertBreakpoint(fBreakpointsDmc, breakpoint); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); @@ -795,25 +755,21 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_InvalidAddress() throws Throwable { - // Create an address breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(ADDRESS_TAG, "0x0z"); - // Perform the test String expected = BREAKPOINT_INSERTION_FAILURE; insertBreakpoint(fBreakpointsDmc, breakpoint); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); } - // ------------------------------------------------------------------------ // insertBreakpoint_Address // Set a breakpoint on an address @@ -821,16 +777,13 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_Address() throws Throwable { - // Create an address breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); - final BigInteger ADDRESS= new BigInteger("00affe00", 16); - breakpoint.put(ADDRESS_TAG, "0x"+ADDRESS.toString(16)); - + final BigInteger ADDRESS = new BigInteger("00affe00", 16); + breakpoint.put(ADDRESS_TAG, "0x" + ADDRESS.toString(16)); // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -838,7 +791,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertEquals("BreakpointService problem: breakpoint mismatch (wrong address)", @@ -851,7 +803,6 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.isEnabled()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -868,17 +819,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_LineNumber() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -886,7 +834,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -901,7 +848,6 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.isEnabled()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -918,18 +864,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_Disabled() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(IS_ENABLED_TAG, false); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -937,7 +880,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -952,7 +894,6 @@ public class MIBreakpointsTest extends BaseTestCase { !breakpoint1.isEnabled()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -960,7 +901,7 @@ public class MIBreakpointsTest extends BaseTestCase { MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2)); - } + } // ------------------------------------------------------------------------ // insertBreakpoint_FunctionName @@ -969,17 +910,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_FunctionName() throws Throwable { - // Create a function breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(FUNCTION_TAG, FUNCTION); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -987,7 +925,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1000,7 +937,6 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -1017,18 +953,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_Condition() throws Throwable { - // Create a conditional line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(CONDITION_TAG, CONDITION_1); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1036,7 +969,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1049,7 +981,6 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -1059,25 +990,22 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.equals(breakpoint2)); } - // ------------------------------------------------------------------------ + // ------------------------------------------------------------------------ // insertBreakpoint_IgnoreCnt // Set a breakpoint with an ignore count. // Ensure that it is set correctly at the back-end. // ------------------------------------------------------------------------ @Test public void insertBreakpoint_IgnoreCnt() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(IGNORE_COUNT_TAG, IGNORE_COUNT_1); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1085,7 +1013,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1098,7 +1025,6 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.getIgnoreCount() == IGNORE_COUNT_1); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -1106,7 +1032,7 @@ public class MIBreakpointsTest extends BaseTestCase { MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertTrue("BreakpointService problem: breakpoint mismatch", breakpoint1.equals(breakpoint2)); - } + } // ------------------------------------------------------------------------ // insertBreakpoint_MultipleBreakpoints @@ -1115,17 +1041,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_MultipleBreakpoints() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1133,7 +1056,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1146,17 +1068,14 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Create a function breakpoint breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(FUNCTION_TAG, FUNCTION); - // Perform the test ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1164,7 +1083,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1177,14 +1095,12 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint2.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint2.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 2); MIBreakpointDMData svc_bp1 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]); - // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... int ref1 = breakpoint1.getNumber(); @@ -1205,17 +1121,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertBreakpoint_Duplicate() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1223,7 +1136,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1236,11 +1148,9 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint1.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); - // Create a second line breakpoint, same attributes... ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1248,7 +1158,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the breakpoint was correctly installed MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", @@ -1261,14 +1170,12 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint2.getIgnoreCount() == 0); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint2.isPending()); - // Ensure the BreakpointService holds only the right breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 2 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 2); MIBreakpointDMData svc_bp1 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); MIBreakpointDMData svc_bp2 = (MIBreakpointDMData) getBreakpoint(breakpoints[1]); - // The breakpoint references are not necessarily retrieved in the order the // breakpoints were initially set... int ref1 = breakpoint1.getNumber(); @@ -1295,28 +1202,23 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); - - // Run the program. It will make a two second sleep() call, during which time... + // Run the program. It will make a two second sleep() call, during which time... SyncUtil.resume(); - // ...we install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - - // Ensure the correct BreakpointEvent was received + // Ensure the correct BreakpointEvent was received MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -1327,13 +1229,12 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == ref.getReference()); } - + // ------------------------------------------------------------------------ // insertInvalidBreakpoint_WhileTargetRunning // Set an invalid breakpoint while the target is running, then set a valid @@ -1344,39 +1245,34 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertInvalidBreakpoint_WhileTargetRunning() throws Throwable { + assumeGdbVersionLowerThen(ITestConstants.SUFFIX_GDB_6_8); // Interrupting the target on Windows is susceptible to an additional, // unwanted suspension. That means that silently interrupting the target // to set/modify/remove a breakpoint then resuming it can leave the // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, "Bad file name"); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); - - // Run the program. It will make a two second sleep() call, during which time... + // Run the program. It will make a two second sleep() call, during which time... SyncUtil.resume(); - // ...we install the bad breakpoint and check that it failed insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), !fWait.isOK()); - // Now install a proper breakpoint an see that it hits without having to resume // the target. This will show that the target was still properly running. breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - - // Ensure the correct BreakpointEvent was received + // Ensure the correct BreakpointEvent was received MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -1387,13 +1283,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - assertTrue("Did not stop because of breakpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == ref.getReference()); } - /////////////////////////////////////////////////////////////////////////// // Add Watchpoint tests /////////////////////////////////////////////////////////////////////////// @@ -1405,17 +1299,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertWatchpoint_Write() throws Throwable { - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(WRITE_TAG, true); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1423,7 +1314,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the watchpoint was correctly installed MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: watchpoint mismatch (wrong expression)", @@ -1436,8 +1326,6 @@ public class MIBreakpointsTest extends BaseTestCase { !watchpoint1.isAccessWatchpoint()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); - - // Ensure the BreakpointService holds only the right watchpoints IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " @@ -1454,17 +1342,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertWatchpoint_Read() throws Throwable { - // Create a read watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(READ_TAG, true); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1472,7 +1357,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the watchpoint was correctly installed MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: watchpoint mismatch (wrong expression)", @@ -1485,7 +1369,6 @@ public class MIBreakpointsTest extends BaseTestCase { !watchpoint1.isAccessWatchpoint()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); - // Ensure the BreakpointService holds only the right watchpoints IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " @@ -1502,18 +1385,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void insertWatchpoint_Access() throws Throwable { - // Create an access watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(READ_TAG, true); watchpoint.put(WRITE_TAG, true); - // Perform the test IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1521,7 +1401,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure that the watchpoint was correctly installed MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: watchpoint mismatch (wrong expression)", @@ -1534,7 +1413,6 @@ public class MIBreakpointsTest extends BaseTestCase { watchpoint1.isAccessWatchpoint()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); - // Ensure the BreakpointService holds only the right watchpoints IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " @@ -1557,27 +1435,22 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_3); watchpoint.put(WRITE_TAG, true); - // Run the program SyncUtil.resume(); - // Install watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -1586,7 +1459,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - // Ensure that the watchpoint was correctly installed MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointService problem: watchpoint mismatch (wrong expression)", @@ -1599,7 +1471,6 @@ public class MIBreakpointsTest extends BaseTestCase { !watchpoint1.isAccessWatchpoint()); assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); - // Ensure the BreakpointService holds only the right watchpoints IBreakpointDMContext[] watchpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " watchpoints(s), received " @@ -1607,13 +1478,11 @@ public class MIBreakpointsTest extends BaseTestCase { MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(watchpoints[0]); assertTrue("BreakpointService problem: breakpoint mismatch", watchpoint1.equals(watchpoint2)); - assertTrue("Did not stop because of watchpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIWatchpointTriggerEvent); assertTrue("Did not stop because of the watchpoint", - ((MIWatchpointTriggerEvent)event).getNumber() == watchpoint1.getReference()); + ((MIWatchpointTriggerEvent) event).getNumber() == watchpoint1.getReference()); } - /////////////////////////////////////////////////////////////////////////// // Remove Breakpoint tests /////////////////////////////////////////////////////////////////////////// @@ -1625,17 +1494,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void removeBreakpoint_SimpleCase() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1643,11 +1509,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Remove the installed breakpoint removeBreakpoint(ref); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1655,7 +1519,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_REMOVED event(s), received " + getBreakpointEventCount(BP_REMOVED), getBreakpointEventCount(BP_REMOVED) == 1); clearEventCounters(); - // Ensure the breakpoint was effectively removed IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " @@ -1668,33 +1531,27 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void removeBreakpoint_InvalidBreakpoint() throws Throwable { - // Create an invalid breakpoint reference - IBreakpointDMContext invalid_ref = - new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, new IDMContext[] { fBreakpointsDmc }, 0); - + IBreakpointDMContext invalid_ref = new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, + new IDMContext[] { fBreakpointsDmc }, 0); // Remove the invalid breakpoint String expected = UNKNOWN_BREAKPOINT; removeBreakpoint(invalid_ref); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); IBreakpointDMContext saved_ref = ref; assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1702,16 +1559,13 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Ensure the breakpoint list is OK IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 1); - // Remove the installed breakpoint removeBreakpoint(ref); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1719,32 +1573,26 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_REMOVED event(s), received " + getBreakpointEventCount(BP_REMOVED), getBreakpointEventCount(BP_REMOVED) == 1); clearEventCounters(); - // Ensure the breakpoint list is OK breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 0); - // Remove the un-installed breakpoint removeBreakpoint(saved_ref); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); - // Ensure the breakpoint list is OK breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 0 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 0); - // Re-install the breakpoint ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1752,17 +1600,14 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Remove an un-installed breakpoint (again) removeBreakpoint(saved_ref); assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); - // Ensure that the existing breakpoint is unaffected breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " @@ -1779,7 +1624,6 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void removeBreakpoint_MixedCase() throws Throwable { - // Create a line breakpoint for (int i = 0; i < 4; i++) { Map breakpoint = new HashMap(); @@ -1788,34 +1632,29 @@ public class MIBreakpointsTest extends BaseTestCase { breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1 + i); insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received int expected = i + 1; waitForBreakpointEvent(expected); assertTrue("BreakpointEvent problem: expected " + expected + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == expected); + + fBreakpointEventCount, fBreakpointEventCount == expected); assertTrue("BreakpointEvent problem: expected " + expected + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == expected); } clearEventCounters(); - // Get the list of breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + 4 + " breakpoint(s), received " + breakpoints.length, breakpoints.length == 4); - // Remove the breakpoint one at a time in the following order: 1, 3, 2, 4 int[] indices = { 0, 2, 1, 3 }; int breakpoints_left = 4; for (int i = 0; i < breakpoints_left; i++) { - // Remove the selected breakpoint IBreakpointDMContext index = breakpoints[indices[i]]; removeBreakpoint(index); fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); assertTrue(fWait.getMessage(), fWait.isOK()); breakpoints_left--; - // Ensure that right BreakpointEvents were received int expected = i + 1; waitForBreakpointEvent(expected); @@ -1823,8 +1662,7 @@ public class MIBreakpointsTest extends BaseTestCase { + fBreakpointEventCount, fBreakpointEventCount == expected); assertTrue("BreakpointEvent problem: expected " + expected + " BREAKPOINT_REMOVED event(s), received " + getBreakpointEventCount(BP_REMOVED), getBreakpointEventCount(BP_REMOVED) == expected); - - // Ensure the breakpoint was effectively removed + // Ensure the breakpoint was effectively removed IBreakpointDMContext[] remaining_breakpoints = getBreakpoints(fBreakpointsDmc); assertTrue("BreakpointService problem: expected " + breakpoints_left + " breakpoint(s), received " + remaining_breakpoints.length, remaining_breakpoints.length == breakpoints_left); @@ -1849,51 +1687,41 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Install a second breakpoint breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_6); - // Install the breakpoint MIBreakpointDMContext ref1 = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Run the program SyncUtil.resume(); - // Remove the first breakpoint removeBreakpoint(ref); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(4); - // Ensure the correct BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 4 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 4); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == ref1.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == ref1.getReference()); } - /////////////////////////////////////////////////////////////////////////// // Breakpoint Update tests /////////////////////////////////////////////////////////////////////////// @@ -1905,11 +1733,9 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_InvalidBreakpoint() throws Throwable { - // Create an invalid breakpoint reference - IBreakpointDMContext invalid_ref = - new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, new IDMContext[] { fBreakpointsDmc }, 0); - + IBreakpointDMContext invalid_ref = new MIBreakpointDMContext((MIBreakpoints) fBreakpointService, + new IDMContext[] { fBreakpointsDmc }, 0); // Update the invalid breakpoint String expected = UNKNOWN_BREAKPOINT; Map properties = new HashMap(); @@ -1920,7 +1746,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertFalse(fWait.getMessage(), fWait.isOK()); assertTrue("Wrong error message: expected '" + expected + "', received '" + fWait.getMessage() + "'", fWait.getMessage().contains(expected)); - // Ensure that no BreakpointEvent was received assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 0); @@ -1933,17 +1758,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_AddCondition() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1951,13 +1773,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Modify the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_1); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1965,7 +1785,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -1979,18 +1798,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_RemoveCondition() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(CONDITION_TAG, CONDITION_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -1998,13 +1814,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Remove the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, null); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2012,7 +1826,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -2026,18 +1839,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_ModifyCondition() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(CONDITION_TAG, CONDITION_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2045,13 +1855,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Update the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2059,7 +1867,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -2079,21 +1886,18 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); breakpoint.put(CONDITION_TAG, CONDITION_4); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2101,21 +1905,17 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Prepare to update the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_5); - // Run the program SyncUtil.resume(); //Update the condition updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -2124,18 +1924,16 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", breakpoint2.getCondition().equals(CONDITION_5)); - assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == breakpoint2.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == breakpoint2.getReference()); } - + // ------------------------------------------------------------------------ // updateWatchpoint_AddCondition // Set a watchpoint and then add a condition. @@ -2145,17 +1943,14 @@ public class MIBreakpointsTest extends BaseTestCase { public void updateWatchpoint_AddCondition() throws Throwable { // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_1); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(WRITE_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2163,13 +1958,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_1); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2177,7 +1970,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the watchpoint MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -2193,18 +1985,15 @@ public class MIBreakpointsTest extends BaseTestCase { public void updateWatchpoint_RemoveCondition() throws Throwable { // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_1); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(WRITE_TAG, true); watchpoint.put(CONDITION_TAG, CONDITION_1); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2212,13 +2001,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Remove the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, null); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2226,7 +2013,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the watchpoint MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -2242,18 +2028,15 @@ public class MIBreakpointsTest extends BaseTestCase { public void updateWatchpoint_ModifyCondition() throws Throwable { // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_1); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(WRITE_TAG, true); watchpoint.put(CONDITION_TAG, CONDITION_1); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT events, received " @@ -2261,13 +2044,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event, received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Update the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2275,7 +2056,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData watchpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", @@ -2289,17 +2069,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_AddCount() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2307,13 +2084,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add a count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2321,7 +2096,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", @@ -2335,18 +2109,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_RemoveCount() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2354,13 +2125,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Remove the count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, null); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2368,7 +2137,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", @@ -2382,18 +2150,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_ModifyCount() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(IGNORE_COUNT_TAG, IGNORE_COUNT_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2401,13 +2166,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Update the count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2415,7 +2178,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", @@ -2435,21 +2197,18 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); breakpoint.put(IGNORE_COUNT_TAG, IGNORE_COUNT_1); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2457,22 +2216,17 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Prepare to update the count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, 0); - // Run the program SyncUtil.resume(); - //Update the count updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -2481,18 +2235,16 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - // Verify the state of the breakpoint MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong count)", breakpoint2.getIgnoreCount() == 0); - assertTrue("Did not stop on our modified breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == breakpoint2.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == breakpoint2.getReference()); } - + // ------------------------------------------------------------------------ // updateBreakpoint_Disable // Set 2 breakpoints and disable the first one. @@ -2500,27 +2252,22 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_Disable() throws Throwable { - // Create a first line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref1 = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Create a second line breakpoint breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_2); - // Install the breakpoint IBreakpointDMContext ref2 = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(2); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " @@ -2528,19 +2275,16 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2); clearEventCounters(); - // Verify the state of the breakpoints MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref1); MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref2); assertTrue("BreakpointService problem: breakpoint state error", breakpoint1.isEnabled() && breakpoint2.isEnabled()); - // Disable the first breakpoint Map delta = new HashMap(); delta.put(IS_ENABLED_TAG, false); updateBreakpoint(ref1, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2548,16 +2292,13 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoints breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref1); breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref2); assertTrue("BreakpointService problem: breakpoint state error", !breakpoint1.isEnabled() && breakpoint2.isEnabled()); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(1000); - // Ensure the BreakpointEvent was received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2582,46 +2323,37 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Install a second breakpoint breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_6); MIBreakpointDMContext ref1 = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(2); - assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2); clearEventCounters(); - // Prepare to disable the breakpoint Map delta = new HashMap(); delta.put(IS_ENABLED_TAG, false); - // Run the program SyncUtil.resume(); - // Disable the breakpoint updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " @@ -2629,13 +2361,12 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - assertTrue("Did not stop on a breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == ref1.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == ref1.getReference()); } - + // ------------------------------------------------------------------------ // updateBreakpoint_Enable // In a loop, set 2 breakpoints and disable the first one. After hitting @@ -2644,27 +2375,22 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void updateBreakpoint_Enable() throws Throwable { - // Create a first line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint IBreakpointDMContext ref1 = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Create a second line breakpoint breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_2); - // Install the breakpoint IBreakpointDMContext ref2 = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(2); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " @@ -2672,19 +2398,16 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 2); clearEventCounters(); - // Verify the state of the breakpoints MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref1); MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref2); assertTrue("BreakpointService problem: breakpoint state error", breakpoint1.isEnabled() && breakpoint2.isEnabled()); - // Disable the first breakpoint Map delta = new HashMap(); delta.put(IS_ENABLED_TAG, false); updateBreakpoint(ref1, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2692,16 +2415,13 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoints breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref1); breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref2); assertTrue("BreakpointService problem: breakpoint state error", !breakpoint1.isEnabled() && breakpoint2.isEnabled()); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(1000); - // Ensure the BreakpointEvent was received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2711,13 +2431,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch", fBreakpointRef == breakpoint2.getNumber()); clearEventCounters(); - // Enable the first breakpoint delta = new HashMap(); delta.put(IS_ENABLED_TAG, true); updateBreakpoint(ref1, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2725,16 +2443,13 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Verify the state of the breakpoints breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref1); breakpoint2 = (MIBreakpointDMData) getBreakpoint(ref2); assertTrue("BreakpointService problem: breakpoint state error", breakpoint1.isEnabled() && breakpoint2.isEnabled()); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(1000); - // Ensure the BreakpointEvent was received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2759,21 +2474,18 @@ public class MIBreakpointsTest extends BaseTestCase { // target in a suspended state. Unfortunately, there is nothing // practical CDT can do to address this issue except wait for the gdb // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - + if (runningOnWindows()) { + return; + } // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); breakpoint.put(IS_ENABLED_TAG, false); - // Install the breakpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2781,22 +2493,17 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Prepare to enable the breakpoint Map delta = new HashMap(); delta.put(IS_ENABLED_TAG, true); - // Run the program SyncUtil.resume(); - // Enable the breakpoint updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - // Ensure that right BreakpointEvents were received assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 2); @@ -2805,60 +2512,57 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); clearEventCounters(); - MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == breakpoint1.getReference()); + ((MIBreakpointHitEvent) event).getNumber() == breakpoint1.getReference()); } - private void queueConsoleCommand(final String command) throws Throwable { + private void queueConsoleCommand(final String command) throws Throwable { Query query = new Query() { @Override protected void execute(DataRequestMonitor rm) { fCommandControl.queueCommand( - fCommandControl.getCommandFactory().createMIInterpreterExecConsole( - fCommandControl.getContext(), - command), - rm); + fCommandControl.getCommandFactory().createMIInterpreterExecConsole( + fCommandControl.getContext(), + command), + rm); } }; fSession.getExecutor().execute(query); query.get(20000, TimeUnit.MILLISECONDS); - } + } - private void deleteAllPlatformBreakpoints() throws Exception { - IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager(); - for (IBreakpoint b : bm.getBreakpoints()) { - bm.removeBreakpoint(b, true); - } - } + private void deleteAllPlatformBreakpoints() throws Exception { + IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager(); + for (IBreakpoint b : bm.getBreakpoints()) { + bm.removeBreakpoint(b, true); + } + } // ------------------------------------------------------------------------ - // Bug 456959 + // Bug 456959 // updateBreakpoint_AfterRestart // Create a platform breakpoint and see that it gets hit. - // Then restart the execution, do some modification to the breakpoint - // to force an update, and verify it still hits. + // Then restart the execution, do some modification to the breakpoint + // to force an update, and verify it still hits. // ------------------------------------------------------------------------ @Test public void updateBreakpoint_AfterRestart() throws Throwable { - // Restart is not supported for a remote session - if (isRemoteSession()) { - Assert.assertFalse("Restart operation should not be allowed for a remote session", - SyncUtil.canRestart()); - return; - } - - try { + assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4); + // Restart is not supported for a remote session + if (isRemoteSession()) { + Assert.assertFalse("Restart operation should not be allowed for a remote session", + SyncUtil.canRestart()); + return; + } + try { // Create a line breakpoint in the platform. To do that, create a bp from // the gdb console and let CDT create the corresponding platform bp. queueConsoleCommand(String.format("break %s:%d", SOURCE_NAME, LINE_NUMBER_5)); - IBreakpointDMContext[] bps = getBreakpoints(fBreakpointsDmc); assertEquals(1, bps.length); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(2); assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " @@ -2868,57 +2572,47 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Run the program SyncUtil.resume(); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent); - MIBreakpointDMData bpData = (MIBreakpointDMData)getBreakpoint(bps[0]); + MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(bps[0]); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == bpData.getReference()); - + ((MIBreakpointHitEvent) event).getNumber() == bpData.getReference()); // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); - clearEventCounters(); - + clearEventCounters(); // Restart the program SyncUtil.restart(getGDBLaunch()); clearEventCounters();// Clear after restart to ignore the bp hit at main - bps = getBreakpoints(fBreakpointsDmc); assertEquals(1, bps.length); - IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager(); IBreakpoint[] breakpoints = bm.getBreakpoints(); assertEquals(1, breakpoints.length); breakpoints[0].getMarker().setAttribute(ICBreakpoint.CONDITION, "1==1"); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + fBreakpointEventCount, fBreakpointEventCount == 1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); - clearEventCounters(); - + clearEventCounters(); // Run the program SyncUtil.resume(); - - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred event = SyncUtil.waitForStop(3000); assertTrue("Did not stop on our enabled breakpoint!", event instanceof MIBreakpointHitEvent); bpData = (MIBreakpointDMData) getBreakpoint(bps[0]); assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, - ((MIBreakpointHitEvent)event).getNumber() == bpData.getReference()); - + ((MIBreakpointHitEvent) event).getNumber() == bpData.getReference()); // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2930,7 +2624,6 @@ public class MIBreakpointsTest extends BaseTestCase { deleteAllPlatformBreakpoints(); } } - /////////////////////////////////////////////////////////////////////////// // Breakpoint Hit tests /////////////////////////////////////////////////////////////////////////// @@ -2941,17 +2634,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_LineNumber() throws Throwable { - // Create a line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -2959,10 +2649,8 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(1000); - // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -2983,17 +2671,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_Function() throws Throwable { - // Create a function breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(FUNCTION_TAG, FUNCTION); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3001,10 +2686,8 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(1000); - // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3027,18 +2710,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_Condition() throws Throwable { - // Create a conditional line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(CONDITION_TAG, CONDITION_1); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3046,11 +2726,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(2000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3063,7 +2741,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128); @@ -3077,17 +2754,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_UpdatedCondition() throws Throwable { - // Create a conditional line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3095,13 +2769,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add the condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_1); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3109,11 +2781,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(2000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3126,7 +2796,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128); @@ -3140,18 +2809,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_Count() throws Throwable { - // Create a conditional line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); breakpoint.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3159,11 +2825,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3176,7 +2840,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); @@ -3190,17 +2853,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_UpdatedCount() throws Throwable { - // Create a conditional line breakpoint Map breakpoint = new HashMap(); breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - // Install the breakpoint MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3208,13 +2868,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add a count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3222,11 +2880,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3239,7 +2895,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !breakpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); @@ -3252,17 +2907,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_WriteWatchpoint() throws Throwable { - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(WRITE_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3270,11 +2922,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3287,7 +2937,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); @@ -3300,17 +2949,14 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_ReadWatchpoint() throws Throwable { - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(READ_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3318,11 +2964,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3335,7 +2979,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); @@ -3348,18 +2991,15 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_AccessWatchpoint() throws Throwable { - // Create an access watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_1); watchpoint.put(READ_TAG, true); watchpoint.put(WRITE_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3367,11 +3007,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3384,7 +3022,6 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int i = evaluateExpression(frameDmc, "i").intValue(); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); @@ -3399,17 +3036,14 @@ public class MIBreakpointsTest extends BaseTestCase { public void breakpointHit_watchpointUpdateCount() throws Throwable { // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_4); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_2); watchpoint.put(WRITE_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3417,13 +3051,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add a count Map delta = new HashMap(); delta.put(IGNORE_COUNT_TAG, IGNORE_COUNT_2); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3431,11 +3063,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(1000); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3448,11 +3078,10 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int j = evaluateExpression(frameDmc, EXPRESSION_2).intValue(); - assertTrue("Watchpoint problem: " + EXPRESSION_2 +" was " + j + " instead of " + IGNORE_COUNT_2, - j == IGNORE_COUNT_2); + assertTrue("Watchpoint problem: " + EXPRESSION_2 + " was " + j + " instead of " + IGNORE_COUNT_2, + j == IGNORE_COUNT_2); } // ------------------------------------------------------------------------ @@ -3462,19 +3091,19 @@ public class MIBreakpointsTest extends BaseTestCase { // ------------------------------------------------------------------------ @Test public void breakpointHit_watchpointUpdateCondition() throws Throwable { + Assume.assumeTrue("Skipped because gdb 6.8 does not support this feature", + !ITestConstants.SUFFIX_GDB_6_8.equals(getGdbVersion())); + // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_4); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); watchpoint.put(EXPRESSION_TAG, EXPRESSION_2); watchpoint.put(WRITE_TAG, true); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3482,13 +3111,11 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Add a condition Map delta = new HashMap(); delta.put(CONDITION_TAG, CONDITION_3); updateBreakpoint(ref, delta); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3496,11 +3123,9 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_UPDATED event(s), received " + getBreakpointEventCount(BP_UPDATED), getBreakpointEventCount(BP_UPDATED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated MIStoppedEvent stoppedEvent = SyncUtil.resumeUntilStopped(); - IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); - + IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0); // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3513,11 +3138,10 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Verify that the condition is met int j = evaluateExpression(frameDmc, EXPRESSION_2).intValue(); - assertTrue("Watchpoint problem: " + EXPRESSION_2 +" was " + j + " instead of " + 20, - j == 20); + assertTrue("Watchpoint problem: " + EXPRESSION_2 + " was " + j + " instead of " + 20, + j == 20); } // ------------------------------------------------------------------------ @@ -3530,7 +3154,6 @@ public class MIBreakpointsTest extends BaseTestCase { public void breakpointHit_WatchpointOutOfScope() throws Throwable { // Run to the point where the variable is initialized insertAndRunToLineBreakpoint(LINE_NUMBER_4); - // Create a write watchpoint Map watchpoint = new HashMap(); watchpoint.put(BREAKPOINT_TYPE_TAG, WATCHPOINT_TAG); @@ -3539,11 +3162,9 @@ public class MIBreakpointsTest extends BaseTestCase { watchpoint.put(WRITE_TAG, true); // Make sure watchpoint is not triggered by the expression actually changing watchpoint.put(IGNORE_COUNT_TAG, 1000); - // Install the watchpoint IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, watchpoint); assertTrue(fWait.getMessage(), fWait.isOK()); - // Ensure that right BreakpointEvents were received waitForBreakpointEvent(1); assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " @@ -3551,10 +3172,8 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); clearEventCounters(); - // Run until the breakpoint is hit and the event generated SyncUtil.resumeUntilStopped(); - // Ensure the correct BreakpointEvent was received waitForBreakpointEvent(1); MIBreakpointDMData watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); @@ -3567,11 +3186,183 @@ public class MIBreakpointsTest extends BaseTestCase { assertTrue("BreakpointService problem: breakpoint mismatch (pending)", !watchpoint1.isPending()); clearEventCounters(); - // Ensure the watchpoint is gone getBreakpoints(fBreakpointsDmc); watchpoint1 = (MIBreakpointDMData) getBreakpoint(ref); assertTrue("BreakpointEvent problem: expected watchpoint to be deleted after going out of scope", watchpoint1 == null); } + + /* + * Starting with GDB 7.4, breakpoints at invalid lines succeed and become + * pending breakpoints. This is because the invalid line for one file, + * may be valid for another file with the same name. + * One could argue that line 0 is an exception, but GDB does not make + * a difference. + * @see org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest#insertBreakpoint_InvalidLineNumber() + */ + @Test + public void insertBreakpoint_InvalidLineNumberPending() throws Throwable { + assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_4); + // Create a line breakpoint + Map breakpoint = new HashMap(); + breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); + breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); + breakpoint.put(LINE_NUMBER_TAG, 0); + + // Perform the test + IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); + assertTrue(fWait.getMessage(), fWait.isOK()); + + // Ensure that no BreakpointEvent was received + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + + fBreakpointEventCount, fBreakpointEventCount == 1); + + MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(ref); + assertTrue("Breakpoint should be pending", bpData.isPending()); + assertTrue("Breakpoint mismatch should be enabled", bpData.isEnabled()); + } + + /** + * Starting with GDB 6.8, we request failed breakpoints to be pending in + * GDB. So we no longer get an installation error from GDB. + */ + @Test + public void insertBreakpoint_InvalidFileNamePending() throws Throwable { + assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8); + // Create an invalid line breakpoint + Map breakpoint = new HashMap(); + breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); + breakpoint.put(FILE_NAME_TAG, SOURCE_NAME + "_bad"); + breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); + + // Perform the test, which we still expect to succeed + // giving us a pending breakpoint + IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); + assertTrue(fWait.getMessage(), fWait.isOK()); + + // Ensure that right BreakpointEvents were received + waitForBreakpointEvent(1); + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + + fBreakpointEventCount, fBreakpointEventCount == 1); + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); + clearEventCounters(); + + // Ensure that the breakpoint was correctly installed + MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", + breakpoint1.getFileName().equals("")); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong line number)", + breakpoint1.getLineNumber() == -1); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)", + breakpoint1.getCondition().equals(NO_CONDITION)); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)", + breakpoint1.getIgnoreCount() == 0); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)", + breakpoint1.isEnabled()); + assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", + breakpoint1.isPending()); + + // Ensure the BreakpointService holds only the right breakpoints + IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); + assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + + breakpoints.length, breakpoints.length == 1); + MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); + assertTrue("BreakpointService problem: breakpoint mismatch", + breakpoint1.equals(breakpoint2)); + } + + /** + * Starting with GDB 6.8, we request failed breakpoints to be pending in + * GDB. So we no longer get an installation error from GDB. + */ + + @Test + public void insertBreakpoint_InvalidFunctionNamePending() throws Throwable { + assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8); + // Create an invalid function breakpoint + Map breakpoint = new HashMap(); + breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); + breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); + breakpoint.put(FUNCTION_TAG, "invalid-function-name"); + + // Perform the test, which we still expect to succeed + // giving us a pending breakpoint + IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); + assertTrue(fWait.getMessage(), fWait.isOK()); + + // Ensure that right BreakpointEvents were received + waitForBreakpointEvent(1); + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + + fBreakpointEventCount, fBreakpointEventCount == 1); + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " + + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); + clearEventCounters(); + + // Ensure that the breakpoint was correctly installed + MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", + breakpoint1.getFileName().equals("")); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong function)", + breakpoint1.getFunctionName().equals("")); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)", + breakpoint1.getCondition().equals(NO_CONDITION)); + assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)", + breakpoint1.getIgnoreCount() == 0); + assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", + breakpoint1.isPending()); + + // Ensure the BreakpointService holds only the right breakpoints + IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); + assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " + + breakpoints.length, breakpoints.length == 1); + MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); + assertTrue("BreakpointService problem: breakpoint mismatch", + breakpoint1.equals(breakpoint2)); + } + + /** + * Starting with GDB 6.8, we request failed breakpoints to be pending in + * GDB. So we no longer get an installation error from GDB. + */ + @Test + public void insertInvalidBreakpoint_WhileTargetRunningPending() throws Throwable { + assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_6_8); + // Interrupting the target on Windows is susceptible to an additional, + // unwanted suspension. That means that silently interrupting the target + // to set/modify/remove a breakpoint then resuming it can leave the + // target in a suspended state. Unfortunately, there is nothing + // practical CDT can do to address this issue except wait for the gdb + // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 + if (runningOnWindows()) { + return; + } + + // Create an invalid line breakpoint + Map breakpoint = new HashMap(); + breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); + breakpoint.put(FILE_NAME_TAG, "Bad file name"); + breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); + + // Run the program. It will make a two second sleep() call, during which time... + SyncUtil.resume(); + + // ...we install the breakpoint + MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); + assertTrue(fWait.getMessage(), fWait.isOK()); + + waitForBreakpointEvent(1); + // Ensure the correct BreakpointEvent was received + MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); + assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " + + fBreakpointEventCount, fBreakpointEventCount == 1); + assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT_HIT event(s), received " + + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 0); + assertTrue("BreakpointService problem: breakpoint mismatch", + fBreakpointRef == breakpoint1.getNumber()); + assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", + breakpoint1.isPending()); + clearEventCounters(); + } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java index 7a624a7fb82..3c9c1c91d3b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Ericsson - Initial Implementation * Simon Marchi (Ericsson) - Add and use runningOnWindows(). @@ -58,38 +58,38 @@ import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants; import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints; import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor; -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; /** * This is the test suite for the catchpoint support in DSF-GDB. - * + * * It is meant to be a regression suite to be executed automatically against the * DSF nightly builds. - * + * * It is also meant to be augmented with a proper test case(s) every time a * feature is added or in the event (unlikely :-) that a bug is found in the * Breakpoint Service. - * + * * Refer to the JUnit4 documentation for an explanation of the annotations. - * + * */ -@RunWith(BackgroundRunner.class) -public class MICatchpointsTest extends BaseTestCase { +@RunWith(Parameterized.class) +public class MICatchpointsTest extends BaseParametrizedTestCase { private static final String EXEC_NAME = "CatchpointTestApp.exe"; //$NON-NLS-1$ private static final String SOURCE_NAME = "CatchpointTestApp.cc"; //$NON-NLS-1$ - + public static final int LINE_NUMBER_SLEEP_CALL = 17; // Asynchronous Completion private final AsyncCompletionWaitor fWait = new AsyncCompletionWaitor(); - + // Services references private DsfSession fSession; private IBreakpointsTargetDMContext fBreakpointsDmc; @@ -97,7 +97,7 @@ public class MICatchpointsTest extends BaseTestCase { private MIRunControl fRunControl; private IBreakpoints fBreakpointService; private IExpressions fExpressionService; - + // Event Management private static Boolean fEventHandlerLock = true; private enum Events { BP_ADDED, BP_UPDATED, BP_REMOVED, BP_HIT } @@ -105,10 +105,10 @@ public class MICatchpointsTest extends BaseTestCase { private final int BP_UPDATED = Events.BP_UPDATED.ordinal(); private final int BP_REMOVED = Events.BP_REMOVED.ordinal(); private final int BP_HIT = Events.BP_HIT.ordinal(); - - /** number of times a breakpoint event was received, broken down by event type */ + + /** number of times a breakpoint event was received, broken down by event type */ private int[] fBreakpointEvents = new int[Events.values().length]; - + /** total number of breakpoint events received */ private int totalBreakpointEventsCount() { synchronized (fEventHandlerLock) { @@ -119,8 +119,8 @@ public class MICatchpointsTest extends BaseTestCase { return total; } } - - + + /** * The gdb breakpoint number associated with the most recent breakpoint event */ @@ -139,7 +139,7 @@ public class MICatchpointsTest extends BaseTestCase { // Error messages private final String UNKNOWN_EXECUTION_CONTEXT = "Unknown execution context"; private final String UNKNOWN_BREAKPOINT = "Unknown breakpoint"; - + // ======================================================================== // Housekeeping stuff // ======================================================================== @@ -155,7 +155,7 @@ public class MICatchpointsTest extends BaseTestCase { public void run() { fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); assertNotNull(fServicesTracker); - + fRunControl = fServicesTracker.getService(MIRunControl.class); assertNotNull(fRunControl); @@ -173,7 +173,7 @@ public class MICatchpointsTest extends BaseTestCase { } }; fSession.getExecutor().submit(runnable).get(); - + IContainerDMContext containerDmc = SyncUtil.getContainerContext(); fBreakpointsDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class); assertNotNull(fBreakpointsDmc); @@ -182,31 +182,31 @@ public class MICatchpointsTest extends BaseTestCase { @Override protected void setLaunchAttributes() { super.setLaunchAttributes(); - + // Select the binary to run the tests against setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME); } - + @Override public void doAfterTest() throws Exception { super.doAfterTest(); - - Runnable runnable = new Runnable() { - @Override - public void run() { - fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this); - } - }; - fSession.getExecutor().submit(runnable).get(); - + if (fSession != null) { + Runnable runnable = new Runnable() { + @Override + public void run() { + fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this); + } + }; + fSession.getExecutor().submit(runnable).get(); + } // Clear the references (not strictly necessary) - fBreakpointService = null; - fRunControl = null; - fServicesTracker.dispose(); - fServicesTracker = null; - - clearEventCounters(); - } + fBreakpointService = null; + fRunControl = null; + if (fServicesTracker != null) + fServicesTracker.dispose(); + fServicesTracker = null; + clearEventCounters(); + } // ======================================================================== // Event Management Functions @@ -282,7 +282,7 @@ public class MICatchpointsTest extends BaseTestCase { * Suspends the calling thread until [count] number of breakpoint events * have been received in the current test. NOTE: too simple for real life * but good enough for this test suite - * + * * @param count * the number breakpoint events to wait for * @param timeout @@ -305,7 +305,7 @@ public class MICatchpointsTest extends BaseTestCase { } } } - + /** * Simplified variant that just waits up to two seconds */ @@ -598,7 +598,7 @@ public class MICatchpointsTest extends BaseTestCase { fWait.getMessage().contains(expected)); // Ensure that no breakpoint events were received - assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount()); + assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount()); } // Long story. There's really no way for the user to set a disabled @@ -613,7 +613,7 @@ public class MICatchpointsTest extends BaseTestCase { // disabled breakpoint. When we do, this test will become relevant. // @Test // public void insertCatchpoint_Disabled() throws Throwable { -// // Create a catchpoint +// // Create a catchpoint // Map breakpoint = new HashMap(); // breakpoint.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT); // breakpoint.put(MIBreakpoints.CATCHPOINT_TYPE, "throw"); @@ -743,7 +743,7 @@ public class MICatchpointsTest extends BaseTestCase { } /** - * Set a catchpoint while the target is running and ensure it gets hit. + * Set a catchpoint while the target is running and ensure it gets hit. */ @Test public void insertCatchpoint_WhileTargetRunning() throws Throwable { @@ -756,10 +756,10 @@ public class MICatchpointsTest extends BaseTestCase { if (runningOnWindows()) { return; } - - // Run the program. It will make a two second sleep() call, during which time... + + // Run the program. It will make a two second sleep() call, during which time... SyncUtil.resume(); - + // Set a throw catchpoint; don't use the utility method since it assumes // the target is running Map bkptsProps = new HashMap(); @@ -767,21 +767,21 @@ public class MICatchpointsTest extends BaseTestCase { bkptsProps.put(MIBreakpoints.CATCHPOINT_TYPE, "throw"); insertBreakpoint(fBreakpointsDmc, bkptsProps); assertTrue(fWait.getMessage(), fWait.isOK()); - + // After the sleep, the test app throws a C++ exception. Wait for the // catchpoint to hit and for the expected number of breakpoint events to // have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); - + // Ensure that right breakpoint events were received. One indicating the // catchpoint was created, another indicating it was hit waitForBreakpointEvent(1); assertEquals("Unexpected number of breakpoint events", 2, totalBreakpointEventsCount()); assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_ADDED)); - assertEquals("Unexpected number of breakpoint-hit events", 1, getBreakpointEventCount(BP_HIT)); + assertEquals("Unexpected number of breakpoint-hit events", 1, getBreakpointEventCount(BP_HIT)); clearEventCounters(); - + assertTrue("Did not stop because of catchpoint, but stopped because of: " + event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); } @@ -822,7 +822,7 @@ public class MICatchpointsTest extends BaseTestCase { public void removeCatchpoint_InvalidBreakpoint() throws Throwable { // set a catchpoint IBreakpointDMContext bkptRef1 = setCatchpoint("throw", null, null); - + // Remove the installed breakpoint clearEventCounters(); removeBreakpoint(bkptRef1); @@ -834,7 +834,7 @@ public class MICatchpointsTest extends BaseTestCase { assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_REMOVED)); clearEventCounters(); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 0, breakpoints.length); @@ -848,7 +848,7 @@ public class MICatchpointsTest extends BaseTestCase { // Ensure no breakpoint events were received assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount()); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 0, breakpoints.length); @@ -870,7 +870,7 @@ public class MICatchpointsTest extends BaseTestCase { assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt2_set = (MIBreakpointDMData) getBreakpoint(bkptRef2); MIBreakpointDMData bkpt2_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); - assertEquals(bkpt2_set.getNumber(), bkpt2_svc.getNumber()); + assertEquals(bkpt2_set.getNumber(), bkpt2_svc.getNumber()); } /** @@ -889,14 +889,14 @@ public class MICatchpointsTest extends BaseTestCase { // Get the list of breakpoints IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); - assertEquals("Breakpoint service reports unexpected number of breakpoints", events.length, breakpoints.length); + assertEquals("Breakpoint service reports unexpected number of breakpoints", events.length, breakpoints.length); // Remove the catchpoints one at a time but in an order different than how they were added int[] whichOne = { 0, 2, 1, 3 }; int breakpoints_left = 4; for (int i = 0; i < whichOne.length; i++) { clearEventCounters(); - + // Remove one of the catchpoints IBreakpointDMContext removeThisBreakpoint = breakpoints[whichOne[i]]; removeBreakpoint(removeThisBreakpoint); @@ -907,8 +907,8 @@ public class MICatchpointsTest extends BaseTestCase { waitForBreakpointEvent(1); assertEquals("Unexpected number of breakpoint events", 1, totalBreakpointEventsCount()); assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_REMOVED)); - - // Ensure the breakpoint service sees what we expect + + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] remaining_breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", --breakpoints_left, remaining_breakpoints.length); for (int j = 0; j < breakpoints_left; j++) { @@ -953,20 +953,20 @@ public class MICatchpointsTest extends BaseTestCase { if (runningOnWindows()) { return; } - + // Set a line breakpoint at the sleep() call. We need to get the program // past the initial loop that throws and catches C++ exceptions. IBreakpointDMContext refLineBkpt = setLineBreakpoint(LINE_NUMBER_SLEEP_CALL); // Run to the breakpoint resumeAndExpectBkptHit(((MIBreakpointDMData) getBreakpoint(refLineBkpt)).getNumber(), null); - + // Set the two catchpoints IBreakpointDMContext refThrow = setCatchpoint("throw", null, null); IBreakpointDMContext refCatch = setCatchpoint("catch", null, null); // Run the program. It will make a two second sleep() call, during which time... - clearEventCounters(); + clearEventCounters(); SyncUtil.resume(); // ...we remove one of the catchpoints @@ -980,10 +980,10 @@ public class MICatchpointsTest extends BaseTestCase { MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(), event instanceof MIBreakpointHitEvent); - MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event; + MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event; MIBreakpointDMData bkptNotRemoved = (MIBreakpointDMData) getBreakpoint(removeThrow ? refCatch : refThrow); assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptNotRemoved.getNumber(), bkptHitEvent.getNumber()); - + // If we removed the catch exception, we don't know at this point that // it won't get hit; we're stopped at the throw catchpoint. So resume // the target and make sure it doesn't get hit. @@ -991,10 +991,10 @@ public class MICatchpointsTest extends BaseTestCase { clearEventCounters(); SyncUtil.resume(); Thread.sleep(1000); // give the program a second to run to completion - assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount()); + assertEquals("Unexpected number of breakpoint events", 0, totalBreakpointEventsCount()); } } - + /////////////////////////////////////////////////////////////////////////// // Catchpoint Update tests /////////////////////////////////////////////////////////////////////////// @@ -1007,19 +1007,19 @@ public class MICatchpointsTest extends BaseTestCase { public void updateCatchpoint_AddCondition() throws Throwable { // Set a catchpoint with no condition IBreakpointDMContext ref = setCatchpoint("throw", null, null); - - // Update the catchpoint to have a condition - modifyBkptProperty(ref, MIBreakpoints.CONDITION, CONDITION_1); - // Ensure the breakpoint service sees what we expect + // Update the catchpoint to have a condition + modifyBkptProperty(ref, MIBreakpoints.CONDITION, CONDITION_1); + + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertEquals("Incorrect breakpoint condition", CONDITION_1, bkpt_svc.getCondition()); - + resumeAndExpectBkptHit(bkpt_svc.getNumber(), 2); } - + /** * Add a catchpoint with a condition then remove the condition */ @@ -1027,16 +1027,16 @@ public class MICatchpointsTest extends BaseTestCase { public void updateCatchpoint_RemoveCondition() throws Throwable { // Set a catchpoint with a condition IBreakpointDMContext ref = setCatchpoint("throw", CONDITION_1, null); - + // Remove the condition modifyBkptProperty(ref, MIBreakpoints.CONDITION, null); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertEquals("Incorrect breakpoint condition", CONDITION_NONE, bkpt_svc.getCondition()); - + resumeAndExpectBkptHit(bkpt_svc.getNumber(), 0); } @@ -1051,7 +1051,7 @@ public class MICatchpointsTest extends BaseTestCase { // Modify the catchpoint to have a different condition modifyBkptProperty(ref, MIBreakpoints.CONDITION, CONDITION_2); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); @@ -1066,7 +1066,7 @@ public class MICatchpointsTest extends BaseTestCase { * through the loop that throws and catches C++ exceptions and then enter a * sleep call. During the sleep call, Then remove the throw catchpoint while * the target is running and ensure the catch catchpoint is hit. - * + * */ @Test public void updateCatchpoint_WhileTargetRunning1() throws Throwable { @@ -1093,7 +1093,7 @@ public class MICatchpointsTest extends BaseTestCase { * to something that will resolve to true. After the sleep, the program does * one more round of throwing and catching. Ensure that the target stops and * that it's because of the catchpoint we updated. - * + * * @param removeThrow * if true, we update the throw catchpoint, otherwise the catch * one. @@ -1108,8 +1108,8 @@ public class MICatchpointsTest extends BaseTestCase { if (runningOnWindows()) { return; } - - // Set a line breakpoint at the sleep() call. + + // Set a line breakpoint at the sleep() call. IBreakpointDMContext refLineBkpt = setLineBreakpoint(LINE_NUMBER_SLEEP_CALL); // Set the two catchpoints @@ -1126,20 +1126,20 @@ public class MICatchpointsTest extends BaseTestCase { MIBreakpointDMData lineBkpt = (MIBreakpointDMData) getBreakpoint(refLineBkpt); assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", lineBkpt.getNumber(), fBreakpointRef); clearEventCounters(); - + // Resume the program. It will make a one second sleep() call, during which time... SyncUtil.resume(); - + // ...we modify one of the catchpoints's condition modifyBkptProperty(modifyThrow ? refThrow : refCatch, MIBreakpoints.CONDITION, CONDITION_ALWAYS_MET); // After the sleep, the test app throws a C++ exception and catches it. // So, the catchpoint whose condition we modified should get hit - // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred + // Wait for breakpoint to hit and for the expected number of breakpoint events to have occurred MIStoppedEvent event = SyncUtil.waitForStop(3000); waitForBreakpointEvent(2); assertTrue("stopped event is of an unexpected type: " + event.getClass().getName(), event instanceof MIBreakpointHitEvent); - MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event; + MIBreakpointHitEvent bkptHitEvent = (MIBreakpointHitEvent)event; MIBreakpointDMData bkptUpdated = (MIBreakpointDMData) getBreakpoint(modifyThrow ? refThrow : refCatch); assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptUpdated.getNumber(), bkptHitEvent.getNumber()); } @@ -1152,12 +1152,12 @@ public class MICatchpointsTest extends BaseTestCase { // Modify the catchpoint to have a different condition modifyBkptProperty(ref, MIBreakpoints.IGNORE_COUNT, 3); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertEquals("Incorrect breakpoint condition", 3, bkpt_svc.getIgnoreCount()); - + // Resume and validate catchpoint hit resumeAndExpectBkptHit(bkpt_svc.getNumber(), 3); } @@ -1172,13 +1172,13 @@ public class MICatchpointsTest extends BaseTestCase { // Modify the catchpoint to not have an ignore count modifyBkptProperty(ref, MIBreakpoints.IGNORE_COUNT, null); - - // Ensure the breakpoint service sees what we expect + + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); assertEquals("Incorrect breakpoint ignore count", 0, bkpt_svc.getIgnoreCount()); - + // Resume and validate catchpoint hit resumeAndExpectBkptHit(bkpt_svc.getNumber(), 0); } @@ -1195,7 +1195,7 @@ public class MICatchpointsTest extends BaseTestCase { // Modify the catchpoint to have a different ignore count modifyBkptProperty(ref, MIBreakpoints.IGNORE_COUNT, 5); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 1, breakpoints.length); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); @@ -1215,11 +1215,11 @@ public class MICatchpointsTest extends BaseTestCase { // Set the catchpoints IBreakpointDMContext refThrow = setCatchpoint("throw", null, null); IBreakpointDMContext refCatch = setCatchpoint("catch", null, null); - + // Disable the throw catchpoint modifyBkptProperty(refThrow, MIBreakpoints.IS_ENABLED, false); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 2, breakpoints.length); int throwCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refThrow)).getNumber(); @@ -1231,11 +1231,11 @@ public class MICatchpointsTest extends BaseTestCase { // Resume the target. Should miss the throw catchpoint and stop at the catch one int catchCatchpointNumber = ((MIBreakpointDMData)getBreakpoint(refCatch)).getNumber(); resumeAndExpectBkptHit(catchCatchpointNumber, null); - + // Ee-enable the throw catchpoint modifyBkptProperty(refThrow, MIBreakpoints.IS_ENABLED, true); - // Ensure the breakpoint service sees what we expect + // Ensure the breakpoint service sees what we expect breakpoints = getBreakpoints(fBreakpointsDmc); assertEquals("Breakpoints service reports unexpected number of breakpoints", 2, breakpoints.length); for (IBreakpointDMContext bkpt : breakpoints) { @@ -1263,7 +1263,7 @@ public class MICatchpointsTest extends BaseTestCase { /** * Set a line breakpoint and validate it was set correctly. - * + * * @param lineNumber * the line where to set the breakpoint * @return the breakpoint context @@ -1272,7 +1272,7 @@ public class MICatchpointsTest extends BaseTestCase { clearEventCounters(); IBreakpointDMContext[] bkptsBefore = getBreakpoints(fBreakpointsDmc); - + // Set the breakpoint Map breakpoint = new HashMap(); breakpoint.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT); @@ -1289,7 +1289,7 @@ public class MICatchpointsTest extends BaseTestCase { // Ensure the breakpoint service sees what we expect List bkptsAfter = new LinkedList(Arrays.asList(getBreakpoints(fBreakpointsDmc))); assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1, bkptsAfter.size()); - + ListIterator iter = bkptsAfter.listIterator(); while (iter.hasNext()) { IBreakpointDMContext bkptAfter = iter.next(); @@ -1309,7 +1309,7 @@ public class MICatchpointsTest extends BaseTestCase { /** * Set a catchpoint for the given event and validate it was set correctly - * + * * @param event * the event; the gdb keyword for it (e.g., "catch", "throw") * @param condition @@ -1322,7 +1322,7 @@ public class MICatchpointsTest extends BaseTestCase { clearEventCounters(); IBreakpointDMContext[] bkptsBefore = getBreakpoints(fBreakpointsDmc); - + // set the catchpoint Map bkptsProps = new HashMap(); bkptsProps.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT); @@ -1335,7 +1335,7 @@ public class MICatchpointsTest extends BaseTestCase { } IBreakpointDMContext refCatchpoint = insertBreakpoint(fBreakpointsDmc, bkptsProps); assertTrue(fWait.getMessage(), fWait.isOK()); - + // Ensure that right breakpoint events were received. waitForBreakpointEvent(1); assertEquals("Unexpected number of breakpoint events", 1, totalBreakpointEventsCount()); @@ -1359,11 +1359,11 @@ public class MICatchpointsTest extends BaseTestCase { } } assertEquals("All but the new bkpt should have been removed from bkptsAfter", bkptsAfter.size(), 1); - + MIBreakpointDMData bkpt_set = (MIBreakpointDMData) getBreakpoint(refCatchpoint); MIBreakpointDMData bkpt_svc = (MIBreakpointDMData) getBreakpoint(bkptsAfter.get(0)); - - assertEquals(bkpt_set.getNumber(), bkpt_svc.getNumber()); + + assertEquals(bkpt_set.getNumber(), bkpt_svc.getNumber()); assertEquals("Incorrect breakpoint condition", condition != null ? condition : CONDITION_NONE, bkpt_svc.getCondition()); assertEquals("Incorrect breakpoint ignore count", ignoreCount != null ? ignoreCount : 0, bkpt_svc.getIgnoreCount()); @@ -1374,7 +1374,7 @@ public class MICatchpointsTest extends BaseTestCase { * Resume the target and expect it to be stopped by the given breakpoint. * Optionally, check that the program's single global int variable has the * given value. - * + * * @param bkptNumber * the GDB breakpoint number * @param expectedVarValue @@ -1383,7 +1383,7 @@ public class MICatchpointsTest extends BaseTestCase { * @return the stoppped event */ private MIStoppedEvent resumeAndExpectBkptHit(int bkptNumber, Integer expectedVarValue) throws Throwable { - // Resume the target. The throw catchpoint should get hit. + // Resume the target. The throw catchpoint should get hit. clearEventCounters(); MIStoppedEvent event = SyncUtil.resumeUntilStopped(); @@ -1391,10 +1391,10 @@ public class MICatchpointsTest extends BaseTestCase { waitForBreakpointEvent(1); assertEquals("Unexpected number of breakpoint events", 1, totalBreakpointEventsCount()); assertEquals("Unexpected type of breakpoint event", 1, getBreakpointEventCount(BP_HIT)); - + // Ensure the target stopped because of the throw catchpoint assertEquals("Target stopped as expected, but the responsible breakpoint was not the expected one", bkptNumber, fBreakpointRef); - + if (expectedVarValue != null) { IFrameDMContext frameDmc = SyncUtil.getStackFrame(event.getDMContext(), 0); assertEquals("program variable has unexpected value", expectedVarValue.intValue(), evaluateExpression(frameDmc, CONDITION_VAR).intValue()); @@ -1413,11 +1413,11 @@ public class MICatchpointsTest extends BaseTestCase { bkptProps.put(property, value); updateBreakpoint(bkptRef, bkptProps); assertTrue(fWait.getMessage(), fWait.isOK()); - + // Ensure that right breakpoint events were received waitForBreakpointEvent(1); assertEquals("Unexpected number of breakpoint events", 1, totalBreakpointEventsCount()); assertEquals("Unexpected number of breakpoint added events", 1, getBreakpointEventCount(BP_UPDATED)); } - + } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java new file mode 100644 index 00000000000..d1ca3a85347 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/SuiteGdb.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2016 QNX Software System and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Elena Laskavaia (QNX Software System) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests; + +import org.eclipse.cdt.tests.dsf.gdb.framework.BaseParametrizedTestCase; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.CommandTimeoutTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.GDBConsoleBreakpointsTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.GDBConsoleSynchronizingTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.GDBMultiNonStopRunControlTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.GDBPatternMatchingExpressionsTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.GDBProcessesTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.LaunchConfigurationAndRestartTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MICatchpointsTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIDisassemblyTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIExpressionsNonStopTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIExpressionsTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIMemoryTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIRegistersTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIRunControlNonStopTargetAvailableTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIRunControlTargetAvailableTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.MIRunControlTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.OperationsWhileTargetIsRunningNonStopTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.OperationsWhileTargetIsRunningTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.PostMortemCoreTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.SourceLookupTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.StepIntoSelectionNonStopTest_7_11; +import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11.StepIntoSelectionTest_7_11; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * This suite is for tests to be run with GDB. + * + * If you running this from IDE use java var to control version like this -Dcdt.tests.dsf.gdb.versions=gdb.7.7,gdbserver.7.7 + * If you don't it will run default gdb (without version postfix) for new tests. It will run 7.11 for all non-converted tests. + * + * If you adding a new test class do not use gdb version naming. Use flat version extending BaseParametrizedTestCase, + * see {@link MIBreakpointsTest} + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + // temporary we still use hardcoded gdb version name, we will slowly flatten them + MIRegistersTest_7_11.class, + MIRunControlTest_7_11.class, + MIRunControlTargetAvailableTest_7_11.class, + MIRunControlNonStopTargetAvailableTest_7_11.class, + MIExpressionsTest_7_11.class, + MIExpressionsNonStopTest_7_11.class, + GDBPatternMatchingExpressionsTest_7_11.class, + MIMemoryTest_7_11.class, + MIBreakpointsTest.class, // this is flat version + MICatchpointsTest_7_11.class, + MIDisassemblyTest_7_11.class, + GDBProcessesTest_7_11.class, + LaunchConfigurationAndRestartTest_7_11.class, + OperationsWhileTargetIsRunningTest_7_11.class, + OperationsWhileTargetIsRunningNonStopTest_7_11.class, + PostMortemCoreTest_7_11.class, + CommandTimeoutTest_7_11.class, + GDBMultiNonStopRunControlTest_7_11.class, + GDBConsoleBreakpointsTest_7_11.class, + GDBConsoleSynchronizingTest_7_11.class, + StepIntoSelectionTest_7_11.class, + StepIntoSelectionNonStopTest_7_11.class, + SourceLookupTest_7_11.class, + /* Add your test class here */ +}) +public class SuiteGdb { + @BeforeClass + public static void before() { + // If we running this suite we have to clean up global options since + // each test will set local version of these properly. + // If our tests are running from other suites they + // may have globals that will override local values. + BaseParametrizedTestCase.resetGlobalState(); + } +} \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/MIBreakpointsTest_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/MIBreakpointsTest_6_6.java deleted file mode 100644 index eb7371e8682..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/MIBreakpointsTest_6_6.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2015 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_6_6 extends MIBreakpointsTest { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_6); - } - - // Currently, this test uses breakpoint synchronization with - // the gdb console which is only available with GDB 7.4 - // So we mark it with @Ignore - @Override - @Ignore - @Test - public void updateBreakpoint_AfterRestart() throws Throwable { - super.updateBreakpoint_AfterRestart(); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java index 06523051c1c..0f350e26146 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -36,7 +37,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_6.class, GDBPatternMatchingExpressionsTest_6_6.class, MIMemoryTest_6_6.class, - MIBreakpointsTest_6_6.class, + MIBreakpointsTest.class, MICatchpointsTest_6_6.class, MIDisassemblyTest_6_6.class, GDBProcessesTest_6_6.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java index d0dc9d68bc7..fe19f6060bb 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -37,7 +38,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_6.class, GDBPatternMatchingExpressionsTest_6_6.class, MIMemoryTest_6_6.class, - MIBreakpointsTest_6_6.class, + MIBreakpointsTest.class, MICatchpointsTest_6_6.class, MIDisassemblyTest_6_6.class, GDBProcessesTest_6_6.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/MIBreakpointsTest_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/MIBreakpointsTest_6_7.java deleted file mode 100644 index 50115488d90..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/MIBreakpointsTest_6_7.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6.MIBreakpointsTest_6_6; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_6_7 extends MIBreakpointsTest_6_6 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_7); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java index 1acb27ac872..c24807d9d20 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -36,7 +37,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_7.class, GDBPatternMatchingExpressionsTest_6_7.class, MIMemoryTest_6_7.class, - MIBreakpointsTest_6_7.class, + MIBreakpointsTest.class, MICatchpointsTest_6_7.class, MIDisassemblyTest_6_7.class, GDBProcessesTest_6_7.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java index 920297abd32..f0fbf65dff5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -37,7 +38,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_7.class, GDBPatternMatchingExpressionsTest_6_7.class, MIMemoryTest_6_7.class, - MIBreakpointsTest_6_7.class, + MIBreakpointsTest.class, MICatchpointsTest_6_7.class, MIDisassemblyTest_6_7.class, GDBProcessesTest_6_7.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/MIBreakpointsTest_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/MIBreakpointsTest_6_8.java deleted file mode 100644 index 9209f5828ce..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/MIBreakpointsTest_6_8.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2015 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - * Simon Marchi (Ericsson) - Add and use runningOnWindows(). - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8; - -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext; -import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; -import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext; -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7.MIBreakpointsTest_6_7; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_6_8 extends MIBreakpointsTest_6_7 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_8); - } - - // GDB 6.8 has a bug that ignores watchpoint conditions,which makes this - // test fail. We therefore ignore this test for GDB 6.8 only, but run it - // for all other versions - @Override - @Ignore("This test does not work with GDB 6.8") - @Test - public void breakpointHit_watchpointUpdateCondition() throws Throwable { - // Must call the test in the super class to allow further derived - // classes to run this test. - super.breakpointHit_watchpointUpdateCondition(); - } - - /** - * Starting with GDB 6.8, we request failed breakpoints to be pending in - * GDB. So we no longer get an installation error from GDB. - */ - @Override - @Test - public void insertBreakpoint_InvalidFileName() throws Throwable { - - // Create an invalid line breakpoint - Map breakpoint = new HashMap(); - breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); - breakpoint.put(FILE_NAME_TAG, SOURCE_NAME + "_bad"); - breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_1); - - // Perform the test, which we still expect to succeed - // giving us a pending breakpoint - IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); - assertTrue(fWait.getMessage(), fWait.isOK()); - - // Ensure that right BreakpointEvents were received - waitForBreakpointEvent(1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Ensure that the breakpoint was correctly installed - MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", - breakpoint1.getFileName().equals("")); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong line number)", - breakpoint1.getLineNumber() == -1); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)", - breakpoint1.getCondition().equals(NO_CONDITION)); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)", - breakpoint1.getIgnoreCount() == 0); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong state)", - breakpoint1.isEnabled()); - assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", - breakpoint1.isPending()); - - // Ensure the BreakpointService holds only the right breakpoints - IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); - assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " - + breakpoints.length, breakpoints.length == 1); - MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); - assertTrue("BreakpointService problem: breakpoint mismatch", - breakpoint1.equals(breakpoint2)); - } - - /** - * Starting with GDB 6.8, we request failed breakpoints to be pending in - * GDB. So we no longer get an installation error from GDB. - */ - @Override - @Test - public void insertBreakpoint_InvalidFunctionName() throws Throwable { - - // Create an invalid function breakpoint - Map breakpoint = new HashMap(); - breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); - breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); - breakpoint.put(FUNCTION_TAG, "invalid-function-name"); - - // Perform the test, which we still expect to succeed - // giving us a pending breakpoint - IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); - assertTrue(fWait.getMessage(), fWait.isOK()); - - // Ensure that right BreakpointEvents were received - waitForBreakpointEvent(1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Ensure that the breakpoint was correctly installed - MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong file name)", - breakpoint1.getFileName().equals("")); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong function)", - breakpoint1.getFunctionName().equals("")); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong condition)", - breakpoint1.getCondition().equals(NO_CONDITION)); - assertTrue("BreakpointService problem: breakpoint mismatch (wrong ignore count)", - breakpoint1.getIgnoreCount() == 0); - assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", - breakpoint1.isPending()); - - // Ensure the BreakpointService holds only the right breakpoints - IBreakpointDMContext[] breakpoints = getBreakpoints(fBreakpointsDmc); - assertTrue("BreakpointService problem: expected " + 1 + " breakpoint(s), received " - + breakpoints.length, breakpoints.length == 1); - MIBreakpointDMData breakpoint2 = (MIBreakpointDMData) getBreakpoint(breakpoints[0]); - assertTrue("BreakpointService problem: breakpoint mismatch", - breakpoint1.equals(breakpoint2)); - } - - /** - * Starting with GDB 6.8, we request failed breakpoints to be pending in - * GDB. So we no longer get an installation error from GDB. - */ - @Override - @Test - public void insertInvalidBreakpoint_WhileTargetRunning() throws Throwable { - // Interrupting the target on Windows is susceptible to an additional, - // unwanted suspension. That means that silently interrupting the target - // to set/modify/remove a breakpoint then resuming it can leave the - // target in a suspended state. Unfortunately, there is nothing - // practical CDT can do to address this issue except wait for the gdb - // folks to resolve it. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=304096#c27 - if (runningOnWindows()) { - return; - } - - // Create an invalid line breakpoint - Map breakpoint = new HashMap(); - breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); - breakpoint.put(FILE_NAME_TAG, "Bad file name"); - breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); - - // Run the program. It will make a two second sleep() call, during which time... - SyncUtil.resume(); - - // ...we install the breakpoint - MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); - assertTrue(fWait.getMessage(), fWait.isOK()); - - waitForBreakpointEvent(1); - // Ensure the correct BreakpointEvent was received - MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 0 + " BREAKPOINT_HIT event(s), received " - + getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 0); - assertTrue("BreakpointService problem: breakpoint mismatch", - fBreakpointRef == breakpoint1.getNumber()); - assertTrue("BreakpointService problem: breakpoint mismatch (not pending)", - breakpoint1.isPending()); - clearEventCounters(); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java index ededa03bb18..5c539ffa078 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -36,7 +37,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_8.class, GDBPatternMatchingExpressionsTest_6_8.class, MIMemoryTest_6_8.class, - MIBreakpointsTest_6_8.class, + MIBreakpointsTest.class, MICatchpointsTest_6_8.class, MIDisassemblyTest_6_8.class, GDBProcessesTest_6_8.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java index 4441175fcda..0cc3f58ddc1 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -37,7 +38,7 @@ import org.junit.runners.Suite; MIExpressionsTest_6_8.class, GDBPatternMatchingExpressionsTest_6_8.class, MIMemoryTest_6_8.class, - MIBreakpointsTest_6_8.class, + MIBreakpointsTest.class, MICatchpointsTest_6_8.class, MIDisassemblyTest_6_8.class, GDBProcessesTest_6_8.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/MIBreakpointsTest_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/MIBreakpointsTest_7_0.java deleted file mode 100644 index a86f5ffe46a..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/MIBreakpointsTest_7_0.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8.MIBreakpointsTest_6_8; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_0 extends MIBreakpointsTest_6_8 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0); - } - - // GDB 6.8 has a bug that ignores watchpoint conditions,which makes this - // test fail. We therefore ignore this test for GDB 6.8 only, but run it - // for all other versions, so the code below re-enables the test starting - // with GDB 7.0. - @Override - @Test - public void breakpointHit_watchpointUpdateCondition() throws Throwable { - super.breakpointHit_watchpointUpdateCondition(); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java index cffb0060592..dd7678752bf 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_0.class, GDBPatternMatchingExpressionsTest_7_0.class, MIMemoryTest_7_0.class, - MIBreakpointsTest_7_0.class, + MIBreakpointsTest.class, MICatchpointsTest_7_0.class, MIDisassemblyTest_7_0.class, GDBProcessesTest_7_0.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java index 786c507f7d4..227f215b1d5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_0.class, GDBPatternMatchingExpressionsTest_7_0.class, MIMemoryTest_7_0.class, - MIBreakpointsTest_7_0.class, + MIBreakpointsTest.class, MICatchpointsTest_7_0.class, MIDisassemblyTest_7_0.class, GDBProcessesTest_7_0.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/MIBreakpointsTest_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/MIBreakpointsTest_7_1.java deleted file mode 100644 index 3e129d2909a..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/MIBreakpointsTest_7_1.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0.MIBreakpointsTest_7_0; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_1 extends MIBreakpointsTest_7_0 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_1); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java index 0e5fa2b55ce..a854eab8679 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_1.class, GDBPatternMatchingExpressionsTest_7_1.class, MIMemoryTest_7_1.class, - MIBreakpointsTest_7_1.class, + MIBreakpointsTest.class, MICatchpointsTest_7_1.class, MIDisassemblyTest_7_1.class, GDBProcessesTest_7_1.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java index 806fb445170..02f838554b6 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_1.class, GDBPatternMatchingExpressionsTest_7_1.class, MIMemoryTest_7_1.class, - MIBreakpointsTest_7_1.class, + MIBreakpointsTest.class, MICatchpointsTest_7_1.class, MIDisassemblyTest_7_1.class, GDBProcessesTest_7_1.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/MIBreakpointsTest_7_10.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/MIBreakpointsTest_7_10.java deleted file mode 100644 index 0093e53a384..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/MIBreakpointsTest_7_10.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_10; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_9.MIBreakpointsTest_7_9; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_10 extends MIBreakpointsTest_7_9 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_10); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_7_10.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_7_10.java index 956c2eedd98..c44c960ecad 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_7_10.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_7_10.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_10; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -38,7 +39,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_10.class, GDBPatternMatchingExpressionsTest_7_10.class, MIMemoryTest_7_10.class, - MIBreakpointsTest_7_10.class, + MIBreakpointsTest.class, MICatchpointsTest_7_10.class, MIDisassemblyTest_7_10.class, GDBProcessesTest_7_10.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_Remote_7_10.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_Remote_7_10.java index ce84901e070..eea3ba28056 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_Remote_7_10.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_10/Suite_Remote_7_10.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_10; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_10.class, GDBPatternMatchingExpressionsTest_7_10.class, MIMemoryTest_7_10.class, - MIBreakpointsTest_7_10.class, + MIBreakpointsTest.class, MICatchpointsTest_7_10.class, MIDisassemblyTest_7_10.class, GDBProcessesTest_7_10.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/MIBreakpointsTest_7_11.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/MIBreakpointsTest_7_11.java deleted file mode 100644 index ec5b091f56e..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/MIBreakpointsTest_7_11.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_10.MIBreakpointsTest_7_10; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_11 extends MIBreakpointsTest_7_10 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_11); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_7_11.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_7_11.java index 748631832f4..a03e429afa0 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_7_11.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_7_11.java @@ -9,6 +9,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -33,7 +34,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_11.class, GDBPatternMatchingExpressionsTest_7_11.class, MIMemoryTest_7_11.class, - MIBreakpointsTest_7_11.class, + MIBreakpointsTest.class, MICatchpointsTest_7_11.class, MIDisassemblyTest_7_11.class, GDBProcessesTest_7_11.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_Remote_7_11.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_Remote_7_11.java index 2c78de342fb..9e49953a863 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_Remote_7_11.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_11/Suite_Remote_7_11.java @@ -10,6 +10,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_11; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -36,7 +37,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_11.class, GDBPatternMatchingExpressionsTest_7_11.class, MIMemoryTest_7_11.class, - MIBreakpointsTest_7_11.class, + MIBreakpointsTest.class, MICatchpointsTest_7_11.class, MIDisassemblyTest_7_11.class, GDBProcessesTest_7_11.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIBreakpointsTest_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIBreakpointsTest_7_2.java deleted file mode 100644 index 2f638805592..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIBreakpointsTest_7_2.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.MIBreakpointsTest_7_1; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_2 extends MIBreakpointsTest_7_1 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java index f2ab950c53b..306774c2cff 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_2.class, GDBPatternMatchingExpressionsTest_7_2.class, MIMemoryTest_7_2.class, - MIBreakpointsTest_7_2.class, + MIBreakpointsTest.class, MICatchpointsTest_7_2.class, MIDisassemblyTest_7_2.class, GDBProcessesTest_7_2.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java index be9810b42af..4418754e577 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_2.class, GDBPatternMatchingExpressionsTest_7_2.class, MIMemoryTest_7_2.class, - MIBreakpointsTest_7_2.class, + MIBreakpointsTest.class, MICatchpointsTest_7_2.class, MIDisassemblyTest_7_2.class, GDBProcessesTest_7_2.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/MIBreakpointsTest_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/MIBreakpointsTest_7_3.java deleted file mode 100644 index e476de5ec81..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/MIBreakpointsTest_7_3.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Ericsson - Initial Implementation - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2.MIBreakpointsTest_7_2; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_3 extends MIBreakpointsTest_7_2 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java index e8e1a03694a..81779de4020 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_3.class, GDBPatternMatchingExpressionsTest_7_3.class, MIMemoryTest_7_3.class, - MIBreakpointsTest_7_3.class, + MIBreakpointsTest.class, MICatchpointsTest_7_3.class, MIDisassemblyTest_7_3.class, GDBProcessesTest_7_3.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java index 54a9c21bc62..bb09c6291d0 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_Remote_7_3.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_3.class, GDBPatternMatchingExpressionsTest_7_3.class, MIMemoryTest_7_3.class, - MIBreakpointsTest_7_3.class, + MIBreakpointsTest.class, MICatchpointsTest_7_3.class, MIDisassemblyTest_7_3.class, GDBProcessesTest_7_3.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/MIBreakpointsTest_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/MIBreakpointsTest_7_4.java deleted file mode 100644 index ed511079793..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/MIBreakpointsTest_7_4.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; - -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext; -import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData; -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.MIBreakpointsTest_7_3; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_4 extends MIBreakpointsTest_7_3 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_4); - } - - /* - * Starting with GDB 7.4, breakpoints at invalid lines succeed and become - * pending breakpoints. This is because the invalid line for one file, - * may be valid for another file with the same name. - * One could argue that line 0 is an exception, but GDB does not make - * a difference. - * @see org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest#insertBreakpoint_InvalidLineNumber() - */ - @Override - @Test - public void insertBreakpoint_InvalidLineNumber() throws Throwable { - - // Create a line breakpoint - Map breakpoint = new HashMap(); - breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); - breakpoint.put(FILE_NAME_TAG, SOURCE_NAME); - breakpoint.put(LINE_NUMBER_TAG, 0); - - // Perform the test - IBreakpointDMContext ref = insertBreakpoint(fBreakpointsDmc, breakpoint); - assertTrue(fWait.getMessage(), fWait.isOK()); - - // Ensure that no BreakpointEvent was received - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - - MIBreakpointDMData bpData = (MIBreakpointDMData) getBreakpoint(ref); - assertTrue("Breakpoint should be pending", bpData.isPending()); - assertTrue("Breakpoint mismatch should be enabled", bpData.isEnabled()); - } - - // Re-enabled this test since it needs breakpoint synchronization - // with the gdb console, which is available starting with GDB 7.4 - // We still leave the test in the base class MIBreakpointsTest because - // the test could be written differently and made to work for older - // gdb versions - @Override - @Test - public void updateBreakpoint_AfterRestart() throws Throwable { - super.updateBreakpoint_AfterRestart(); - } - -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java index 87730466713..509a80b5196 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_7_4.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_4.class, GDBPatternMatchingExpressionsTest_7_4.class, MIMemoryTest_7_4.class, - MIBreakpointsTest_7_4.class, + MIBreakpointsTest.class, MICatchpointsTest_7_4.class, MIDisassemblyTest_7_4.class, GDBProcessesTest_7_4.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java index 9a1c1f6d334..66f009f9324 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/Suite_Remote_7_4.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_4.class, GDBPatternMatchingExpressionsTest_7_4.class, MIMemoryTest_7_4.class, - MIBreakpointsTest_7_4.class, + MIBreakpointsTest.class, MICatchpointsTest_7_4.class, MIDisassemblyTest_7_4.class, GDBProcessesTest_7_4.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/MIBreakpointsTest_7_5.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/MIBreakpointsTest_7_5.java deleted file mode 100644 index 169d9e5fcc9..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/MIBreakpointsTest_7_5.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4.MIBreakpointsTest_7_4; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_5 extends MIBreakpointsTest_7_4 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_5); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java index ec031434af7..38b673c218a 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_7_5.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -40,7 +41,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_5.class, GDBPatternMatchingExpressionsTest_7_5.class, MIMemoryTest_7_5.class, - MIBreakpointsTest_7_5.class, + MIBreakpointsTest.class, MICatchpointsTest_7_5.class, MIDisassemblyTest_7_5.class, GDBProcessesTest_7_5.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_Remote_7_5.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_Remote_7_5.java index bbc45b81e7f..e1ce89eb559 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_Remote_7_5.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_5/Suite_Remote_7_5.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_5.class, GDBPatternMatchingExpressionsTest_7_5.class, MIMemoryTest_7_5.class, - MIBreakpointsTest_7_5.class, + MIBreakpointsTest.class, MICatchpointsTest_7_5.class, MIDisassemblyTest_7_5.class, GDBProcessesTest_7_5.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/MIBreakpointsTest_7_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/MIBreakpointsTest_7_6.java deleted file mode 100644 index c5dd923c348..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/MIBreakpointsTest_7_6.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2013 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_6; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5.MIBreakpointsTest_7_5; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_6 extends MIBreakpointsTest_7_5 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_6); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_7_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_7_6.java index d5fa375655b..b29bb881edb 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_7_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_7_6.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_6; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_6.class, GDBPatternMatchingExpressionsTest_7_6.class, MIMemoryTest_7_6.class, - MIBreakpointsTest_7_6.class, + MIBreakpointsTest.class, MICatchpointsTest_7_6.class, MIDisassemblyTest_7_6.class, GDBProcessesTest_7_6.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java index 997f24c473e..1c71491c9c9 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/Suite_Remote_7_6.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_6; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -42,7 +43,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_6.class, GDBPatternMatchingExpressionsTest_7_6.class, MIMemoryTest_7_6.class, - MIBreakpointsTest_7_6.class, + MIBreakpointsTest.class, MICatchpointsTest_7_6.class, MIDisassemblyTest_7_6.class, GDBProcessesTest_7_6.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/MIBreakpointsTest_7_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/MIBreakpointsTest_7_7.java deleted file mode 100644 index e66571efa6e..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/MIBreakpointsTest_7_7.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_7; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_6.MIBreakpointsTest_7_6; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_7 extends MIBreakpointsTest_7_6 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_7); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_7_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_7_7.java index ce9ef629f27..5c9d5fb1fe4 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_7_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_7_7.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_7; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_7.class, GDBPatternMatchingExpressionsTest_7_7.class, MIMemoryTest_7_7.class, - MIBreakpointsTest_7_7.class, + MIBreakpointsTest.class, MICatchpointsTest_7_7.class, MIDisassemblyTest_7_7.class, GDBProcessesTest_7_7.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_Remote_7_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_Remote_7_7.java index 99cfd4c499f..2a40eb1c890 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_Remote_7_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_7/Suite_Remote_7_7.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_7; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -42,7 +43,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_7.class, GDBPatternMatchingExpressionsTest_7_7.class, MIMemoryTest_7_7.class, - MIBreakpointsTest_7_7.class, + MIBreakpointsTest.class, MICatchpointsTest_7_7.class, MIDisassemblyTest_7_7.class, GDBProcessesTest_7_7.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/MIBreakpointsTest_7_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/MIBreakpointsTest_7_8.java deleted file mode 100644 index aeaad80a23b..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/MIBreakpointsTest_7_8.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_8; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_7.MIBreakpointsTest_7_7; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_8 extends MIBreakpointsTest_7_7 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_8); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_7_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_7_8.java index 8ea605ba71f..b1aa52903a5 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_7_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_7_8.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_8; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -39,7 +40,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_8.class, GDBPatternMatchingExpressionsTest_7_8.class, MIMemoryTest_7_8.class, - MIBreakpointsTest_7_8.class, + MIBreakpointsTest.class, MICatchpointsTest_7_8.class, MIDisassemblyTest_7_8.class, GDBProcessesTest_7_8.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_Remote_7_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_Remote_7_8.java index 7a28f13e016..5635efb71d1 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_Remote_7_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_8/Suite_Remote_7_8.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_8; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -42,7 +43,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_8.class, GDBPatternMatchingExpressionsTest_7_8.class, MIMemoryTest_7_8.class, - MIBreakpointsTest_7_8.class, + MIBreakpointsTest.class, MICatchpointsTest_7_8.class, MIDisassemblyTest_7_8.class, GDBProcessesTest_7_8.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/MIBreakpointsTest_7_9.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/MIBreakpointsTest_7_9.java deleted file mode 100644 index 72b200e29a6..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/MIBreakpointsTest_7_9.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Marc Khouzam (Ericsson) - Initial implementation of Test cases - *******************************************************************************/ -package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_9; - -import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; -import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; -import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_8.MIBreakpointsTest_7_8; -import org.junit.runner.RunWith; - -@RunWith(BackgroundRunner.class) -public class MIBreakpointsTest_7_9 extends MIBreakpointsTest_7_8 { - @Override - protected void setGdbVersion() { - setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_9); - } -} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_7_9.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_7_9.java index 77364c4c79e..3034f4108aa 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_7_9.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_7_9.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_9; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -38,7 +39,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_9.class, GDBPatternMatchingExpressionsTest_7_9.class, MIMemoryTest_7_9.class, - MIBreakpointsTest_7_9.class, + MIBreakpointsTest.class, MICatchpointsTest_7_9.class, MIDisassemblyTest_7_9.class, GDBProcessesTest_7_9.class, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_Remote_7_9.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_Remote_7_9.java index 10be4edc36e..96e08f1c0dd 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_Remote_7_9.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_9/Suite_Remote_7_9.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_9; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseRemoteSuite; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.eclipse.cdt.tests.dsf.gdb.tests.MIBreakpointsTest; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -41,7 +42,7 @@ import org.junit.runners.Suite; MIExpressionsNonStopTest_7_9.class, GDBPatternMatchingExpressionsTest_7_9.class, MIMemoryTest_7_9.class, - MIBreakpointsTest_7_9.class, + MIBreakpointsTest.class, MICatchpointsTest_7_9.class, MIDisassemblyTest_7_9.class, GDBProcessesTest_7_9.class,