mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-07 08:15:48 +02:00
Bug 516053: Allow MIBreakpointDMData to be extended
New API to allow third-parties to extend MIBreakpointDMData with their own custom Breakpoint handling. Includes deperecating of MIBreakpointNature that was not used anywhere in CDT except within internals of MIBreakpointDMData. It arguably should never have been API in the first place. Change-Id: I6bcdf2ccaa28d15835ab022648b9b4b0aa7498a7
This commit is contained in:
parent
a36ecd3839
commit
d4ecd37bb1
7 changed files with 150 additions and 109 deletions
|
@ -177,7 +177,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
|
||||
|
@ -260,7 +260,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
|
|||
if (bp.getNumber().equals(tpReference)) {
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(bp);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(bp);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
contextBreakpoints.put(reference, newBreakpoint);
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
|
|||
breakpointContext.clear();
|
||||
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
|
||||
for (int i = 0; i < breakpoints.length; i++) {
|
||||
MIBreakpointDMData breakpointData = new MIBreakpointDMData(breakpoints[i]);
|
||||
MIBreakpointDMData breakpointData = createMIBreakpointDMData(breakpoints[i]);
|
||||
|
||||
// Now fill in the thread-group information into the breakpoint data
|
||||
// It is ok to get null. For example, pending breakpoints are not
|
||||
|
@ -222,7 +222,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
|
||||
|
|
|
@ -188,7 +188,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
|
|||
MIBreakpoint miBpt = getData();
|
||||
if (miBpt != null) {
|
||||
bs.removeCreatedTargetBreakpoint(context, miBpt);
|
||||
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt);
|
||||
MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
|
||||
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
|
||||
IBreakpointDMContext dmc =
|
||||
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
|
||||
|
@ -226,7 +226,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
|
|||
MIBreakpoint miBpt = getData();
|
||||
if (miBpt != null) {
|
||||
bs.removeCreatedTargetBreakpoint(context, miBpt);
|
||||
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt);
|
||||
MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
|
||||
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
|
||||
IBreakpointDMContext dmc =
|
||||
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
|
||||
|
@ -264,7 +264,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
|
|||
MIBreakpoint miBpt = getData();
|
||||
if (miBpt != null) {
|
||||
bs.removeCreatedTargetBreakpoint(context, miBpt);
|
||||
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt);
|
||||
MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
|
||||
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
|
||||
IBreakpointDMContext dmc =
|
||||
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());
|
||||
|
|
|
@ -110,7 +110,7 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
|
|||
MIBreakpoint miBpt = getData();
|
||||
if (miBpt != null) {
|
||||
bs.removeCreatedTargetBreakpoint(context, miBpt);
|
||||
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt);
|
||||
MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
|
||||
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
|
||||
IBreakpointDMContext dmc =
|
||||
new MIBreakpointDMContext(GDBBreakpoints_7_7.this, new IDMContext[] { context }, newBreakpoint.getNumber());
|
||||
|
@ -173,7 +173,7 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null));
|
||||
|
|
|
@ -39,12 +39,20 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
private final MIBreakpoint fBreakpoint;
|
||||
private final Map<String, Object> fProperties;
|
||||
|
||||
// Breakpoint types
|
||||
public static enum MIBreakpointNature { UNKNOWN, BREAKPOINT, WATCHPOINT, CATCHPOINT,
|
||||
/** @since 3.0*/ TRACEPOINT,
|
||||
/** @since 4.4*/ DYNAMICPRINTF };
|
||||
private final MIBreakpointNature fNature;
|
||||
|
||||
/**
|
||||
* Breakpoint types
|
||||
*
|
||||
* @deprecated This enum is not extensible, so has been deprecated to allow extenders to have their own breakpoint
|
||||
* types. Within CDT there was no access to this enum outside of this class. The replacement is to use {@link MIBreakpointDMData#getBreakpointType()}
|
||||
*/
|
||||
@Deprecated
|
||||
public static enum MIBreakpointNature {
|
||||
UNKNOWN, BREAKPOINT, WATCHPOINT, CATCHPOINT,
|
||||
/** @since 3.0 */
|
||||
TRACEPOINT,
|
||||
/** @since 4.4 */
|
||||
DYNAMICPRINTF
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Constructors
|
||||
|
@ -54,42 +62,118 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
* Copy constructor
|
||||
*
|
||||
* @param other
|
||||
* @deprecated Call {@link #copy()} on other instead to allow subclasses to be copied properly.
|
||||
*/
|
||||
@Deprecated
|
||||
public MIBreakpointDMData(MIBreakpointDMData other) {
|
||||
|
||||
fBreakpoint = new MIBreakpoint(other.fBreakpoint);
|
||||
fProperties = new HashMap<String, Object>(other.fProperties);
|
||||
fNature = other.fNature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a DsfMIBreakpoint from a back-end object
|
||||
* Perform a copy.
|
||||
*
|
||||
* @param dsfMIBreakpoint back-end breakpoint
|
||||
* @return the copy
|
||||
* @since 5.3
|
||||
*/
|
||||
public MIBreakpointDMData(MIBreakpoint dsfMIBreakpoint) {
|
||||
public MIBreakpointDMData copy() {
|
||||
return new MIBreakpointDMData(new MIBreakpoint(fBreakpoint), new HashMap<String, Object>(fProperties));
|
||||
}
|
||||
|
||||
// No support for catchpoints yet
|
||||
/**
|
||||
* Create a MIBreakpointDMData from a breakpoint and a potentially populated properties map.
|
||||
*
|
||||
* @param dsfMIBreakpoint
|
||||
* MI Breakpoint to represent
|
||||
* @param properties
|
||||
* if {@code null}, calculate properties, otherwise use properties received
|
||||
* @since 5.3
|
||||
*/
|
||||
protected MIBreakpointDMData(MIBreakpoint dsfMIBreakpoint, HashMap<String, Object> properties) {
|
||||
fBreakpoint = dsfMIBreakpoint;
|
||||
if (dsfMIBreakpoint.isTracepoint()) {
|
||||
fNature = MIBreakpointNature.TRACEPOINT;
|
||||
} else if (dsfMIBreakpoint.isDynamicPrintf()) {
|
||||
fNature = MIBreakpointNature.DYNAMICPRINTF;
|
||||
} else if (dsfMIBreakpoint.isWatchpoint()) {
|
||||
fNature = MIBreakpointNature.WATCHPOINT;
|
||||
} else if (dsfMIBreakpoint.isCatchpoint()) {
|
||||
fNature = MIBreakpointNature.CATCHPOINT;
|
||||
if (properties != null) {
|
||||
fProperties = properties;
|
||||
} else {
|
||||
fNature = MIBreakpointNature.BREAKPOINT;
|
||||
}
|
||||
fProperties = new HashMap<String,Object>();
|
||||
|
||||
fProperties = new HashMap<String,Object>();
|
||||
switch (fNature) {
|
||||
if (dsfMIBreakpoint.isTracepoint()) {
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
||||
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
|
||||
fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
|
||||
fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
|
||||
fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
|
||||
fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
|
||||
fProperties.put(MIBreakpoints.PASS_COUNT, dsfMIBreakpoint.getPassCount());
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
|
||||
fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
|
||||
|
||||
case BREAKPOINT:
|
||||
{
|
||||
// Note that this may in fact be a catchpoint. See comment below in
|
||||
// CATCHPOINT case
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
fProperties.put(TYPE, dsfMIBreakpoint.getType());
|
||||
fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
|
||||
fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
|
||||
fProperties.put(HITS, dsfMIBreakpoint.getTimes());
|
||||
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
|
||||
} else if (dsfMIBreakpoint.isDynamicPrintf()) {
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
|
||||
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
|
||||
fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
|
||||
fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
|
||||
fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
|
||||
fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
|
||||
fProperties.put(MIBreakpoints.PRINTF_STRING, dsfMIBreakpoint.getPrintfString());
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
|
||||
fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
fProperties.put(TYPE, dsfMIBreakpoint.getType());
|
||||
fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
|
||||
fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
|
||||
fProperties.put(HITS, dsfMIBreakpoint.getTimes());
|
||||
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
|
||||
} else if (dsfMIBreakpoint.isWatchpoint()) {
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
|
||||
fProperties.put(MIBreakpoints.EXPRESSION, dsfMIBreakpoint.getExpression());
|
||||
fProperties.put(MIBreakpoints.READ, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isReadWatchpoint());
|
||||
fProperties.put(MIBreakpoints.WRITE, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isWriteWatchpoint());
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
|
||||
} else if (dsfMIBreakpoint.isCatchpoint()) {
|
||||
// Because gdb doesn't support catchpoints in mi, we end up using
|
||||
// CLI to set the catchpoint. The sort of MIBreakpoint we create
|
||||
// at that time is minimal as the only information we get back from
|
||||
// gdb is the breakpoint number and type of the catchpoint we just
|
||||
// set. See MIBreakpoint(String)
|
||||
//
|
||||
// The only type of MIBreakpoint that will be of this CATCHPOINT type
|
||||
// is the instance we create from the response of the CLI command we
|
||||
// use to set the catchpoint. If we later query gdb for the breakpoint
|
||||
// list, we'll unfortunately end up creating an MIBreakpoint of type
|
||||
// BREAKPOINT. Maybe one day gdb will treats catchpoints like first
|
||||
// class citizens and this messy situation will go away.
|
||||
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
|
||||
fProperties.put(MIBreakpoints.CATCHPOINT_TYPE, dsfMIBreakpoint.getCatchpointType());
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
|
||||
} else {
|
||||
// For all other breakpoint types, use MIBreakpoints.BREAKPOINT.
|
||||
|
||||
// Note that this may in fact be a catchpoint. See comment above in
|
||||
// isCatchpoint case
|
||||
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
|
||||
|
@ -111,102 +195,45 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
break;
|
||||
}
|
||||
|
||||
case WATCHPOINT:
|
||||
{
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);
|
||||
fProperties.put(MIBreakpoints.EXPRESSION, dsfMIBreakpoint.getExpression());
|
||||
fProperties.put(MIBreakpoints.READ, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isReadWatchpoint());
|
||||
fProperties.put(MIBreakpoints.WRITE, dsfMIBreakpoint.isAccessWatchpoint() || dsfMIBreakpoint.isWriteWatchpoint());
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
break;
|
||||
}
|
||||
|
||||
case TRACEPOINT:
|
||||
{
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
|
||||
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
|
||||
fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
|
||||
fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
|
||||
fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
|
||||
fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
|
||||
fProperties.put(MIBreakpoints.PASS_COUNT, dsfMIBreakpoint.getPassCount());
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
|
||||
fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
fProperties.put(TYPE, dsfMIBreakpoint.getType());
|
||||
fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
|
||||
fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
|
||||
fProperties.put(HITS, dsfMIBreakpoint.getTimes());
|
||||
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
break;
|
||||
}
|
||||
|
||||
case DYNAMICPRINTF:
|
||||
{
|
||||
// Generic breakpoint attributes
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
|
||||
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
|
||||
fProperties.put(MIBreakpoints.LINE_NUMBER, dsfMIBreakpoint.getLine());
|
||||
fProperties.put(MIBreakpoints.FUNCTION, dsfMIBreakpoint.getFunction());
|
||||
fProperties.put(MIBreakpoints.ADDRESS, dsfMIBreakpoint.getAddress());
|
||||
fProperties.put(MIBreakpoints.CONDITION, dsfMIBreakpoint.getCondition());
|
||||
fProperties.put(MIBreakpoints.PRINTF_STRING, dsfMIBreakpoint.getPrintfString());
|
||||
fProperties.put(MIBreakpoints.IS_ENABLED, Boolean.valueOf(dsfMIBreakpoint.isEnabled()));
|
||||
fProperties.put(MIBreakpoints.COMMANDS, dsfMIBreakpoint.getCommands());
|
||||
|
||||
// MI-specific breakpoint attributes
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
fProperties.put(TYPE, dsfMIBreakpoint.getType());
|
||||
fProperties.put(THREAD_ID, dsfMIBreakpoint.getThreadId());
|
||||
fProperties.put(FULL_NAME, dsfMIBreakpoint.getFullName());
|
||||
fProperties.put(HITS, dsfMIBreakpoint.getTimes());
|
||||
fProperties.put(IS_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
|
||||
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
|
||||
fProperties.put(LOCATION, formatLocation());
|
||||
break;
|
||||
}
|
||||
|
||||
case CATCHPOINT:
|
||||
{
|
||||
// Because gdb doesn't support catchpoints in mi, we end up using
|
||||
// CLI to set the catchpoint. The sort of MIBreakpoint we create
|
||||
// at that time is minimal as the only information we get back from
|
||||
// gdb is the breakpoint number and type of the catchpoint we just
|
||||
// set. See MIBreakpoint(String)
|
||||
//
|
||||
// The only type of MIBreakpoint that will be of this CATCHPOINT type
|
||||
// is the instance we create from the response of the CLI command we
|
||||
// use to set the catchpoint. If we later query gdb for the breakpoint
|
||||
// list, we'll unfortunately end up creating an MIBreakpoint of type
|
||||
// BREAKPOINT. Maybe one day gdb will treats catchpoints like first
|
||||
// class citizens and this messy situation will go away.
|
||||
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
|
||||
fProperties.put(MIBreakpoints.CATCHPOINT_TYPE, dsfMIBreakpoint.getCatchpointType());
|
||||
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
|
||||
break;
|
||||
}
|
||||
|
||||
// Not reachable
|
||||
default:
|
||||
{
|
||||
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a DsfMIBreakpoint from a back-end object. Create the object by calling
|
||||
* {@link MIBreakpoints#createMIBreakpointDMData(MIBreakpoint)} to ensure correct version is called.
|
||||
*
|
||||
* @param dsfMIBreakpoint
|
||||
* back-end breakpoint
|
||||
* @deprecated Call {@link MIBreakpoints#createMIBreakpointDMData(MIBreakpoint)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public MIBreakpointDMData(MIBreakpoint dsfMIBreakpoint) {
|
||||
this(dsfMIBreakpoint, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the properties map. Method only intended to be called by sub-classes.
|
||||
*
|
||||
* @return properties map
|
||||
* @since 5.3
|
||||
*/
|
||||
protected Map<String, Object> getProperties() {
|
||||
return fProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the MI Breakpoint. Method only intended to be called by sub-classes.
|
||||
*
|
||||
* @return breakpoint
|
||||
* @since 5.3
|
||||
*/
|
||||
protected MIBreakpoint getBreakpoint() {
|
||||
return fBreakpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the LOCATION synthetic property from the existing fields
|
||||
*
|
||||
|
@ -240,21 +267,19 @@ public class MIBreakpointDMData implements IBreakpointDMData {
|
|||
* @return
|
||||
*/
|
||||
public boolean equals(MIBreakpointDMData other) {
|
||||
return (fNature == other.fNature) && (fProperties.equals(other.fProperties));
|
||||
return fProperties.equals(other.fProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) return true;
|
||||
if (!(other instanceof MIBreakpointDMData)) return false;
|
||||
MIBreakpointDMData bpData = (MIBreakpointDMData)other;
|
||||
|
||||
return (fNature == bpData.fNature) && (fProperties.equals(bpData.fProperties));
|
||||
return equals((MIBreakpointDMData)other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return fNature.hashCode() ^ fProperties.hashCode();
|
||||
return fProperties.hashCode();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -167,6 +167,21 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new effective breakpoint data object
|
||||
*
|
||||
* @param breakpoint
|
||||
* backend breakpoint to create DSF object from
|
||||
* @return breakpoint data object
|
||||
* @since 5.3
|
||||
*/
|
||||
@ThreadSafe
|
||||
public MIBreakpointDMData createMIBreakpointDMData(MIBreakpoint breakpoint) {
|
||||
@SuppressWarnings("deprecation")
|
||||
MIBreakpointDMData data = new MIBreakpointDMData(breakpoint);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new MI breakpoint
|
||||
*
|
||||
|
@ -451,7 +466,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
|
||||
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
|
||||
for (int i = 0; i < breakpoints.length; i++) {
|
||||
MIBreakpointDMData breakpoint = new MIBreakpointDMData(breakpoints[i]);
|
||||
MIBreakpointDMData breakpoint = createMIBreakpointDMData(breakpoints[i]);
|
||||
String reference = breakpoint.getReference();
|
||||
result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
|
||||
breakpointContext.put(reference, breakpoint);
|
||||
|
@ -507,8 +522,9 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
}
|
||||
|
||||
// No need to go to the back-end for this one
|
||||
IBreakpointDMData breakpointCopy = new MIBreakpointDMData(contextBreakpoints.get(breakpoint.getReference()));
|
||||
drm.setData(breakpointCopy);
|
||||
MIBreakpointDMData breakpointDMData = contextBreakpoints.get(breakpoint.getReference());
|
||||
IBreakpointDMData breakpointDMDataCopy = breakpointDMData.copy();
|
||||
drm.setData(breakpointDMDataCopy);
|
||||
drm.done();
|
||||
}
|
||||
|
||||
|
@ -699,7 +715,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));
|
||||
|
@ -789,7 +805,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(getData().getMIBreakpoints()[0]);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, null));
|
||||
|
@ -879,7 +895,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
|
|||
}
|
||||
|
||||
// Create a breakpoint object and store it in the map
|
||||
final MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBkpt);
|
||||
final MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBkpt);
|
||||
String reference = newBreakpoint.getNumber();
|
||||
if (reference.isEmpty()) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null));
|
||||
|
|
|
@ -222,7 +222,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
|||
if (contextBreakpoints == null) {
|
||||
contextBreakpoints = breakpointsService.createNewBreakpointMap(bpTargetDMC);
|
||||
}
|
||||
contextBreakpoints.put(miBpt.getNumber(), new MIBreakpointDMData(miBpt));
|
||||
contextBreakpoints.put(miBpt.getNumber(), fBreakpointsService.createMIBreakpointDMData(miBpt));
|
||||
|
||||
// Store the created target breakpoint to prevent setting it again on the target
|
||||
// when addBreakpoint() is called.
|
||||
|
@ -416,7 +416,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
|||
MIBreakpoint miBpt) {
|
||||
Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC);
|
||||
MIBreakpointDMData oldData = contextBreakpoints.get(miBpt.getNumber());
|
||||
contextBreakpoints.put(miBpt.getNumber(), new MIBreakpointDMData(miBpt));
|
||||
contextBreakpoints.put(miBpt.getNumber(), fBreakpointsService.createMIBreakpointDMData(miBpt));
|
||||
try {
|
||||
if (plBpt.isEnabled() != miBpt.isEnabled()) {
|
||||
plBpt.setEnabled(miBpt.isEnabled());
|
||||
|
|
Loading…
Add table
Reference in a new issue