1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-07 16:26:11 +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:
Jonah Graham 2017-05-03 11:45:08 +01:00
parent a36ecd3839
commit d4ecd37bb1
7 changed files with 150 additions and 109 deletions

View file

@ -177,7 +177,7 @@ public class GDBBreakpoints_7_0 extends MIBreakpoints
} }
// Create a breakpoint object and store it in the map // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); 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)) { if (bp.getNumber().equals(tpReference)) {
// Create a breakpoint object and store it in the map // 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(); String reference = newBreakpoint.getNumber();
contextBreakpoints.put(reference, newBreakpoint); contextBreakpoints.put(reference, newBreakpoint);

View file

@ -147,7 +147,7 @@ public class GDBBreakpoints_7_2 extends GDBBreakpoints_7_0
breakpointContext.clear(); breakpointContext.clear();
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length]; IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
for (int i = 0; i < breakpoints.length; i++) { 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 // Now fill in the thread-group information into the breakpoint data
// It is ok to get null. For example, pending breakpoints are not // 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 // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null));

View file

@ -188,7 +188,7 @@ public class GDBBreakpoints_7_4 extends GDBBreakpoints_7_2 implements IEventList
MIBreakpoint miBpt = getData(); MIBreakpoint miBpt = getData();
if (miBpt != null) { if (miBpt != null) {
bs.removeCreatedTargetBreakpoint(context, miBpt); bs.removeCreatedTargetBreakpoint(context, miBpt);
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt); MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint); getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
IBreakpointDMContext dmc = IBreakpointDMContext dmc =
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber()); 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(); MIBreakpoint miBpt = getData();
if (miBpt != null) { if (miBpt != null) {
bs.removeCreatedTargetBreakpoint(context, miBpt); bs.removeCreatedTargetBreakpoint(context, miBpt);
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt); MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint); getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
IBreakpointDMContext dmc = IBreakpointDMContext dmc =
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber()); 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(); MIBreakpoint miBpt = getData();
if (miBpt != null) { if (miBpt != null) {
bs.removeCreatedTargetBreakpoint(context, miBpt); bs.removeCreatedTargetBreakpoint(context, miBpt);
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt); MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint); getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
IBreakpointDMContext dmc = IBreakpointDMContext dmc =
new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber()); new MIBreakpointDMContext(GDBBreakpoints_7_4.this, new IDMContext[] { context }, newBreakpoint.getNumber());

View file

