diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
index a664003eb86..edaf33a9ccf 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICEventBreakpoint.java
@@ -25,10 +25,8 @@ public interface ICEventBreakpoint extends ICBreakpoint {
/**
* Breakpoint attribute storing the event breakpoint event id. Basically,
* this indicates what type of event the breakpoint catches--e.g., a C++
- * exception throw, a library load, a thread exit, etc. Event types can be
- * contributed via the "breakpointContribution" extension point. Stock CDT
- * contributes a number of them, which are represented here by the
- * EVENT_TYPE_XXXXX constants
+ * exception throw, a library load, a thread exit, etc. Event types are
+ * contributed via the "breakpointContribution" extension point.
*
*
* This attribute is a String
.
@@ -36,120 +34,6 @@ public interface ICEventBreakpoint extends ICBreakpoint {
*/
public static final String EVENT_TYPE_ID = "org.eclipse.cdt.debug.core.eventbreakpoint_event_id"; //$NON-NLS-1$
- /**
- * An event breakpoint of this type suspends the target program when it
- * catches a C++ exception. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_CATCH = "org.eclipse.cdt.debug.gdb.catch"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * throws a C++ exception. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_THROW = "org.eclipse.cdt.debug.gdb.throw"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * catches a signal (POSIX). This type of event has a single parameter of
- * type in, indicating the specific signal.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_SIGNAL_CATCH = "org.eclipse.cdt.debug.gdb.signal"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * calls fork() (POSIX). This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_FORK = "org.eclipse.cdt.debug.gdb.catch_fork"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * calls vfork() (POSIX). This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_VFORK = "org.eclipse.cdt.debug.gdb.catch_vfork"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * calls exec() (POSIX). This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_EXEC = "org.eclipse.cdt.debug.gdb.catch_exec"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * calls exit() (POSIX). This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_EXIT = "org.eclipse.cdt.debug.gdb.catch_exit"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when a new
- * process starts. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_PROCESS_START = "org.eclipse.cdt.debug.gdb.catch_start"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when a
- * process exits. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_PROCESS_STOP = "org.eclipse.cdt.debug.gdb.catch_stop"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when a new
- * thread starts. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_THREAD_START = "org.eclipse.cdt.debug.gdb.catch_thread_start"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when a
- * thread exits. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_THREAD_EXIT = "org.eclipse.cdt.debug.gdb.catch_thread_exit"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when a
- * thread joins another one (waits for it to exit) This type of event has no
- * parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_THREAD_JOIN = "org.eclipse.cdt.debug.gdb.catch_thread_join"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * loads a library. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_LIBRARY_LOAD = "org.eclipse.cdt.debug.gdb.catch_load"; //$NON-NLS-1$
-
- /**
- * An event breakpoint of this type suspends the target program when it
- * unloads a library. This type of event has no parameters.
- *
- * @since 7.0
- */
- public static final String EVENT_TYPE_LIBRARY_UNLOAD = "org.eclipse.cdt.debug.gdb.catch_unload"; //$NON-NLS-1$
-
/**
* Breakpoint attribute storing the event breakpoint argument. This
* attribute is a String
, though it may be a stringified
@@ -159,9 +43,8 @@ public interface ICEventBreakpoint extends ICBreakpoint {
public static final String EVENT_ARG = "org.eclipse.cdt.debug.core.eventbreakpoint_event_arg"; //$NON-NLS-1$
/**
- * Get the event breakpoint type. One of our EVENT_TYPE_XXXXX constants or a
- * custom type contributed via the breakpointContribution
- * extension point
+ * Get the event breakpoint type. Same as querying the property
+ * {@link #EVENT_TYPE_ID}
*
* @return event breakpoint type id (not null)
* @throws CoreException
@@ -170,7 +53,8 @@ public interface ICEventBreakpoint extends ICBreakpoint {
/**
* Get the event argument, if the type has one. Currently, an event type can
- * have at most one argument.
+ * have at most one argument. Same as querying the property
+ * {@link #EVENT_ARG}
*
* @return event argument, or null if not applicable
* @throws CoreException
diff --git a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
index f3ee08098da..d9376777abb 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF
@@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.cdt.debug.core;bundle-version="[7.0.0,8.0.0)",
org.eclipse.debug.core;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[5.0.0,6.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.core.variables;bundle-version="3.2.200"
+ org.eclipse.core.variables;bundle-version="3.2.200",
+ org.eclipse.cdt.gdb;bundle-version="7.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: com.ibm.icu.text
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java
index 18e4caa9d3b..1a1650fcd56 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java
@@ -37,6 +37,7 @@ import org.eclipse.cdt.debug.mi.core.event.MISignalEvent;
import org.eclipse.cdt.debug.mi.core.event.MISteppingRangeEvent;
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointScopeEvent;
import org.eclipse.cdt.debug.mi.core.event.MIWatchpointTriggerEvent;
+import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints;
/**
*
@@ -59,7 +60,7 @@ public class SuspendedEvent implements ICDISuspendedEvent {
BreakpointManager bkptMgr = session.getBreakpointManager();
Breakpoint bkpt = bkptMgr.getBreakpoint(event.getMISession(), ((MIBreakpointHitEvent)event).getNumber());
if (bkpt instanceof EventBreakpoint) {
- return new EventBreakpointHit(session, EventBreakpoint.getGdbEventFromId(((EventBreakpoint)bkpt).getEventType()));
+ return new EventBreakpointHit(session, GdbCatchpoints.eventToGdbCatchpointKeyword(((EventBreakpoint)bkpt).getEventType()));
}
else {
return new BreakpointHit(session, (MIBreakpointHitEvent)event);
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java
index 076da647a6d..4bcbaf61aa0 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java
@@ -11,14 +11,13 @@
package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.model.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.mi.core.output.MIBreakpoint;
+import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants;
+import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints;
/**
* @since 6.0
@@ -29,30 +28,6 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
private String eventType;
private String arg;
- /**
- * A mapping of ICEventBreakpoint event types to their corresponding gdb
- * catchpoint keyword
- */
- private static final Map idToKeyword = new HashMap();
- static {
- // these Ids are also referenced in mi.ui plugin as contribution
- // to event breakpoints selector
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_CATCH, "catch"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THROW, "throw"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_SIGNAL_CATCH, "signal"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_EXEC, "exec"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_FORK, "fork"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_VFORK, "vfork"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_EXIT, "exit"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_START, "start"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_STOP, "stop"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_START, "thread_start"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_EXIT, "thread_exit"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_THREAD_JOIN, "thread_join"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_LOAD, "load"); //$NON-NLS-1$
- idToKeyword.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_UNLOAD, "unload"); //$NON-NLS-1$
- }
-
public EventBreakpoint(Target target, String event, String arg, ICDICondition cond, boolean enabled) {
super(target, ICBreakpointType.REGULAR, cond, enabled);
this.eventType = event;
@@ -72,24 +47,7 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
* (e.g., "signal", "throw")
*/
public String getGdbEvent() {
- return getGdbEventFromId(getEventType());
- }
-
- /**
- * Returns the gdb catchpoint keyword associated with the given event point
- * type id (e.g., "signal", "throw")
- *
- * @param eventTypeId
- * one of the EVENT_TYPE_XXXXX constants from
- * {@link ICEventBreakpoint}
- *
- * @since 7.0
- */
- public static String getGdbEventFromId(String eventTypeId) {
- String key= idToKeyword.get(eventTypeId);
- if (key!=null) return key;
- assert false : "Unexpected even breakpoint type ID: " + eventTypeId; //$NON-NLS-1$
- return "unknown"; //$NON-NLS-1$
+ return GdbCatchpoints.eventToGdbCatchpointKeyword(getEventType());
}
public String getGdbArg() {
@@ -116,24 +74,18 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
* @return null if unknown type, null cannot be used to create valid EventBreakpoint
*/
public static String getEventTypeFromMI(MIBreakpoint miBreakpoint) {
+ // Two exceptions to how the message is typically formatted
if (miBreakpoint.getWhat().equals("exception catch")) { //$NON-NLS-1$
- return ICEventBreakpoint.EVENT_TYPE_CATCH;
+ return IEventBreakpointConstants.EVENT_TYPE_CATCH;
} else if (miBreakpoint.getWhat().equals("exception throw")) { //$NON-NLS-1$
- return ICEventBreakpoint.EVENT_TYPE_THROW;
- } else if (miBreakpoint.getType().equals("catch signal")) { //$NON-NLS-1$
- // catch signal does not work in gdb
- return ICEventBreakpoint.EVENT_TYPE_SIGNAL_CATCH;
- }
+ return IEventBreakpointConstants.EVENT_TYPE_THROW;
+ }
+
String miType = miBreakpoint.getType();
- String prefix = "catch "; //$NON-NLS-1$
- if (miType.startsWith(prefix)) {
- String key = miType.substring(prefix.length());
- for (String id : idToKeyword.keySet()) {
- String etype = idToKeyword.get(id);
- if (key.equals(etype)) {
- return id;
- }
- }
+ final String PREFIX = "catch "; //$NON-NLS-1$
+ if (miType.startsWith(PREFIX)) {
+ String keyword = miType.substring(PREFIX.length());
+ return GdbCatchpoints.gdbCatchpointKeywordToEvent(keyword);
}
return null; // not known/supported
}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
index 9bea989fd37..00d91b7edcf 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.properties
@@ -21,24 +21,3 @@ TargetOptionsPage.label=GDB/MI Options
VerboseMode.label=Verbose Mode
VerboseMode.tooltip=Verbose Mode For gdb Console
-
-
-catchType.label = Event Type
-catchSignal.label = Signal Caught
-catchSignal.arg.label = Signal Number
-catchCatch.label = Exception Caught
-catchThrow.label = Exception Thrown
-
-#Note: fork, vfork and exec is not translatable words
-catchFork.label = Stop on fork
-catchVfork.label = Stop on vfork
-catchExec.label = Stop on exec
-
-catchExit.label = Process exit
-catchStop.label = Process suspend
-catchStart.label = Process start
-catchThreadExit.label = Thread exit
-catchThreadStart.label = Thread start
-catchThreadJoin.label = Thread join
-catchLoad.label = Library load
-catchUnload.label = Library unload
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
index 2c8ef969e5d..4d41d97d58d 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.mi.ui/plugin.xml
@@ -84,58 +84,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF
index 7dfa3333395..479706d6ec7 100644
--- a/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui.tests/META-INF/MANIFEST.MF
@@ -4,7 +4,6 @@ Bundle-Name: org.eclipse.cdt.debug.ui.tests
Bundle-SymbolicName: org.eclipse.cdt.debug.ui.tests;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Activator: org.eclipse.core.internal.compatibility.PluginActivator
-Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.debug.core.tests,
org.eclipse.cdt.debug.testplugin,
org.eclipse.cdt.debug.testplugin.util
@@ -15,7 +14,8 @@ Require-Bundle: org.eclipse.ui.ide,
org.eclipse.cdt.debug.mi.core,
org.eclipse.cdt.core,
org.eclipse.ui,
- org.eclipse.core.runtime.compatibility
+ org.eclipse.core.runtime.compatibility,
+ org.eclipse.cdt.gdb;bundle-version="7.0.0"
Bundle-ActivationPolicy: lazy
Plugin-Class: org.eclipse.cdt.debug.testplugin.CTestPlugin
Bundle-Vendor: Eclipse CDT
diff --git a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java
index c101bf60c01..e1526a0b435 100644
--- a/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java
+++ b/debug/org.eclipse.cdt.debug.ui.tests/core/org/eclipse/cdt/debug/core/tests/EventBreakpointTests.java
@@ -21,8 +21,8 @@ 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.ICDIEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
import org.eclipse.cdt.debug.mi.core.MIException;
+import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants;
public class EventBreakpointTests extends AbstractDebugTest {
public static Test suite() {
@@ -52,11 +52,11 @@ public class EventBreakpointTests extends AbstractDebugTest {
public void testCatch() throws CModelException, IOException, MIException, CDIException {
- eventbreakpoints(ICEventBreakpoint.EVENT_TYPE_CATCH, "");
+ eventbreakpoints(IEventBreakpointConstants.EVENT_TYPE_CATCH, "");
}
public void testThrow() throws CModelException, IOException, MIException, CDIException {
- eventbreakpoints(ICEventBreakpoint.EVENT_TYPE_THROW, "");
+ eventbreakpoints(IEventBreakpointConstants.EVENT_TYPE_THROW, "");
}
private void eventbreakpoints(String type, String arg) throws CModelException, IOException, MIException, CDIException {
diff --git a/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF
index fa47a808326..e4f695b619f 100644
--- a/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.gdb/META-INF/MANIFEST.MF
@@ -11,4 +11,5 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.gdb.eventbkpts,
- org.eclipse.cdt.gdb.internal;x-internal:=true
+ org.eclipse.cdt.gdb.internal;x-internal:=true,
+ org.eclipse.cdt.gdb.internal.eventbkpts;x-friends:="org.eclipse.cdt.debug.mi.core,org.eclipse.cdt.dsf.gdb,org.eclipse.cdt.tests.dsf.gdb"
diff --git a/debug/org.eclipse.cdt.gdb/src/org/eclipse/cdt/gdb/internal/eventbkpts/GdbCatchpoints.java b/debug/org.eclipse.cdt.gdb/src/org/eclipse/cdt/gdb/internal/eventbkpts/GdbCatchpoints.java
new file mode 100644
index 00000000000..ce2ae65760e
--- /dev/null
+++ b/debug/org.eclipse.cdt.gdb/src/org/eclipse/cdt/gdb/internal/eventbkpts/GdbCatchpoints.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Freescale Semiconductor 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:
+ * Freescale Semiconductor - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.gdb.internal.eventbkpts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.gdb.eventbkpts.IEventBreakpointConstants;
+
+public class GdbCatchpoints {
+
+ /** Map which services {@link #eventToGdbCatchpointKeyword(String)} */
+ private static final Map sIdToKeyword = new HashMap();
+ static {
+ // these Ids are also referenced in mi.ui plugin as contribution
+ // to event breakpoints selector
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_CATCH, "catch"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_THROW, "throw"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_SIGNAL_CATCH, "signal"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_EXEC, "exec"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_FORK, "fork"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_VFORK, "vfork"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_EXIT, "exit"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_PROCESS_START, "start"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_PROCESS_STOP, "stop"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_THREAD_START, "thread_start"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_THREAD_EXIT, "thread_exit"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_THREAD_JOIN, "thread_join"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_LIBRARY_LOAD, "load"); //$NON-NLS-1$
+ sIdToKeyword.put(IEventBreakpointConstants.EVENT_TYPE_LIBRARY_UNLOAD, "unload"); //$NON-NLS-1$
+ }
+
+ /**
+ * Get the gdb catchpoint event keyword associated with the given
+ * {@link IEventBreakpointConstants} event type ID. Answer will be, e.g.,
+ * "catch", "throw", "fork", etc.
+ *
+ * @param event
+ * an EVENT_TYPE_XXXX constant from IEventBreakpointConstants
+ * @return the gdb keyword for [event]; null if [event] is unrecognized
+ */
+ public static String eventToGdbCatchpointKeyword(String event) {
+ String keyword = sIdToKeyword.get(event);
+ assert keyword != null : "unexpected catchpoint event id";
+ return keyword;
+ }
+
+ /**
+ * An inversion of the lookup done by
+ * {@link #eventToGdbCatchpointKeyword(String)}
+ *
+ * @param keyword
+ * a gdb catchpoint keyword, e.g., "catch", "throw", "fork"
+ * @return the EVENT_TYPE_XXXX constant from IEventBreakpointConstants
+ * associated with [keyword], or null if not recognized
+ */
+ public static String gdbCatchpointKeywordToEvent(String keyword) {
+ for (String eventId : sIdToKeyword.keySet()) {
+ String thisKeyword = sIdToKeyword.get(eventId);
+ if (thisKeyword.equals(keyword)) {
+ return eventId;
+ }
+ }
+
+ // Don't assert. Caller may be using us to determine if a token is a
+ // catchpoint keyword. He may have parsed the keyword out from gdb/mi
+ // output.
+ return null;
+ }
+}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF
index b50dddae081..5d16e1ac84a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.debug.core,
org.eclipse.core.variables,
org.eclipse.jface,
- org.eclipse.cdt.launch;bundle-version="6.1.0"
+ org.eclipse.cdt.launch;bundle-version="6.1.0",
+ org.eclipse.cdt.gdb;bundle-version="7.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.cdt.dsf.gdb,
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
index c9e78826012..9d8533ff4b1 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java
@@ -66,6 +66,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIWatchpointTriggerEvent;
import org.eclipse.cdt.dsf.service.AbstractDsfService;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
+import org.eclipse.cdt.gdb.internal.eventbkpts.GdbCatchpoints;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResource;
@@ -109,30 +110,6 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
IBreakpoints fBreakpoints;
IBreakpointManager fBreakpointManager; // Platform breakpoint manager (not this!)
BreakpointActionManager fBreakpointActionManager;
-
- /**
- * A mapping of ICEventBreakpoint event types to their corresponding gdb
- * catchpoint keyword (as listed in gdb's 'help catch')
- */
- private static final Map sEventBkptTypeToGdb = new HashMap();
- static {
- // these Ids are also referenced in mi.ui plugin as contribution
- // to event breakpoints selector
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_CATCH, "catch"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_THROW, "throw"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_SIGNAL_CATCH, "signal"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_EXEC, "exec"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_FORK, "fork"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_VFORK, "vfork"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_EXIT, "exit"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_START, "start"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_PROCESS_STOP, "stop"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_THREAD_START, "thread_start"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_THREAD_EXIT, "thread_exit"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_THREAD_JOIN, "thread_join"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_LOAD, "load"); //$NON-NLS-1$
- sEventBkptTypeToGdb.put(ICEventBreakpoint.EVENT_TYPE_LIBRARY_UNLOAD, "unload"); //$NON-NLS-1$
- }
///////////////////////////////////////////////////////////////////////////
// Breakpoints tracking
@@ -1701,7 +1678,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo
}
else if (breakpoint instanceof ICEventBreakpoint) {
properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
- properties.put(MIBreakpoints.CATCHPOINT_TYPE, sEventBkptTypeToGdb.get(attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)));
+ properties.put(MIBreakpoints.CATCHPOINT_TYPE, GdbCatchpoints.eventToGdbCatchpointKeyword((String)attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)));
String arg = (String)attributes.get(ICEventBreakpoint.EVENT_ARG);
String[] args;
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 f666732a93c..b466b736a36 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
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.swt,
org.eclipse.cdt.dsf.gdb,
- org.eclipse.cdt.launch;bundle-version="6.1.0"
+ org.eclipse.cdt.launch;bundle-version="6.1.0",
+ org.eclipse.cdt.gdb;bundle-version="7.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
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 098c37416da..a08fe7b883f 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
@@ -13,6 +13,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.math.BigInteger;
@@ -51,6 +52,8 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
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.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;
@@ -1191,6 +1194,20 @@ public class MICatchpointsTest extends BaseTestCase {
resumeAndExpectBkptHit(throwCatchpointNumber, null);
}
+ /**
+ * Test some utiility methods we use to convert between event breakpoint ids
+ * and gdb catchpoint keywords
+ */
+ @Test
+ public void catchpointConversions() throws Throwable {
+ assertEquals("catch", GdbCatchpoints.eventToGdbCatchpointKeyword(IEventBreakpointConstants.EVENT_TYPE_CATCH));
+ assertEquals("signal", GdbCatchpoints.eventToGdbCatchpointKeyword(IEventBreakpointConstants.EVENT_TYPE_SIGNAL_CATCH));
+ assertEquals(IEventBreakpointConstants.EVENT_TYPE_CATCH, GdbCatchpoints.gdbCatchpointKeywordToEvent("catch"));
+ assertEquals(IEventBreakpointConstants.EVENT_TYPE_SIGNAL_CATCH, GdbCatchpoints.gdbCatchpointKeywordToEvent("signal"));
+ assertNull(GdbCatchpoints.gdbCatchpointKeywordToEvent("signa"));
+ assertNull(GdbCatchpoints.gdbCatchpointKeywordToEvent("signals"));
+ }
+
/**
* This method allows the while-target-running tests to side-step a bug in
* Windows gdb. To perform a breakpoint operation while the target is