Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2008-04-25 17:39:32 +0000
committerAlena Laskavaia2008-04-25 17:39:32 +0000
commit8c037f0524fac2c69e6be9110f2bdcb21c2c5713 (patch)
tree78b1c108cf858fa0d91849b34fed9d2018323850 /debug/org.eclipse.cdt.debug.ui.tests/core/org
parent7478712fa29a874c6eafb484169c5d2826d6caa5 (diff)
downloadorg.eclipse.cdt-8c037f0524fac2c69e6be9110f2bdcb21c2c5713.tar.gz
org.eclipse.cdt-8c037f0524fac2c69e6be9110f2bdcb21c2c5713.tar.xz
org.eclipse.cdt-8c037f0524fac2c69e6be9110f2bdcb21c2c5713.zip
bug 226689 - catchpoint support
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui.tests/core/org')
-rw-r--r--debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/CatchpointTests.java98
2 files changed, 99 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java
index 0860fc09dfc..7dcf17cbdc0 100644
--- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java
+++ b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/AllDebugTests.java
@@ -38,7 +38,7 @@ public class AllDebugTests {
suite.addTest(DebugTests.suite());
suite.addTest(BreakpointTests.suite());
suite.addTest(LocationTests.suite());
- // suite.addTest(CatchpointTests.suite());
+ suite.addTest(CatchpointTests.suite());
return suite;
diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/CatchpointTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/CatchpointTests.java
new file mode 100644
index 00000000000..cbe1a079f8d
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/CatchpointTests.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 QNX Software Systems 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:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.core.tests;
+
+import java.io.IOException;
+
+import junit.framework.Test;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.debug.core.cdi.CDIException;
+import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
+import org.eclipse.cdt.debug.core.cdi.ICDILocation;
+import org.eclipse.cdt.debug.core.cdi.ICDILocator;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
+import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement3;
+import org.eclipse.cdt.debug.core.cdi.model.ICDICatchpoint;
+import org.eclipse.cdt.debug.mi.core.MIException;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Catchpoint;
+
+public class CatchpointTests extends AbstractDebugTest {
+ public static Test suite() {
+ return new DebugTestWrapper(CatchpointTests.class){};
+ }
+
+ protected String getProjectName() {
+ return "catchpoints";
+ }
+
+ protected String getProjectZip() {
+ return "resources/debugCxxTest.zip";
+ }
+
+ protected String getProjectBinary() {
+ return "catchpoints";
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ createDebugSession();
+ assertNotNull(currentTarget);
+ currentTarget.deleteAllBreakpoints();
+ pause();
+ }
+
+ void setBreakOnMain() throws CDIException {
+ ICDILocation location = null;
+ location = currentTarget.createFunctionLocation("", "main"); //$NON-NLS-1$
+ currentTarget.setFunctionBreakpoint(ICDIBreakpoint.TEMPORARY, (ICDIFunctionLocation) location, null, false);
+
+ }
+
+ public void testCatch() throws CModelException, IOException, MIException, CDIException {
+ catchpoints(Catchpoint.CATCH, "");
+ }
+
+ public void testThrow() throws CModelException, IOException, MIException, CDIException {
+ catchpoints(Catchpoint.THROW, "");
+ }
+
+ private void catchpoints(String type, String arg) throws CModelException, IOException, MIException, CDIException {
+ ICDIBreakpoint[] breakpoints;
+ ICDICatchpoint curbreak;
+
+ setBreakOnMain();
+ currentTarget.restart();
+ waitSuspend(currentTarget);
+ ICDILocator locator = currentTarget.getThreads()[0].getStackFrames()[0].getLocator();
+ assertEquals("Debug should be stopped in function 'main' but it is stopped in: " + locator.getFunction(),
+ "main", locator.getFunction());
+
+ currentTarget.deleteAllBreakpoints();
+ pause();
+ assertTrue(currentTarget instanceof ICDIBreakpointManagement3);
+ ((ICDIBreakpointManagement3) currentTarget).setCatchpoint(type, arg, ICDIBreakpoint.REGULAR, null, false, true);
+ pause();
+ breakpoints = currentTarget.getBreakpoints();
+ assertNotNull(breakpoints);
+ assertTrue(breakpoints.length == 1);
+ if (breakpoints[0] instanceof ICDICatchpoint) {
+ curbreak = (ICDICatchpoint) breakpoints[0];
+ } else
+ curbreak = null;
+ assertNotNull(curbreak);
+ currentTarget.resume(false);
+ waitSuspend(currentTarget);
+ // it is stopped we are fine, it did hit breakpoint
+ }
+
+}

Back to the top