From a21c69868a0e2ef09eacccb45af600c8d3a66f44 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Fri, 12 Mar 2010 16:10:03 +0000 Subject: [PATCH] [305554] Incorrect check in MIBreakpointsManager.modifyBreakpoint() --- .../dsf/mi/service/MIBreakpointsManager.java | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index 4fca97126e0..f4848c0afde 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -91,6 +91,7 @@ import org.osgi.framework.BundleContext; * * It relies on MIBreakpoints for the actual back-end interface. */ +@SuppressWarnings("restriction") // we use an internal platform type (BreakpointProblems) public class MIBreakpointsManager extends AbstractDsfService implements IBreakpointManagerListener, IBreakpointListener { // Note: Find a way to import this (careful of circular dependencies) @@ -827,7 +828,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Get the list of back-end breakpoints final Vector oldTargetBPs = new Vector(breakpointIDs.get(breakpoint)); - if (oldTargetBPs == null) { + if (oldTargetBPs.isEmpty()) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null)); rm.done(); return; @@ -1388,15 +1389,15 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Support functions /////////////////////////////////////////////////////////////////////////// - /** - * supportsBreakpoint - * - * Indicates if it is breakpoint we can deal with. For now, it boils down - * to a CDI breakpoint... - * - * @param bp - * @return - */ + /** + * Indicates if the platform breakpoint object [bp] is one we can deal with. + * For now, it boils down to whether it's a CDT Breakpoint (an + * ICBreakpoint). DSF can supports other (custom) types of breakpoints, but + * DSF-GDB is tied to ICBreakpoint. + * + * @param bp the platform breakpoint + * @return true if we support it; false otherwise + */ private boolean supportsBreakpoint(IBreakpoint bp) { if (bp instanceof ICBreakpoint && bp.getModelIdentifier().equals(fDebugModelId)) { IMarker marker = bp.getMarker(); @@ -1634,26 +1635,32 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Non-generic (MI-specific) functions /////////////////////////////////////////////////////////////////////////// - /** - * Create a target breakpoint from an ICBreakpoint - * - * @param breakpoint - * @param attributes - * @return - */ + /** + * Create a collection of DSF-GDB specific breakpoint properties given a + * platform/CDT breakpoint object and its properties. Basically, this + * determines the set of MI-specific properties to be used in installing the + * given breakpoint. + * + * @param breakpoint + * the platform breakpoint object; was created by CDT + * @param attributes + * the breakpoint's properties. By allowing this to be passed in + * (rather than us calling + * IBreakpoint#getMarker()#getProperties()), we allow the caller + * to specify additional/modified properties. + * @return a property bag containing the corresponding DSF-GDB properties + */ protected Map convertToTargetBreakpoint(ICBreakpoint breakpoint, Map attributes) { Map properties = new HashMap(); if (breakpoint instanceof ICWatchpoint) { - // Convert the CDI watchpoint to an IBreakpoint properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT); properties.put(MIBreakpoints.EXPRESSION, attributes.get(ICWatchpoint.EXPRESSION)); properties.put(MIBreakpoints.READ, attributes.get(ICWatchpoint.READ)); properties.put(MIBreakpoints.WRITE, attributes.get(ICWatchpoint.WRITE)); } else if (breakpoint instanceof ICLineBreakpoint) { - // Convert the CDI breakpoint to an IBreakpoint properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT); properties.put(MIBreakpoints.FILE_NAME, attributes.get(ATTR_DEBUGGER_PATH)); properties.put(MIBreakpoints.LINE_NUMBER, attributes.get(IMarker.LINE_NUMBER));