@ -110,7 +110,7 @@ public class GDBBreakpoints_7_7 extends GDBBreakpoints_7_6 {
MIBreakpoint miBpt = getData(); MIBreakpoint miBpt = getData();
if (miBpt != null) { if (miBpt != null) {
bs.removeCreatedTargetBreakpoint(context, miBpt); bs.removeCreatedTargetBreakpoint(context, miBpt);
MIBreakpointDMData newBreakpoint = new MIBreakpointDMData(miBpt); MIBreakpointDMData newBreakpoint = createMIBreakpointDMData(miBpt);
getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint); getBreakpointMap(context).put(newBreakpoint.getNumber(), newBreakpoint);
IBreakpointDMContext dmc = IBreakpointDMContext dmc =
new MIBreakpointDMContext(GDBBreakpoints_7_7.this, new IDMContext[] { context }, newBreakpoint.getNumber()); 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 // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null)); rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, DYNAMIC_PRINTF_INSERTION_FAILURE, null));

View file

@ -39,12 +39,20 @@ public class MIBreakpointDMData implements IBreakpointDMData {
private final MIBreakpoint fBreakpoint; private final MIBreakpoint fBreakpoint;
private final Map<String, Object> fProperties; private final Map<String, Object> fProperties;
// Breakpoint types /**
public static enum MIBreakpointNature { UNKNOWN, BREAKPOINT, WATCHPOINT, CATCHPOINT, * Breakpoint types
/** @since 3.0*/ TRACEPOINT, *
/** @since 4.4*/ DYNAMICPRINTF }; * @deprecated This enum is not extensible, so has been deprecated to allow extenders to have their own breakpoint
private final MIBreakpointNature fNature; * 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 // Constructors
@ -54,81 +62,42 @@ public class MIBreakpointDMData implements IBreakpointDMData {
* Copy constructor * Copy constructor
* *
* @param other * @param other
* @deprecated Call {@link #copy()} on other instead to allow subclasses to be copied properly.
*/ */
@Deprecated
public MIBreakpointDMData(MIBreakpointDMData other) { public MIBreakpointDMData(MIBreakpointDMData other) {
fBreakpoint = new MIBreakpoint(other.fBreakpoint); fBreakpoint = new MIBreakpoint(other.fBreakpoint);
fProperties = new HashMap<String, Object>(other.fProperties); 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; fBreakpoint = dsfMIBreakpoint;
if (dsfMIBreakpoint.isTracepoint()) { if (properties != null) {
fNature = MIBreakpointNature.TRACEPOINT; fProperties = properties;
} else if (dsfMIBreakpoint.isDynamicPrintf()) {
fNature = MIBreakpointNature.DYNAMICPRINTF;
} else if (dsfMIBreakpoint.isWatchpoint()) {
fNature = MIBreakpointNature.WATCHPOINT;
} else if (dsfMIBreakpoint.isCatchpoint()) {
fNature = MIBreakpointNature.CATCHPOINT;
} else { } else {
fNature = MIBreakpointNature.BREAKPOINT; fProperties = new HashMap<String,Object>();
}
fProperties = new HashMap<String,Object>(); if (dsfMIBreakpoint.isTracepoint()) {
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());
// MI-specific breakpoint attributes
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
break;
}
case TRACEPOINT:
{
// Generic breakpoint attributes // Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT);
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile()); 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_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware())); fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
fProperties.put(LOCATION, formatLocation()); fProperties.put(LOCATION, formatLocation());
break;
} } else if (dsfMIBreakpoint.isDynamicPrintf()) {
case DYNAMICPRINTF:
{
// Generic breakpoint attributes // Generic breakpoint attributes
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF); fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.DYNAMICPRINTF);
fProperties.put(MIBreakpoints.FILE_NAME, dsfMIBreakpoint.getFile()); 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_TEMPORARY, Boolean.valueOf(dsfMIBreakpoint.isTemporary()));
fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware())); fProperties.put(IS_HARDWARE, Boolean.valueOf(dsfMIBreakpoint.isHardware()));
fProperties.put(LOCATION, formatLocation()); fProperties.put(LOCATION, formatLocation());
break;
} } else if (dsfMIBreakpoint.isWatchpoint()) {
// Generic breakpoint attributes
case CATCHPOINT: 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 // Because gdb doesn't support catchpoints in mi, we end up using
// CLI to set the catchpoint. The sort of MIBreakpoint we create // CLI to set the catchpoint. The sort of MIBreakpoint we create
// at that time is minimal as the only information we get back from // 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.BREAKPOINT_TYPE, MIBreakpoints.CATCHPOINT);
fProperties.put(MIBreakpoints.CATCHPOINT_TYPE, dsfMIBreakpoint.getCatchpointType()); fProperties.put(MIBreakpoints.CATCHPOINT_TYPE, dsfMIBreakpoint.getCatchpointType());
fProperties.put(NUMBER, dsfMIBreakpoint.getNumber()); fProperties.put(NUMBER, dsfMIBreakpoint.getNumber());
break;
} } else {
// For all other breakpoint types, use MIBreakpoints.BREAKPOINT.
// Not reachable
default: // Note that this may in fact be a catchpoint. See comment above in
{ // isCatchpoint case
fProperties.put(MIBreakpoints.BREAKPOINT_TYPE, null);
break; // 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 * Formats the LOCATION synthetic property from the existing fields
* *
@ -240,21 +267,19 @@ public class MIBreakpointDMData implements IBreakpointDMData {
* @return * @return
*/ */
public boolean equals(MIBreakpointDMData other) { public boolean equals(MIBreakpointDMData other) {
return (fNature == other.fNature) && (fProperties.equals(other.fProperties)); return fProperties.equals(other.fProperties);
} }
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) return true; if (this == other) return true;
if (!(other instanceof MIBreakpointDMData)) return false; if (!(other instanceof MIBreakpointDMData)) return false;
MIBreakpointDMData bpData = (MIBreakpointDMData)other; return equals((MIBreakpointDMData)other);
return (fNature == bpData.fNature) && (fProperties.equals(bpData.fProperties));
} }
@Override @Override
public int hashCode() { public int hashCode() {
return fNature.hashCode() ^ fProperties.hashCode(); return fProperties.hashCode();
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View file

@ -166,7 +166,22 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
fBreakpoints.put(ctx, map); fBreakpoints.put(ctx, map);
return 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 * Create a new MI breakpoint
* *
@ -451,7 +466,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); MIBreakpoint[] breakpoints = getData().getMIBreakpoints();
IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length]; IBreakpointDMContext[] result = new IBreakpointDMContext[breakpoints.length];
for (int i = 0; i < breakpoints.length; i++) { for (int i = 0; i < breakpoints.length; i++) {
MIBreakpointDMData breakpoint = new MIBreakpointDMData(breakpoints[i]); MIBreakpointDMData breakpoint = createMIBreakpointDMData(breakpoints[i]);
String reference = breakpoint.getReference(); String reference = breakpoint.getReference();
result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference); result[i] = new MIBreakpointDMContext(MIBreakpoints.this, new IDMContext[] { context }, reference);
breakpointContext.put(reference, breakpoint); 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 // No need to go to the back-end for this one
IBreakpointDMData breakpointCopy = new MIBreakpointDMData(contextBreakpoints.get(breakpoint.getReference())); MIBreakpointDMData breakpointDMData = contextBreakpoints.get(breakpoint.getReference());
drm.setData(breakpointCopy); IBreakpointDMData breakpointDMDataCopy = breakpointDMData.copy();
drm.setData(breakpointDMDataCopy);
drm.done(); drm.done();
} }
@ -699,7 +715,7 @@ public class MIBreakpoints extends AbstractDsfService implements IBreakpoints, I
} }
// Create a breakpoint object and store it in the map // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, BREAKPOINT_INSERTION_FAILURE, null)); 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 // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
drm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, WATCHPOINT_INSERTION_FAILURE, null)); 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 // 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(); String reference = newBreakpoint.getNumber();
if (reference.isEmpty()) { if (reference.isEmpty()) {
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null)); rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, REQUEST_FAILED, CATCHPOINT_INSERTION_FAILURE, null));

View file

@ -222,7 +222,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
if (contextBreakpoints == null) { if (contextBreakpoints == null) {
contextBreakpoints = breakpointsService.createNewBreakpointMap(bpTargetDMC); 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 // Store the created target breakpoint to prevent setting it again on the target
// when addBreakpoint() is called. // when addBreakpoint() is called.
@ -416,7 +416,7 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
MIBreakpoint miBpt) { MIBreakpoint miBpt) {
Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC); Map<String, MIBreakpointDMData> contextBreakpoints = getBreakpointsService().getBreakpointMap(bpTargetDMC);
MIBreakpointDMData oldData = contextBreakpoints.get(miBpt.getNumber()); MIBreakpointDMData oldData = contextBreakpoints.get(miBpt.getNumber());
contextBreakpoints.put(miBpt.getNumber(), new MIBreakpointDMData(miBpt)); contextBreakpoints.put(miBpt.getNumber(), fBreakpointsService.createMIBreakpointDMData(miBpt));
try { try {
if (plBpt.isEnabled() != miBpt.isEnabled()) { if (plBpt.isEnabled() != miBpt.isEnabled()) {
plBpt.setEnabled(miBpt.isEnabled()); plBpt.setEnabled(miBpt.isEnabled());