mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
[303569] Additional fix for gdb >= 7.0
This commit is contained in:
parent
3e8a584274
commit
900aeefc47
4 changed files with 69 additions and 12 deletions
|
@ -11,21 +11,33 @@
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit;
|
import org.eclipse.cdt.debug.core.cdi.ICDIEventBreakpointHit;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 7.0
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
public class EventBreakpointHit extends SessionObject implements ICDIEventBreakpointHit {
|
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);
|
super(session);
|
||||||
fMiEvent = miEvent;
|
assert (eventType != null) && (eventType.length() > 0);
|
||||||
|
fEventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEventBreakpointType() {
|
public String getEventBreakpointType() {
|
||||||
return fMiEvent.getCatchpointType();
|
return fEventType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.event.ICDISuspendedEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
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.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.EndSteppingRange;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.ErrorInfo;
|
import org.eclipse.cdt.debug.mi.core.cdi.ErrorInfo;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.EventBreakpointHit;
|
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.SignalReceived;
|
||||||
import org.eclipse.cdt.debug.mi.core.cdi.WatchpointScope;
|
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.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.cdi.model.Target;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointHitEvent;
|
||||||
import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
|
import org.eclipse.cdt.debug.mi.core.event.MICatchpointHitEvent;
|
||||||
|
@ -51,7 +54,20 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
||||||
|
|
||||||
public ICDISessionObject getReason() {
|
public ICDISessionObject getReason() {
|
||||||
if (event instanceof MIBreakpointHitEvent) {
|
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) {
|
} else if (event instanceof MIWatchpointTriggerEvent) {
|
||||||
return new WatchpointTrigger(session, (MIWatchpointTriggerEvent)event);
|
return new WatchpointTrigger(session, (MIWatchpointTriggerEvent)event);
|
||||||
} else if (event instanceof MIWatchpointScopeEvent) {
|
} else if (event instanceof MIWatchpointScopeEvent) {
|
||||||
|
@ -69,7 +85,8 @@ public class SuspendedEvent implements ICDISuspendedEvent {
|
||||||
} else if (event instanceof MISharedLibEvent) {
|
} else if (event instanceof MISharedLibEvent) {
|
||||||
return new SharedLibraryEvent(session);
|
return new SharedLibraryEvent(session);
|
||||||
} else if (event instanceof MICatchpointHitEvent) {
|
} 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;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,11 +67,28 @@ public class EventBreakpoint extends Breakpoint implements ICDIEventBreakpoint {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gdb catchpoint keyword associated with this event breakpoint
|
||||||
|
* (e.g., "signal", "throw")
|
||||||
|
*/
|
||||||
public String getGdbEvent() {
|
public String getGdbEvent() {
|
||||||
String etype = getEventType();
|
return getGdbEventFromId(getEventType());
|
||||||
String key= idToKeyword.get(etype);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
if (key!=null) return key;
|
||||||
|
assert false : "Unexpected even breakpoint type ID: " + eventTypeId; //$NON-NLS-1$
|
||||||
return "unknown"; //$NON-NLS-1$
|
return "unknown"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,19 @@ import org.eclipse.cdt.debug.mi.core.output.MIExecAsyncOutput;
|
||||||
*/
|
*/
|
||||||
public class MICatchpointHitEvent extends MIStoppedEvent {
|
public class MICatchpointHitEvent extends MIStoppedEvent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See catcpointType parameter in constructor
|
||||||
|
*/
|
||||||
private String fCatchpointType;
|
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) {
|
public MICatchpointHitEvent(MISession source, MIExecAsyncOutput async, String catchpointType) {
|
||||||
super(source, async);
|
super(source, async);
|
||||||
fCatchpointType = catchpointType;
|
fCatchpointType = catchpointType;
|
||||||
|
|
Loading…
Add table
Reference in a new issue