Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-04-08 16:02:35 -0400
committerJohn Cortell2010-04-08 16:02:35 -0400
commit119d848c62505f121f6c87d3e56109cc37753ad4 (patch)
tree61508861dc47e0de23d9bf3f6769b9a42a5b1b49 /debug/org.eclipse.cdt.debug.mi.core
parent5e2d6690ac36cb816acb714621d2ed8caa49312f (diff)
downloadorg.eclipse.cdt-119d848c62505f121f6c87d3e56109cc37753ad4.tar.gz
org.eclipse.cdt-119d848c62505f121f6c87d3e56109cc37753ad4.tar.xz
org.eclipse.cdt-119d848c62505f121f6c87d3e56109cc37753ad4.zip
[305752] Moved gdb event breakpoint constants into new common gdb plugin as well as the registering of the event types (via an extension)
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/META-INF/MANIFEST.MF3
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java3
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java72
3 files changed, 16 insertions, 62 deletions
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 f3ee08098d..d9376777ab 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 18e4caa9d3..1a1650fcd5 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 076da647a6..4bcbaf61aa 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<String, String> idToKeyword = new HashMap<String, String>();
- 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
}

Back to the top