Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2017-05-03 06:45:08 -0400
committerJonah Graham2017-05-05 08:35:48 -0400
commitd4ecd37bb1464828cc944010ba7a559aa0c67f30 (patch)
treed48cd9194c0bbb156e4b16112365a2a8985f0db3 /dsf-gdb
parenta36ecd3839c95226ff27ee5d247f720328ffe765 (diff)
downloadorg.eclipse.cdt-d4ecd37bb1464828cc944010ba7a559aa0c67f30.tar.gz
org.eclipse.cdt-d4ecd37bb1464828cc944010ba7a559aa0c67f30.tar.xz
org.eclipse.cdt-d4ecd37bb1464828cc944010ba7a559aa0c67f30.zip
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
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java6
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java4
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java207
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java30
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java4
7 files changed, 150 insertions, 109 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
index a59244eb64..140aee07c6 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_0.java
@@ -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);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
index 26fd546412..4fbdeb892f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_2.java
@@ -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));
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
index 55808cfaa2..a9d0607f0f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_4.java
@@ -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());
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
index 2493b9de94..a73a29472f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBBreakpoints_7_7.java
@@ -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));
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
index 5f20ce05de..8378ab1e0a 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointDMData.java
@@ -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,81 +62,42 @@ 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
- *
- * @param dsfMIBreakpoint back-end breakpoint
+ * Perform a copy.
+ *
+ * @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>();
- switch (fNature) {
-
- case BREAKPOINT:
- {
- // Note that this may in fact be a catchpoint. See comment below in
- // CATCHPOINT case
-
- // Generic breakpoint attributes
- fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT);
- 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.IGNORE_COUNT, dsfMIBreakpoint.getIgnoreCount());
- 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 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());
+ fProperties = new HashMap<String,Object>();
- // MI-specific breakpoint attributes
- fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
- break;
- }
-
- case TRACEPOINT:
- {
+ if (dsfMIBreakpoint.isTracepoint()) {
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
@@ -149,11 +118,8 @@ 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 DYNAMICPRINTF:
- {
+
+ } else if (dsfMIBreakpoint.isDynamicPrintf()) {
// Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile());
@@ -174,11 +140,18 @@ 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 CATCHPOINT:
- {
+
+ } 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
@@ -195,18 +168,72 @@ public class MIBreakpointDMData implements IBreakpointDMData {
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;
+
+ } 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);
+ 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.IGNORE_COUNT, dsfMIBreakpoint.getIgnoreCount());
+ 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());
+
}
}
}
+
+ /**
+ * 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();
}
///////////////////////////////////////////////////////////////////////////
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
index ecf10d6b08..abc6e6aa5c 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpoints.java
@@ -166,7 +166,22 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
fBreakpoints.put(ctx, map);
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));
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
index b5c7c4606f..7223442571 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsSynchronizer.java
@@ -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());

Back to the top