Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-03-13 00:56:34 -0500
committerJohn Cortell2010-03-13 00:56:34 -0500
commit900aeefc478f301388690f3116430b2e8e837a1e (patch)
treebd47d7bdfa7d4fe155310b323fddd6eec05c4752 /debug/org.eclipse.cdt.debug.mi.core
parent3e8a5842746647b38134de46f482dbb27abd1473 (diff)
downloadorg.eclipse.cdt-900aeefc478f301388690f3116430b2e8e837a1e.tar.gz
org.eclipse.cdt-900aeefc478f301388690f3116430b2e8e837a1e.tar.xz
org.eclipse.cdt-900aeefc478f301388690f3116430b2e8e837a1e.zip
[303569] Additional fix for gdb >= 7.0
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.core')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java22
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/SuspendedEvent.java21
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/EventBreakpoint.java25
-rw-r--r--debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICatchpointHitEvent.java11
4 files changed, 68 insertions, 11 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java
index a7fc6839bc..92c23a3d8e 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventBreakpointHit.java
@@ -11,21 +11,33 @@
package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit;
-import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
/**
* @since 7.0
*/
public class EventBreakpointHit extends SessionObject implements ICDIEventBreakpointHit {
- MICatchpointHitEvent fMiEvent;
+ /**
+ * See description of eventType param in constructor
+ */
+ private String fEventType;
- public EventBreakpointHit(Session session, MICatchpointHitEvent miEvent) {
+ /**
+ * @param session
+ * @param eventType
+ * the type of event breakpoint, in descriptive form (rather than
+ * an ID). E.g., "signal", or "load". These are not standardized,
+ * and can vary slightly from one gdb version to another, because
+ * of difference in how catchpoint hits are reported. This string
+ * should be used solely for display purposes.
+ */
+ public EventBreakpointHit(Session session, String eventType) {
super(session);
- fMiEvent = miEvent;
+ assert (eventType != null) && (eventType.length() > 0);
+ fEventType = eventType;
}
public String getEventBreakpointType() {
- return fMiEvent.getCatchpointType();
+ return fEventType;
}
}
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 1476be4ece..57ab84504a 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
@@ -14,6 +14,7 @@ import org.eclipse.cdt.debug.core.cdi.ICDISessionObject;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointHit;
+import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.EndSteppingRange;
import org.eclipse.cdt.debug.mi.core.cdi.ErrorInfo;
import org.eclipse.cdt.debug.mi.core.cdi.EventBreakpointHit;
@@ -23,6 +24,8 @@ import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryEvent;
import org.eclipse.cdt.debug.mi.core.cdi.SignalReceived;
import org.eclipse.cdt.debug.mi.core.cdi.WatchpointScope;
import org.eclipse.cdt.debug.mi.core.cdi.WatchpointTrigger;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Breakpoint;
+import org.eclipse.cdt.debug.mi.core.cdi.model.EventBreakpoint;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
@@ -51,7 +54,20 @@ public class SuspendedEvent implements ICDISuspendedEvent {
public ICDISessionObject getReason() {
if (event instanceof MIBreakpointHitEvent) {
- return new BreakpointHit(session, (MIBreakpointHitEvent)event);
+ BreakpointManager bkptMgr = session.getBreakpointManager();
+ Breakpoint bkpt = bkptMgr.getBreakpoint(event.getMISession(), ((MIBreakpointHitEvent)event).getNumber());
+ // In versions prior to 7.0, a catchpoint (Event Breakpoint in
+ // CDT speak) is reported by gdb as a generic stopped event; gdb
+ // does not indicate it was caused by a breakpoint. In 7.0 and
+ // above, it does. Here we handle the >= 7.0 case. In the < 7.0
+ // case, we generate a MICatchpointHitEvent, and that's handled
+ // below
+ if (bkpt instanceof EventBreakpoint) {
+ return new EventBreakpointHit(session, EventBreakpoint.getGdbEventFromId(((EventBreakpoint)bkpt).getEventType()));
+ }
+ else {
+ return new BreakpointHit(session, (MIBreakpointHitEvent)event);
+ }
} else if (event instanceof MIWatchpointTriggerEvent) {
return new WatchpointTrigger(session, (MIWatchpointTriggerEvent)event);
} else if (event instanceof MIWatchpointScopeEvent) {
@@ -69,7 +85,8 @@ public class SuspendedEvent implements ICDISuspendedEvent {
} else if (event instanceof MISharedLibEvent) {
return new SharedLibraryEvent(session);
} else if (event instanceof MICatchpointHitEvent) {
- return new EventBreakpointHit(session, (MICatchpointHitEvent)event);
+ // See note above. If we get here, we're dealing with a gdb < 7.0
+ return new EventBreakpointHit(session, ((MICatchpointHitEvent)event).getCatchpointType());
}
return session;
}
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 6850c1a0c3..076da647a6 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
@@ -67,14 +67,31 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
return arg;
}
-
+ /**
+ * Returns the gdb catchpoint keyword associated with this event breakpoint
+ * (e.g., "signal", "throw")
+ */
public String getGdbEvent() {
- String etype = getEventType();
- String key= idToKeyword.get(etype);
+ 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$
}
-
+
public String getGdbArg() {
return getExtraArgument();
}
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICatchpointHitEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICatchpointHitEvent.java
index 7a06414e3b..fae38e46ee 100644
--- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICatchpointHitEvent.java
+++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MICatchpointHitEvent.java
@@ -18,8 +18,19 @@ import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
*/
public class MICatchpointHitEvent extends MIStoppedEvent {
+ /**
+ * See catcpointType parameter in constructor
+ */
private String fCatchpointType;
+ /**
+ * @param source
+ * @param async
+ * @param catchpointType
+ * the type of catchpoint as reported by gdb via the gdb console
+ * when the catchpoint is hit. We parse the stream record to get
+ * this.
+ */
public MICatchpointHitEvent(MISession source, MIExecAsyncOutput async, String catchpointType) {
super(source, async);
fCatchpointType = catchpointType;

Back to the top